Lrelease optimization: removal of unused translation
Good day, I am very new to QT and have a question about lrelease.
Currently, we have our own tool that generates TS files from a string database, all strings from this database and its translations are copied to the TS files. My question is, does lrelease has option to automatically excludes unused strings when generating the QM files?
Thank you very much
What do you mean by unused strings? do mean that they do not need to be translated ?
with qt linguist when you need to translate a string you need to write it on your .cpp file in this way :
if string does not need to be translated you have to wirte it without tr , just like this :
lupdatewill be executed he will search all strings marked with tr() and will on put it on your .ts file
Also string that was used in the past , and that become no more used on the context can be marked obsolete , on your .ts file like this:
<message> <location filename="your source or ui file" line="190"/> <source>text need to translate</source> <translation type="obsolete">your translated text</translation> </message>
Or obsolete text will be ignored by
this can done automatically with qt linguist hmi assistant ,
I advise you to read more in this part of qt linguist doc :
for qt 4:
for qt 5:
Hope this will answer to your question
Thnak you for replying to my question.
All strings are translated by our in-house tool (we are not using QT Linguist) and all of them are generated in the TS file. The problem is, not all strings are needed by the application. Is there a way to exclude unused strings when generating the QM file? Please note that the custom TS generator does not know which string is being use by the application that is why all strings are generated in the TS file. Can't mark strings as obsolete because another application may be using it.