This is a shot in the dark but is there a way to use somehow qt(\"\") in an xml file? To generate the .ts files like this?:
lupdate myXML.xml -ts myML.ts
Ok so I found the solution using QT_TRANSLATE_NOOP:
In the following xml text i do something like this:
<root>
<tag>QT_TRANSLATE_NOOP("context","value")</tag>
</root>
And when I want to fetch the value I do something like this in cpp:
Q_INVOKABLE QString getTranslation(QString value){
return QApplication::translate("context", value);
}
So to sum up in a few words. I put the macro QT_TRANSLATE_NOOP in my xml file containing a context string(you can choose whatever you want) and the value that I want it to be translated. So when I do lupdate myxml.xml -ts myTs.ts it generates a ts file having the value as the source text within the context specified in the macro. After that in cpp I must create a function that dynamically takes the translation from the context.