This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch bugfix/translation in repository x2goclient. commit fc224acfffe7ea4393410e92a692caf09cf4c94c Author: Mihai Moldovan <ionic@ionic.de> Date: Mon May 4 19:12:35 2015 +0200 onmainwindow.cpp: correctly let Qt fetch the UI display language for Qt 4.8.0 and higher. The old "compat" behavior is retained for older versions of Qt, which do not have the semantics of a UI display language. Fixes: #845. --- debian/changelog | 4 ++++ src/onmainwindow.cpp | 31 ++++++++++++++++++++++++++++--- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 13a9e63..3832c60 100644 --- a/debian/changelog +++ b/debian/changelog @@ -349,6 +349,10 @@ x2goclient (4.0.4.0-0x2go1) UNRELEASED; urgency=low - {configdialog.{cpp,h},onmainwindow.cpp}: miscellaneous typo fixes - no functional changes. - onmainwindow.cpp: whitespace changes to installTranslator() only. + - onmainwindow.cpp: correctly let Qt fetch the UI display language for Qt + 4.8.0 and higher. The old "compat" behavior is retained for older + versions of Qt, which do not have the semantics of a UI display + language. Fixes: #845. [ Fernando Pedemonte ] * New upstream release (4.0.4.0): diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp index 870f571..e5bea4b 100644 --- a/src/onmainwindow.cpp +++ b/src/onmainwindow.cpp @@ -548,10 +548,25 @@ void ONMainWindow::slotSyncX() void ONMainWindow::installTranslator () { QTranslator *x2goclientTranslator = new QTranslator (); - QString filename = QString (":/i18n/x2goclient_%1" ).arg (QLocale::system ().name ()); + + /* Qt 4.8.0 introduced a new overload for QTranslator::load(), taking a QLocale + * object and loading up the UI language. + * Additionally, a lower-cased version is automatically added to the search + * list on case-sensitive file systems. + * We still need the original "compat" version for Qt < 4.8.0, though. + */ + + QString filename = QString (":/i18n/x2goclient"); +#if QT_VERSION < 0x040800 + filename = QString (filename + "_%1" ).arg (QLocale::system ().name ()); filename = filename.toLower (); +#endif +#if QT_VERSION < 0x040800 if (!x2goclientTranslator->load (filename)) { +#else + if (!x2goclientTranslator->load (QLocale::system (), filename, "_")) { +#endif x2goWarningf (1) << tr ("Can't load translator: ") + filename.toAscii (); } else { @@ -560,9 +575,19 @@ void ONMainWindow::installTranslator () { } - QTranslator *qtTranslator = new QTranslator; - filename = QString ( ":/i18n/qt_%1" ).arg (QLocale::system ().name ()); + QTranslator *qtTranslator = new QTranslator (); + + filename = QString (":/i18n/qt"); +#if QT_VERSION < 0x040800 + filename = QString (filename + "_%1" ).arg (QLocale::system ().name ()); + filename = filename.toLower (); +#endif + +#if QT_VERSION < 0x040800 if (!qtTranslator->load (filename)) { +#else + if (!qtTranslator->load (QLocale::system (), filename, "_")) { +#endif x2goWarningf (2) << tr ("Can't load translator: ") + filename.toAscii (); } else { -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git