QDate.toString() output is not correctly translated under Ubuntu 12.04 (french)

Bug #993956 reported by Eric Maeker
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
qt4-x11 (Ubuntu)
New
Undecided
Unassigned

Bug Description

Please find informations on the upstream bug tracker:

https://bugreports.qt-project.org/browse/QTBUG-25646

Duplicated 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"

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.