Solved cmake: "cannot find *.ts file"
-
Hey! I want to be able to update the *.ts files from Qt Creator.
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS LinguistTools Gui Network Xml) qt_add_lupdate(streamcapture2 TS_FILES ${CMAKE_CURRENT_SOURCE_DIR}/_streamcapture2_template_xx_XX.ts)
lupdate starts (from qt creator) but can't find the language file.
Starting external tool "/opt/Qt/6.4.1/gcc_64/bin/lupdate /home/ingemar/PROGRAMMERING/streamcapture2/code/CMakeLists.txt" lupdate warning: no TS files specified. Only diagnostics will be produced.
I've gotten most things to work with cmake, but the translations are awkward. Been working with qmake since version Qt3!
-
@posktomten said in cmake: "cannot find *.ts file":
lupdate starts (from qt creator) but can't find the language file.
Don't run lupdate as an external tool, from Qt Creator menu. Instead, run the 'update_translations' build system target. See also https://bugreports.qt.io/browse/QTCREATORBUG-28467
-
I've been checking online all day. There seem to be a lot of divided opinions. Handling translations feels infinitely better with qmake!
Printing from bash
opt/Qt/6.4.1/gcc_64/bin/lupdate CMakeLists.txt lupdate warning: no TS files specified. Only diagnostics will be produced.
If you create a new project with Qt Creator (with the option to translate), it still doesn't work. Strange...
Works with qmake.
lupdate can't find files...
Must be something I don't understand. -
@posktomten said in cmake: "cannot find *.ts file":
lupdate starts (from qt creator) but can't find the language file.
Don't run lupdate as an external tool, from Qt Creator menu. Instead, run the 'update_translations' build system target. See also https://bugreports.qt.io/browse/QTCREATORBUG-28467
-
@kkoehne said in cmake: "cannot find *.ts file":
update_translations' build system target
Thank you very much!
I'll test tonight. -
@kkoehne Many thanks! Works with Linux terminal!
cmake --build . --target update_translations
-
@posktomten said in cmake: "cannot find *.ts file":
Works with Linux terminal!
You can also select the target in Qt Creator: Go to your Build Settings, expand Build Steps > Details, tick the "update_translations" target, then build.
-
Thanks @JKSH !