Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
6.4.0
-
None
-
2e1b52671 (dev), 72cdabcb6 (6.6), 15ef5042d (6.5)
Description
If a *.ts file in qt6_add_translations() does not exist, the build system kindly offers to auto-generate it:
CMake Warning at C:/Qt/6.4.0/msvc2019_64/lib/cmake/Qt6LinguistTools/Qt6LinguistToolsMacros.cmake:241 (message): Translation file 'C:/Qt/Examples/Qt-6.4.0/linguist/hellotr/hellotr_la.ts' does not exist. Consider building the target 'hellotr_lupdate' to create an initial version of that file.
Unfortunately, auto-generated files also get auto-deleted.
Steps to reproduce
- In Qt Creator, load the CMakeLists.txt file for the Hello tr() Example (https://doc.qt.io/qt-6/qtlinguist-hellotr-example.html ).
- Build the `update translations` target to auto-generate hellotr_la.ts.
- Use Qt Linguist to translate hellotr_la.ts
- Build the `hellotr` target and run the executable to confirm that the translation is applied correctly
- In Qt Creator, click "Build" > "Clean"
Actual Outcome
At the end of Step #5, hellotr_la.ts is deleted. The translator's work is lost.
Expected Outcome
At the end of Step #5, hellotr_la.ts and its contents are preserved.
Workaround
Ensure that all of your project's required *.ts files already exist prior to building your project for the first time. CMake ... --target clean won't delete files that CMake did not generate.
Attachments
Issue Links
- relates to
-
QTBUG-96549 make clean removes ts file when using qt5_create_translation()
- Closed
-
QTBUG-107852 qt6_add_translations() does not detect translatable strings
- Closed