Solved Search for a translation in qm/ts file?
-
Hi,
Is there a way to get a particular translation for a specific source and comment from a qm file.
Consider this example:
i already have a qm file loaded, say english qm, i want to show an arabic translation for one button.Is there an API or any way to do this?
-
Hi
Well you can load multiple translators
http://doc.qt.io/qt-5/qcoreapplication.htmland docs says "Translations are searched for in the reverse order in which they were installed"
So yes, you might be able to get i to work if you control the replacement of text your self.
Also it has direct translate
http://doc.qt.io/qt-5/qtranslator.html#translate -
@mrjj loading both files does not help since the translation exists for that button in both files, i want to show the arabic translation, if the application is in english and vice versa.
Regarding QTranslator::translate(), does this work if i only load the file?
If there is a function which took the qm file as input along with source and comment and returned the requested string?
-
- QTranslator::translate(), does this work if i only load the file?
i have not tested that. I think so yes.
-
This post is deleted! -
Load the qm file and translate worked, thank you :)