Manage translations

Manage translations#

Requirements#

Qt Linguist tools are used to manage translations. Typically on Ubuntu:

sudo apt install qttools5-dev-tools

Workflow#

  1. Generate the plugin_translation.pro file:

    python scripts/generate_translation_profile.py
    
  2. Update .ts files:

    pylupdate5 -noobsolete -verbose geoplateforme/resources/i18n/plugin_translation.pro
    
  3. Translate your text using QLinguist or directly into .ts files. Launching it through command-line is possible:

    linguist geoplateforme/resources/i18n/*.ts
    
  4. Compile it:

    lrelease geoplateforme/resources/i18n/*.ts
    

Notes#

  • Remember that the resulting *.qm file should not be tracked in git history since it’s autogenerated and a binary file. The CI/CD pipeline will take care of generating it and packaging it. However, you can add the *.qm file to .gitignore to avoid any accidental commits.

  • The pylupdate5 command is used to extract translatable strings from the source code and update the .ts files accordingly.

  • The -no-obsolete flag is important to avoid removing obsolete translations, which can be useful for maintaining the history of translations and ensuring that no existing translations are lost during updates.

  • The -verbose flag is used to provide detailed output during the translation update process, which can be helpful for debugging and ensuring that the process is working correctly.

  • The linguist command is used to launch the Qt Linguist application, which provides a graphical interface for translating the .ts files. This can be more user-friendly than editing the files directly in a text editor.

  • The lrelease command is used to compile the .ts files into .qm files, which are binary files used by Qt applications for translations.