If a *.ts file in qt6_add_translations() does not exist, the build system kindly offers to auto-generate it:
Unfortunately, auto-generated files also get auto-deleted.
- 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"
At the end of Step #5, hellotr_la.ts is deleted. The translator's work is lost.
At the end of Step #5, hellotr_la.ts and its contents are preserved.
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.