Skip to content

Commit

Permalink
Work on translations
Browse files Browse the repository at this point in the history
  • Loading branch information
emericg committed Nov 26, 2024
1 parent 15625eb commit b0c67a9
Show file tree
Hide file tree
Showing 22 changed files with 14,223 additions and 11,696 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ qt_standard_project_setup(
qt_add_translations(${CMAKE_PROJECT_NAME}
TS_FILE_BASE ${CMAKE_PROJECT_NAME}
TS_FILE_DIR ${CMAKE_SOURCE_DIR}/i18n/
SOURCES ${SOURCES}
RESOURCE_PREFIX "/i18n"
)

Expand Down
28 changes: 10 additions & 18 deletions i18n/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,45 +7,37 @@ You can work on translations using one of two ways:

##### Step 1: Add the language to the project (if it's a new language)

Edit the Qt project file (_WatchFlower.pro_) and add a new language file entry to the TRANSLATIONS section, using project name and an [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) two letter code (ex: _i18n/watchflower_fr.ts_).
Edit the Qt project file (_CMakeLists.txt_) and add a new language file entry to the I18N_TRANSLATED_LANGUAGES section.
You'll need to use an [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) two letter code (ex: _i18n/WatchFlower_fr.ts_).

Edit the _i18n/i18n.qrc_ file and your language next to the others.
> qt_standard_project_setup(I18N_TRANSLATED_LANGUAGES de fr xx)
##### Step 2: Update the language file
##### Step 2: Create / update the language file

To create (or update) the actual translation file, from the project root directory, run the following command:

```
lupdate WatchFlower.pro
cmake --build build/ --target lupdate
```

This will scrape the source code and add/update the strings that need to be translated into the language files.
If you are not able to run that command, you can simply ask me for a clean translation file.
If you are not able to run that command, you can simply open a GitHub issue and ask me for a new translation file in the langugage file you want.

##### Step 3: Translating

Translate by editing the .ts file using Qt Linguist.

- Remember to match upper/lower case letters, punctuation and trailing spaces!
- You don't have to translate everything, missing words or sentences will fall back to English.
- You don't have to translate everything, missing strings will fall back to English.
- If you're not sure about a word or sentence, leave the "unfinished" tag, so other people can have a second look at it.

> Qt Linguist manual: https://doc.qt.io/qt-6/linguist-translators.html
> Qt Linguist standalone downloads: https://github.com/lelegard/qtlinguist-installers/releases
##### Step 4: (optional) Update the binary translation
> Qt Linguist standalone downloads: https://github.com/thurask/Qt-Linguist/releases
To create (or update) the binary translation, run the following command from the project root directory:

```
lrelease WatchFlower.pro
```

This will convert the .ts language files into binary .qm files. These are the files actually loaded by the application.
This step is optional, as it is only needed if you want to try the translation by building the project yourself. Otherwise it's a step done before every release of the project anyway.
> Qt Linguist standalone downloads: https://github.com/lelegard/qtlinguist-installers/releases
##### Step 5: Publish it!
##### Step 4: Publish it!

Send the file(s) back to the project, using email or a GitHub pull request.
If you want to be credited in the application (and in this file) please be sure to mention it, and provide a name/pseudo, and wished an email/GitHub page.
Expand Down
Loading

0 comments on commit b0c67a9

Please sign in to comment.