Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. I18n in QML doesn't work
QtWS25 Last Chance

I18n in QML doesn't work

Scheduled Pinned Locked Moved Solved QML and Qt Quick
qmli18n
5 Posts 2 Posters 1.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Amir Afendin
    wrote on last edited by
    #1
    QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
    QGuiApplication app(argc, argv);
    
    QTranslator ruLang;
    if (ruLang.load(":/Application_ru"))
     qDebug() << "we're good..............";
    app.installTranslator(&ruLang);
    
    QQmlApplicationEngine engine;
    engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
    
    return app.exec();
    

    It seems like .qm file loads well in C++ side but on QML side i don't see any translations happens

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Can you show how you wrote the internationalization in QML ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      A 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        Can you show how you wrote the internationalization in QML ?

        A Offline
        A Offline
        Amir Afendin
        wrote on last edited by
        #3

        @SGaist thanks man, already solved myself, sorry for troubling

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          What was the problem ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          A 1 Reply Last reply
          0
          • SGaistS SGaist

            What was the problem ?

            A Offline
            A Offline
            Amir Afendin
            wrote on last edited by
            #5

            @SGaist funny thing as always:D put

            QTranslator ruLang;
            if (ruLang.load(":/Application_ru"))
             qDebug() << "we're good..............";
            app.installTranslator(&ruLang);
            

            into if else, and at the end of the block QTranslator obviously deleted

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved