Details
-
Bug
-
Resolution: Cannot Reproduce
-
Not Evaluated
-
None
-
4.8.1
-
None
-
MacOs 10.6.8, Ubuntu 12.04 LTS (freshly updated at above date)
Description
The QDate.toString() is not translated in french using this code.
#include <QTranslator> #include <QApplication> #include <QLibraryInfo> #include <QDate> #include <QLocale> #include <QDebug> int main(int argc, char *argv[]) { QApplication a(argc, argv); QTranslator qtTranslator; qWarning() << "system locale" << QLocale::system().name() << "app locale" << QLocale().name(); if (!qtTranslator.load("qt_fr_FR",// + QLocale().name().left(2), QLibraryInfo::location(QLibraryInfo::TranslationsPath))) qWarning() << "ERROR"; qApp->installTranslator(&qtTranslator); QLocale::setDefault(QLocale::French); QDate dt = QDate::currentDate(); qWarning() << "DOES NOT WORK: " << "dt.toString" << dt.toString(QLocale().dateFormat()) << "\nDOES NOT WORK: " << "locale tostring" << QLocale::system().toString(dt); qWarning() << "WORKS FINE" << QLocale().toString(dt); return a.exec(); }
Output under Ubuntu 12.04 is:
system locale "fr_FR" app locale "fr_FR" DOES NOT WORK: dt.toString "Thursday, 3 May 2012" DOES NOT WORK: locale tostring "Thursday, 3 May 2012" WORKS FINE "jeudi 3 mai 2012"
Output under MacOs is:
system locale "fr_FR" app locale "fr_FR" WORKS FINE: dt.toString "jeudi 3 mai 2012" WORKS FINE: locale tostring "jeudi 03 mai 2012" WORKS FINE "jeudi 3 mai 2012"