well, maybe I should have explained what I'm trying to do in the original email. Fixing this mistake now.
I have a tool called
Wikinity. The tool takes data from Wikidata and displays items with no image uploaded. It became to be used by Czech Commons users in the preparation step for their photo trip. The
source is awful, to say the most important parts from how its written:
- Frontend is in public/*.php. Those files used to be HTML files while the tool was in one language only. I switched them to PHP only to be able to use Intuition.
- Backend logic is in public/*.py. for the main purpose of tool, public/map.py is important, which selects appropriate Wikidata query (stored in queries/*.txt) based on GET parameters and creates a map.
- JavaScript just displays the map generated by map.py.
- Other files are used for other things like storing queries.
Yeah, I know its awful (but working :D). I plan to rewrite it. As I already use Translatewiki, which generates
locales in certain format, I want to keep it. The fornat is straightforward to me and not like gettext which I managed to understood, but I think this is more clear. Of course, you might not agree, that's my current point of view.
My plan is to convert this into a simple Flask app, which should incorporate several backend CGI scripts written in Python into one file with much more clear structure. This Flask app should ofc do the same things like the current tool does. I know how to do everything from the function side. The only one thing I'm thinking about is the localization - more certainly, what way I should use to use locales in
this format in a Flask app (more precisely, in its Jinja2 templates, I do not have anything to localize in the Python part).
BTW, I tried to use Flask-Babel and I manged to have
working localization. The only one thing I don't like is that it uses gettext, which I don't like and its not like "modify this json file and the locales will change automatically", but "modify this .po file, then compile it it and maybe it will work".
Martin