0

I'm working with existed code (.qml) and need to change line that translates by QTranslator with qm/ts translation files.

For example, the line in .qml file was:

item.text = qsTr("Old")

So I change it to:

item.text = qsTr("New")

But Linguist see "Old" line with no issue.

Maybe I need to change .ts file's line directly?

I have never done this before and want to change this properly. Can you advice me how would you do, if you have project that have translations file, but you actually need to change one line in application so it would be effect on origin text and translated one?

  • Do you know how to run `lupdate` and `lrelease`? Also, your example is a bit flawed. Had you used `qsTr("Hello")` we can understand why you're using linguist and would want to see "Hello" in multiple languages. Because you write `qsTr("Old")` and `qsTr("New")` it creates an ambiguity to your question, since, linguist isn't about editing your QML source files. It's about supplying your text in *.ts files, one for each language you wish to target. – Stephen Quan Jun 07 '23 at 12:01
  • Ah yes! Thank you @StephenQuan . When I watch a guide to Linguist this functions didn't mentioned. This actually help's me to find lines in Linguist that needs to be translated – Mykhailo V Jun 08 '23 at 08:31

1 Answers1

0

StephenQuan said:

Do you know how to run lupdate and lrelease?

Based on that, if you need to change lines translated by Linguist you need to use:

Instruments > External > Linguist > lupdate

to update lines in .ts file, and than set translation to those lines in Linguist. Then run lrelease to update .qm translation files for your project.