On 07.11.23 14:59, Petric Frank wrote:
Hello,
in my app i have translation files. I added them to the qrc-file because i
want to load the translations from resource:
<file>app-de_DE.qm</file>
<file>app-en_US.qm</file>
They are are generated from *.ts files. In *.pro i added
CONFIG += lrelease
TRANSLATIONS = app-de_DE.ts \
app-en_US.ts
The problem is when i build the app it breaks at compiling the qrc-file:
make: *** No rule to make target '../app/app-de_DE.qm', needed by
'qrc_app.cpp'. Stop.
I think that the lrelease step comes too late.
So the question is how to overcome this ?
For example executing lrelease earlier - maybe at first - at make run. How i
have to modify the *.pro file ?
kind regards
Petric
I always thought that 'lupdate' and 'lrelease' needed to run as external
applications? Adding it to the CONFIG variable will most likely not do
anything.
At the very least you will need to copy the *.qm files from their
default location to the resource "qrc" folder (or a subfolder of that)
and add them at least once to the resource file, otherwise the resource
compiler will not find them.
If the translation files are not too big and hardly ever change, you can
do it this way. However, once you start supporting more than one or two
languages it becomes very difficult to manage if they are embedded into
the application.
Personally, I prefer to load the translations at runtime from the
application folder and use a very small subset for errors that might
occur at startupĀ -- for example, not being able to find the *.qm file
at runtime... :)
Using Qt Creator you can add 'lrelease' as a custom build step (click on
"Project" in the left panel, then "Build & Run" to access this option.)
You can move it up or down depending on whether it should run before or
after the actual build.
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest