-
Bug
-
Resolution: Done
-
P2: Important
-
5.3.2
-
None
-
Android 4.1.2
-
-
78e92997ed35ddc8bb6f7f6c0a4fffba026d5d8f
The following problem occurs on my Android phone only, my Linux desktop is not affected.
The translation of my application works only properly when I call QLocale::system().name() after construction of QApplication.
int main(int argc, char *argv[]) { qDebug("locale 1=%s",qPrintable(QLocale::system().name())); QApplication app(argc, argv); qDebug("locale 2=%s",qPrintable(QLocale::system().name())); QTranslator myappTranslator; myappTranslator.load(":/i18n/translations"); app.installTranslator(&myappTranslator); MainWindow w; w.show(); return app.exec(); }
Locale 1 is always "C". Locale 2 is "de_DE" on my german phone.
When I remove the second debug output (locale 2=...) then the translation does not work anymore. Then the GUI has english wording.
So I see two related issues (on Android only):
1) QLocale::system() returns the wrong locale "C" when called before construction of QApplication.
2) QTranslator works only, when I call QLocale::system() AFTER construction of QApplication but BEFORE construction of the QTranslator.
| For Gerrit Dashboard: QTBUG-41385 | ||||||
|---|---|---|---|---|---|---|
| # | Subject | Branch | Project | Status | CR | V |
| 215485,8 | QLocale: Update the system private on QLocale default constructor if needed | 5.11 | qt/qtbase | Status: MERGED | +2 | 0 |