Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-25646

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

    XMLWordPrintable

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" 
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            eric.maeker Eric MAEKER
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes