How to use the QtLinguist, easy way?
-
@jsulm I have a Qt Creator 10.0.2. Where can I find this feature? I searched in Qt/Tools/mingw directory and didn't find any terminal application, just toolchain and some libraries and header files placed in linux-fashioned directory tree. I tried to open in QtCreator forlder in command prompt but it opens windows's cmd.exe in the project folder and this doesn't work with cmake.
-
@Artem-Shapovalov said in How to use the QtLinguist, easy way?:
didn't find any terminal application
If you installed Qt for MinGW you will find it in Windows start menu.
So, what exact Qt version did you install? -
@jsulm I download the installer qt-unified-windows-x64-4.6.0-online.exe. I search in start menu and found Qt 6.5.1 (MinGW 11.2.0 64-bit) shortcut. Launched it, cd to project's directory and tried to run:
cmake --build . --target <my project name>_lupdate
and got an error:
'cmake' is not recognized as an internal or external command, operable program or batch file
Seems to be it's not configured well and looks like standard windows cmd.exe. May be I should set it up manually before use?
-
@Artem-Shapovalov said in How to use the QtLinguist, easy way?:
May be I should set it up manually before use?
No, the shortcut in the Start menu should be fine. Maybe path to cmake executable is not configured automatically, but you can still use absolute path to cmake.exe.
-
Have you navigated to the build directory of the project (displayed in Qt Creator under Projects > Build Settings > Build Directory)?
Anyhow, if you don't feel confident on the command line, you can also trigger the target from within Qt Creator: Press Ctrl+K (to open the navigator), and then type
cm <my project name>_lupdate
-
-
@Artem-Shapovalov said in How to use the QtLinguist, easy way?:
@kkoehne I checked this feature and it's don't build unknown targets.
THat's weird. If the target is 'unknown', then it doesn't exist in CMake, I'd claim.
@kkoehne , @jsulm , thank you guys, I explore a little bit more, but I decided to use
another internationalization tool. Maybe later I would return to this Qt feature.Out of interest: Which tool are you going for?
-
@kkoehne now I'm fighting with this. just ported all my apps from 5.15 to 6.6 using QMake.
Now as next step: port from QMake to CMake
BTW: doing it all from inside QtCreator, no cmdline
all my apps rely on translations and this works well in 5.15/QMake:
changed strings - build project - external cmd lupdate - QtLinguist - extrernal cmd lrelease
External commands don't work as reported here.
tried with QtCreator Linguist Example arrowpadqt6_add_translations(arrowpad TS_FILES arrowpad_fr.ts arrowpad_nl.ts QM_FILES_OUTPUT_VARIABLE qm_files) install(FILES ${qm_files} DESTINATION ${INSTALL_EXAMPLEDIR})
added arrowpad_de.ts, saved CMakeLists.txt and the file was created.
build the project, but all .ts files are empty
tried your recommendation:cm arrowpad_lupdate
doesnt work. while typing (macOS) Cmd-Kcm arrowpad there's only arrowpad_lrelease listed but no arrowpad_lupdate
any idea ? -
@ekkescorner , have you actually tried running
cm arrowpad_lupdate
from Qt Creator? For me the command never shows up in autocomplete (which needs to be studied, created https://bugreports.qt.io/browse/QTCREATORBUG-29946), but I can run it, with Qt 6.6.0.
-
@kkoehne aaah. typing it it's working. was confused because autocomplete missed it.
THX - no I can go on to the next CMake features :) -
I was struggling with the same issue and I landed here. It helped. Now, I made the following changes to my cmake script to make it seamless.
add_custom_target(run_app_lupdate
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target app_lupdate
COMMENT "Running app_lupdate"
)
add_dependencies(app run_app_lupdate)Here "app' is the traget name
-
you don't need this. Qt 6.7 / QtC 13.0:
there are automatically generated targets there, you can execute:
update_translations
release_translations