Python ships with the gettext module for handling localization, as well as pygettext.py and msgfmt.py for creating the files required by gettext.
Ideas for implementation:
- Write a tool that will recursively scan a given folder using pygettext.py to extract all strings marked for localization. This will create a .pot file containing the extracted string.
- Instead of editing copies of this .pot file directly, parse it and store the information in a semi-public database. The database will contain the original strings and their location in the code.
- Recruit volunteers to translate these strings into various languages.
- Give each volunteer access to the database
- Create a tool that will allow them to view the original string along with its context in the the script in which it was extracted, enter the translation for that string for their language, and save that translation to the database on the server.
- When changes to Dabo are made, re-run the tool to extract the strings. Compare them with the existing strings in the database, and add/update if necessary.
- Provide for notification of all translators when the database has been updated.
- Create another tool to create the .po files from the database for each language, compile them to .mo files, and place them in the appropriate directories.
- dApp will require a property named
Language. Changing this property changes the current localized translation, allowing the user to set it toEnglishand have the app know to set it toen. - We will also need a developer tool that would work similarly, but instead of updating a database on the dabodev servers, would update a local SQLite database. It should also be capable of generating the required .mo files in the application's directory structure.