Localization

For developers

When you change a string in a template or in a web server, you have to generate again the file cms/server/po/messages.pot. To do so, run this command inside cms/server/.

xgettext -o po/messages.pot --language=Python --keyword=_:1,2 \
  *.py templates/admin/*.html templates/contest/*.html

When you have a new translation, or an update of an old translation, you need to update the .mo files (the compiled versions of the .po files). You can run ./setup.py build to update all translations (and also do a couple of other things, like compiling the sandbox). Alternatively, run the following inside cms/server/.

msgfmt po/<code>.po -o mo/<code>/LC_MESSAGES/cms.mo

If needed, create the tree. Note that to have the new strings, you need to restart the web server.

For translators

To begin translating to a new language, run this command, from cms/server/po/.

msginit -d <two_letter_code_of_language>

Right after that, open <code>.po and fill the information in the header. To translate a string, simply fill the corresponding msgstr with the translations.

If the developers updated the .pot file, you do not need to start from scratch. Instead, you can create a new .po file that merges the old translated string with the new, to-be-translated ones. The command is the following, run inside cms/server/po/.

msgmerge <code>.po messages.pot > <code>.new.po

You can now inspect <code>.new.po and, if satisfied, move it to <code>.po and finish the translation.

Project Versions

Table Of Contents

Previous topic

RankingWebServer

Next topic

Troubleshooting

This Page