This page describes how a developer/translator can add new languages for the main GUI.
Translations for developers
The main (i. e. static) GUI can relatively easily be translated by adding new language files. They will be embedded in the executable when building so that the program can ship without separate files.
Step 1: create the language file
Suppose you want to add a French translation and have the Qt build tools installed.
Add an abbreviation for the language to the qmake file inishell.pro:
LANGUAGES = de fr
Create a template file by running:
lupdate -verbose inishell.pro
--> inishell_fr.ts will be created in resources/languages.
Step 2: translate the texts
With a plain text editor open the .ts file and look for the following lines:
Insert your translations like this:
Or, much more comfortably, open the .ts file in Qt Linguist and follow the intuitive steps therein.
Step 3: make a binary language file
This is done in the qmake file so it's enough to build the project once.
Before that, since files are embedded into the application, the final language file needs to be added to the resources in inishell.qrc with the following line:
Note the .qm extension which will be created in the build process via lrelease.
- Translations that aren't there will default back to English with no harm done.
- The developer can leave comments for the translator by prefacing comments with //:
- Ampersands are for keyboard shortcuts
- Run lupdate again when new translation strings are introduced in the code with tr(...) tags
- Run lupdate inishell.pro -noobsolete to remove outdated translations (file path changed, reworded text, ...)
- If you get errors for a .qm file that should be created in the build process it was probably deleted in between, rebuild the project.