2026-03-19 14:06:08 +01:00

45 lines
1.8 KiB
Markdown

# Manage translations
## Requirements
Qt Linguist tools are used to manage translations. Typically on Ubuntu:
```bash
sudo apt install qttools5-dev-tools
```
## Workflow
1. Generate the `plugin_translation.pro` file:
```bash
python scripts/generate_translation_profile.py
```
1. Update `.ts` files:
```bash
pylupdate5 -noobsolete -verbose gn_tools/resources/i18n/plugin_translation.pro
```
1. Translate your text using QLinguist or directly into `.ts` files. Launching it through command-line is possible:
```bash
linguist gn_tools/resources/i18n/*.ts
```
1. Compile it:
```bash
lrelease gn_tools/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.