How to make use of internationalization?

  • This is main.cpp file

    #include <QGuiApplication>
    #include <QtGui>
    #include <QQuickView>
    #include <QTranslator>
    #include <QQmlContext>
    #include <QQmlProperty>
    #include <QCoreApplication>
    int main(int argc, char *argv[]) {
    QGuiApplication app(argc, argv);
    QQuickView view;
    QTranslator *translator1=new  QTranslator();
     return app.exec();

    This is asa.qml file

    import QtQuick 2.7
    import QtQuick.Window 2.2
    Text {
        anchors.fill: parent

    ts file that is loaded is not reflected when executed.

  • Hello @Nisha_R,

    You must convert the .ts file to a .qm file using lrelease.

    Then load your .qm file in your application.

  • @Julien-B thank you,
    i have tried with that , but still the same.

  • Hope you have included all your strings in cml using qstr. Run lupdate on the pro file. This generates the *.ts files. Now use Linquist tool & open the .ts file. Do all the conversions. Generate the *.qm(qm not QML). Now load the .qm file and install it as you done. This works.

  • Qt Champions 2016

    @Nisha_R perhaps my blog post will give you some ideas.

  • @dheerendra thank you it worked, i had missed giving a path for qm file. in load function.
    @ekkescorner i shall look into it, thank you.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.