Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
QDS 3.9
-
None
Description
Summary of the issue
It's quite hard for developer to come up with the way to activate the translations edited in the translations editor in QDS to the other development environment such as Qt Creator. It's better the CMakeLists.txt file QDS generates automatically includes the function to include the edited translations. If adding the function to CMakeLists.txt is hard, it’s better to document how to do it somewhere.
About how to enable the translations, following is an example code snippet of CMakeLists function I can see it works. (English and Japanese translation are included in the QDS project).
qt_add_translations(${CMAKE_PROJECT_NAME} TS_FILES i18n/qml_ja.ts i18n/qml_en.ts RESOURCE_PREFIX Main/i18n LRELEASE_OPTIONS -idbased )
Reproducible steps
- Create a QDS project (Qt 6.2 or later for the target).
- Change every qsTr based texts to qsTrId based texts.
- By using Translations editor panel, add testing environment's native language to the project's language and add translations to each translation IDs by using the editor.
- Press translation editor panel's generate .ts and .qm button to generate .ts (and .qm) files for generating the translation files.
- Press live preview button and make sure the translation works.
- Generate CMakeLists.txt file for the project through "File" -> "Export Project" -> "Generator CMakeLists.txt build files..."
- Open the CMakeLists.txt file through QtCreator
- Build and test the project through QtCreator
Expected behavior
Translated texts are displayed in the app.
Actual behavior
TextIds are displayed in the app.
Note
There are miltiple inconsistency for multi-language support in Qt6. I took a note for it.
About QML Multi-language support inconsistency - Qt Site Japan - Global Site