Skip to content
Jordy Ruiz edited this page Apr 26, 2019 · 5 revisions

teeworlds-translation is a submodule of teeworlds.

Contributing translations on Transifex

Please read heinrich5991's instructions at https://www.teeworlds.com/forum/viewtopic.php?id=10929

Importing Transifex translations (.po → .json)

  1. Download your strings from Transifex
    You will receive a .po file.

  2. Download and install Python3, and the [https://pypi.org/project/polib/] (polib) module

  3. Download this python script: reconvert_l10n.py (located at teeworlds/master/scripts/reconvert_l10n.py)

  4. Run the script on the .po file:
    python3 reconvert_l10n.py <language>.po

This will yield you the JSON file you're looking for, to be put in <teeworlds folder>/data/languages.

Testing translations in Teeworlds

Translations are located in your Teeworlds folder in <teeworlds folder>/data/languages, as JSON files. In order to test your new Transifex translation, you need to:

  • Add/replace your <language>.json file (e.g. german.json)
  • If your language is new: edit index.json to add an entry for your language

This can help you with the context of some strings. Please try different resolutions to make sure your strings fit well and don't get truncated.


The following section is only relevant for those with Transifex maintainer access.

Exporting Teeworlds strings to Transifex (C++/.json → .pot)

You need to run the convert_l10n.py script located here: https://github.com/teeworlds/teeworlds/blob/master/scripts/convert_l10n.py, using Python3 and polib as mentioned above.

Run the script in the scripts folder, it will recursively scan for Localize(...) in the Teeworlds code located in the parent folder and generate a base.pot file, to be loaded into Transifex.

Troubleshooting

If you get cannot find file or directory: base.pot errors, you may need to replace some relative paths in the script by absolute paths on Linux.

If you get any errors within write_languagefile(outputfilename, l10n_src, old_l10n_data), you may comment the call out and still output a base.pot.