12. Translation

There are three targets for translation:

  • graphical user interface (GUI)

  • reports

  • documentation

12.1. GUI

12.1.1. Translation

Dependencies:

sudo apt install qttranslations5-l10n

Update list of strings to translate:

lupdate Comp3D_cpp.pro

or, in Qt Creator:

Tools>External>Linguist>lupdate

Then run the the linguist GUI via

linguist

and open file gui/translations/Comp3D_fr.ts.

Translations are compiled at the same time as the executable.

12.1.2. Add a new language translation

Add to the project the Qt ressources files corresponding to the language: qt_XX.qm and qtbase_XX.qm (that can be found in qttranslations-opensource-src-5.X.X.zip) in gui/translations and in ressource.qrc.

Create a file named gui/translations/Comp3D_??.ts.

Insert the language name and its abbrevation in the following lines of src/compile.h:

#define SUPPORTED_LANG_CODE {"en","fr"}
#define SUPPORTED_LANG_NAME {"English",u8"Fran\u00e7ais"}

12.2. Report

12.2.1. Translation

Mandatory for the first translation update, in Comp3D_cpp/gui/html/:

git clone https://github.com/jmimu/simple_i18n

Then run, in Comp3D_cpp/gui/html/simple_i18n/:

./prep_translation.py ../visu_comp.js fr

(replace fr with the target language).

It will add untranslated strings to the translation list. Replace the old list in visu_comp.js by the new one and translate the new strings that are between ~.

Comp3D must be compiled to take into account the new visu_comp.js.

12.2.2. Add a new language translation

To add a new language, add a new entry in the translations dict in visu_comp.js.

12.3. User documentation

12.3.1. Translation

Dependencies:

sudo apt install qttranslations5-l10n

The following commands are to be run in doc_uni/ directory.

Update the strings to translate:

./up_translation.sh

The files to translate are doc_uni/locale/??/LC_MESSAGES/*.po, using linguist.

Apply the translations:

./build_doc.sh

Comp3D must be compiled to take into account the new user documentation.

12.3.2. Add a new language translation

Update build_doc.sh.