Linguist support for QML files. (QML UI Language Translation)
-
wrote on 19 Apr 2017, 07:19 last edited by
Hi All,
I want to do language translation for my project the complete GUI is in QML, when i run lupdate on the project the x.ts file dose not contain any of the Context from QML files. Can any one please help me to translate the QML files using Qt Linguist.
Thank You.
-
Hi All,
I want to do language translation for my project the complete GUI is in QML, when i run lupdate on the project the x.ts file dose not contain any of the Context from QML files. Can any one please help me to translate the QML files using Qt Linguist.
Thank You.
wrote on 19 Apr 2017, 08:04 last edited by Julien BHello @Pradeep-P-N,
Does all your text in QML are inside
qsTr ()
or others alternatives ?Did you add your QML files in your
.pro
?
Either via:lupdate_only{ SOURCES = \ file.qml }
or
DISTFILES += \ file.qml
in order for
lupdate
to process the texts to translate.Have a look in Internationalization and Localization with Qt Quick for more informations.
-
wrote on 19 Apr 2017, 10:04 last edited by Pradeep P N 6 Apr 2019, 15:34
Hi @Julien-B
Thank you,
Yes all my QML files contains qsTr(), and in .prolupdate_only { SOURCES += qml/ * .qml \ qml/ * / * .qml \ qml/ * / * / * .qml \ qml/ * / * / * / *.qml \ qml/ * / * / * / * / *.qml }
on lupdate the .ts file generated does not contains all my QML file context.
I have generated .qm file and included in resource qrc.if(language == DE){ qDebug() << "App Is Available In German"; qDebug() << lang_DE->load(":/t1_de.qm", "."); qApp->installTranslator(lang_DE); }else{ qDebug() << "Default Language -- English" << endl; qApp->removeTranslator(lang_DE); }
load is - TRUE
but there is no change in UI, and also how can i load all QML file Context in .ts file.
-
Hi @Julien-B
Thank you,
Yes all my QML files contains qsTr(), and in .prolupdate_only { SOURCES += qml/ * .qml \ qml/ * / * .qml \ qml/ * / * / * .qml \ qml/ * / * / * / *.qml \ qml/ * / * / * / * / *.qml }
on lupdate the .ts file generated does not contains all my QML file context.
I have generated .qm file and included in resource qrc.if(language == DE){ qDebug() << "App Is Available In German"; qDebug() << lang_DE->load(":/t1_de.qm", "."); qApp->installTranslator(lang_DE); }else{ qDebug() << "Default Language -- English" << endl; qApp->removeTranslator(lang_DE); }
load is - TRUE
but there is no change in UI, and also how can i load all QML file Context in .ts file.
wrote on 19 Apr 2017, 11:33 last edited by Julien BIn QML the Context for a traduction is the name of the
.qml
file where it appears.What do you mean exactly when you say there is no Context in
.ts
file ? -
wrote on 19 Apr 2017, 12:12 last edited by
Yes. There is no data related to all QML. I could only see few Qt Context. And only one QML FILE is available in Context of my .ts file.
And even though after updating the .ts file with the single QML context in .ts file
No language change in UI. -
wrote on 24 Apr 2017, 10:42 last edited by
Thank You @Julien-B .
The problem was with loading SOURCES and its solved.
2/6