-
-
Notifications
You must be signed in to change notification settings - Fork 111
Translation with context using QtLinguist (preferred method)
- It provides a user-friendly interface
- If configured properly, it displays the context of the translation
- It automatically verifies the translations to make sure they respect some important rules
- The QtLinguist software must be installed
- The updated source code of Seamly must be downloaded so that context can be displayed in QtLinguist
- Qt 5.15.2 (includes Qt, QtCreator, QtChooser, and Qt Maintenance Tool) and Git or Github Desktop for Windows and MacOS. The installation guidelines can be found in the Developer README.
Note : it is possible to translate Seamly2D only downloading QtLinguist, but the process will not be covered by this tutorial. QtLinguist is part of the Qt Tools module. Download Qt from here: (https://www.qt.io/download-qt-installer-oss). During install confirm that the QtTools module is checked.
- The source code of Seamly. For this you need to clone the Seamly2D Github repository on your computer. See this tutorial for more explanations : Cloning a repository
-
Open QtCreator, then click on "Open a project" and open the Seamly2D.pro project file at the root of the repository you cloned before.
-
Click on Tools > External > Configure...
- In "Linguist > Update translations (lupdate)" change the "Arguments" to
-locations relative -recursive -noobsolete "%{CurrentDocument:Project:Path}/share/translations/translations.pro"
:
then click OK.
- Click "Tools > External > Linguist > Update translations (lupdate)". After a few seconds you should have this message in the console at the bottom of the sceeen (in the "General Messages" tab):
Doing so, you added to the translation files the necessary information so that QtLinguist could display you the context of the translations.
-
Now open QtLinguist (linguist.exe) by searching Linguist on your computer. On windows it can be found in "C:\Qt\5.15.2\mingw81_64\bin".
-
Click "File > Open" and select the translation file you want to modify. The translation files can be found in the \share\translations folder of the cloned repository. To do a full translation of the software in a particular language, you need to finish the translations in those 3 files:
- measurements_xx_XX.ts
- qtbase_xx_XX.ts
- seamly2d_xx_XX.ts
where xx corresponds to the corresponding language.
-
Please make sure all the validity checks are activated at the top of the screen. They will warn you at the bottom left of the screen if the translation is incorrect.
-
Before doing any translation, please read the General translation guidelines
-
The strings that need to be translated are grouped, depending on where they can be found in the software, on the left of the screen. When the translation is not finished, they are marked with a "?". Click on one of them.
- You then have the strings to translate at the center of the screen. Click on a string to translate, then enter its translation in the corresponding field. Please look at the context box at the top left of the screen to understand where this particular string will be displayed in the software. Sometimes it will show you a dialog, but sometimes it will only show you the part of the code that displays this particular string.
- Check at the bottom right of the screen that there is no validity check issue. If so make the corresponding modifications to your translation.
- If you are sure about your translation, you can validate it using the corresponding ✓ button at the top of the screen (or using the corresponding keyboard shortcut):
If you are not sure about your translation being correct, just leave it unfinished:
-
When you are finished, save the file you're modifying "file > save" and close QtLinguist.
-
Open QtCreator, then click on "Open a project" and open the Seamly2D.pro project file at the root of the repository you cloned before.
-
Click on Tools > External > Configure...
- In "Linguist > Update translations (lupdate)" change the "Arguments" to
-locations none -recursive -noobsolete "%{CurrentDocument:Project:Path}/share/translations/translations.pro"
:
then click OK.
- Click "Tools > External > Linguist > Update translations (lupdate)". After a few seconds you should have this message in the console at the bottom of the sceeen (in the "General Messages" tab):
Doing so, you removed from the translation files the context information. This information must be removed to avoid conflicts when implementing the new translations in the software.
- Send the modified .ts file to a moderator on the forum 😊