This project uses the standard Django translation mechanisms.

What goes in version control?

Message files are located in the locale/ directory. Files for each available language are in subdirectories named according to ISO language codes.

The django.po file in each language directory contains all translatable messages, plus the translation if available. Django reads translated messages at runtime from the file, which is the compiled version of the .po file. We commit both files to GitHub for ease of tracking changes and making reverts if needed.

Update translations

A developer should update message files when Python or template code with translatable messages is changed or when a new language is added. NOTE: To minimize noise, we generally update translation files just once per release cycle.

  1. Create or update the message files:

    python makemessages --ignore 'conf/*' \
                                  --ignore 'docs/*' \
                                  --ignore 'requirements/*' \
                                  --no-location --no-obsolete -l en
  2. Ensure that changes look reasonable using git diff. E.g., if translations have vanished, figure out why before proceeding.

  3. Edit these files to add translations, if or when able.

  4. Compile the message files:

    python compilemessages

    If you get any errors due to badly formatted translations, work with your translators to fix the errors and start this process over.

  5. Commit these changes to GitHub.

Add a new language

  1. Add the language to the LANGUAGES setting. tracpro/settings/
  2. If the language is written from right to left, add the language code to RTL_LANGUAGES.
  3. Create an empty directory, named with the language’s two-letter ISO code, in the locale/ directory.
  4. Update the translation files as described above.
  5. Commit these changes to GitHub.