Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-69928

translations are totally broken in qt 5.11.1

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Invalid
    • Affects Version/s: 5.11.1
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      archlinux x86_64
      win7 x86_64
    • Platform/s:
      Linux/X11, Windows

      Description

      Don't know how to use cut, so:

      Unable to find source-code formatter for language: qbs. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      // test/test.qbs
      import qbs
      import qbs.FileInfo
      
      Project {
          minimumQbsVersion: "1.7.1"
      
          references: [
              "translations"
          ]
      
          CppApplication {
              Depends {
                  name: "Qt"
                  submodules: [
                      "core",
                      "quick",
                      "gui",
                      "quickcontrols2",
                      "widgets"
                      "qml"
                  ]
              }
      
              name: "test"
      
              cpp.cxxLanguageVersion: "c++11"
      
              files: [
                  "*.cpp",
                  "*.qrc",
              ]
      
              Group {
                  fileTagsFilter: "application"
                  qbs.install: true
              }
          }
      }
      
      
      Unable to find source-code formatter for language: qbs. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      // test/translations/translations.qbs
      import qbs 1.0
      
      Product {
          name: "translations"
          type: "qm"
          files: "*.ts"
      
          Depends { name: "Qt.core" }
      
          Group {
              fileTagsFilter: product.type
              qbs.install: true
              qbs.installDir: product.name
          }
      }
      
      
      // test/main.cpp
      #include <QGuiApplication>
      #include <QQmlApplicationEngine>
      #include <QTranslator>
      #include <QDebug>
      #include <iostream>
      
      int main(int argc, char *argv[])
      {
          QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
      
          QGuiApplication app(argc, argv);
      
      
          const QString translationFilename = qApp->applicationDirPath() +
                  "translations/test_rus.qm";
          qDebug() << "translation file is" << translationFilename;
      
          QTranslator translator;
      
          if(translator.load(translationFilename))
          {
              qDebug() << "translation file loaded";
      
              if(qApp->installTranslator(&translator))
                  qDebug() << "translator installed";
              else
                  qDebug() << "failed to install translator";
          }
          else
          {
              qDebug() << "loading of translation file failed";
          }
      
          qDebug() << QObject::tr("test from cpp");
          std::cout << QObject::tr("qDebug doesn't work here").toStdString()
                    << std::endl << std::flush;
      
          QQmlApplicationEngine engine;
          engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
          if (engine.rootObjects().isEmpty())
              return -1;
      
          return app.exec();
      }
      
      
      Unable to find source-code formatter for language: qml. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      // test/main.qml
      import QtQuick 2.11
      import QtQuick.Window 2.11
      
      Window {
          visible: true
          width: 640
          height: 480
          title: qsTr("Hello World")
      }
      
      // shell from test
      lupdate . -ts translations/test_rus.ts
      linguist translations/test_rus.ts
      

      Then build and run project. Full project in attachment.

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            ablasche Alex Blasche
            Reporter:
            n_kostovsky Anonymous (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes