Qt widgets show German default labels on UK Windows system
hzulla last edited by
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.
Robin could check with
That it can in fact translate the strings.
Maybe just wih a test tr + qm files.
hzulla last edited by hzulla
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.
It does indeed sound strange.
Can he reproduce it, with small sample?
Or is it just this project?