Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt widgets show German default labels on UK Windows system
QtWS25 Last Chance

Qt widgets show German default labels on UK Windows system

Scheduled Pinned Locked Moved Unsolved General and Desktop
qlocalei18nwindows
4 Posts 2 Posters 1.6k 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.
  • H Offline
    H Offline
    hzulla
    wrote on last edited by
    #1

    Hi,

    we have a weird i18n problem.

    Let me explain the situation.

    Sonic Pi is a live synthesizer that a Qt-based GUI frontend, a ruby-based programming language and supercollider as an electronic synth backend. It's a music instrument you can play with code.

    It's an open source project and Sam, the creator and main developer, writes the software on OS X and tests it there and on Raspbian. Other contributors to the project compile and test it on Windows and non-RPi / generic Linux. Some time ago, I helped adding Qt's i18n bindings to the GUI.

    Now, the problem.

    On a current Windows build of the GUI, there are German words appearing in Qt's standard widgets for English users in UK. (The GUI also embeds the QScintilla editor library. It, too, shows German translated widgets.)

    You can see an image of the problem here for QMessageBox: The content is English, as it should, but the button labels are German.

    The GUI translation is set up by these lines in main.cpp:

    QString systemLocale = QLocale::system().name();
    
    QTranslator qtTranslator;
    qtTranslator.load("qt_" + systemLocale, QLibraryInfo::location(QLibraryInfo::TranslationsPath));
    app.installTranslator(&qtTranslator);
    
    QTranslator translator;
    bool i18n = translator.load("sonic-pi_" + systemLocale, ":/lang/") || systemLocale.startsWith("en") || systemLocale == "C";
    app.installTranslator(&translator);
    

    The code block above is taken right from the Qt i18n documentation on how to enable translation.

    Since I'm not using Windows I cannot replicate the problem. Translations are fine on my Linux computer. Robin, the affected Windows developer, is using these build instructions and it might just be possible that his build system is configured incorrectly, but we couldn't figure out if that's really the problem so far.

    Robin's QLocale::system().name() is en_GB, which should result in Qt using English labels instead of German, but doesn't.

    The strange thing here is that the content of QMessageBox is English, while the labels are not. From mainwindow.cpp:

    QMessageBox *box = new QMessageBox(
      QMessageBox::Warning,
      tr("Server boot error..."),
      tr("Sonic Pi Boot Error\n\nApologies, a critical error occurred during startup") + ":\n\n " + msg + "\n\n" + tr("Please consider reporting a bug at") + "\nhttp://github.com/samaaron/sonic-pi/issues"
    );
    box->setDetailedText(/* snip for forum */);
    /* snip */
    box->exec();
    

    Now look at that screenshot again. The headline and content of the QMessageBox are English, but the button label "Details einblenden" is German.

    I'm a bit lost here. If you have an idea, please reply here or on the github issue where we discuss the bug.

    Thank you!

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

      Hi
      Robin could check with
      http://doc.qt.io/qt-5.5/qcoreapplication.html#translate
      That it can in fact translate the strings.
      Maybe just wih a test tr + qm files.

      1 Reply Last reply
      0
      • H Offline
        H Offline
        hzulla
        wrote on last edited by hzulla
        #3

        Translation as such is not the issue. This i18n code has been used in Sonic Pi since several releases and it worked on Windows, too. The weird thing is that for this developer on this machine, it shows German default widgets on a computer running with UK locale.

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

          Hi
          It does indeed sound strange.
          Can he reproduce it, with small sample?
          Or is it just this project?

          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