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

QLocale::system().standaloneMonthName() wrong value on macos

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.15.2
    • 5.12.6, 5.15.0
    • Core: Locales (i18n)
    • None
    • macOS
    • 062d2831845eb07518d7c059b155a640bd0300f3 (qt/qtbase/dev) 0df8e70fbde912b7ee6a594112c13221ea338f72 (qt/qtbase/5.15)

    Description

      Code bellow prints:

      августа
      августа
      

      while the second line should be "август", without "a" at the end of word.
      This is for Russian locale.
      If instead of system I create such locale `QLocale loc(QLocale::Russian, QLocale::RussianFederation);` all works in the right way.
      Also code bellow works just fine on Linux with ru_RU.UTF-8 locale.

      #include <QApplication>
      #include <QDateTime>
      #include <QLocale>
      #include <QtDebug>
      
      int main(int argc, char *argv[]) {
        QApplication app(argc, argv);
        auto dt = QDateTime::currentDateTime();
        auto loc = QLocale::system();
        qDebug() << loc.monthName(dt.date(). month());
        qDebug() << loc.standaloneMonthName(dt.date(). month());
      }
      

      I suspect that problem in qlocale_mac.mm code:

          case MonthNameLong:
          case MonthNameShort:
          case StandaloneMonthNameLong:
          case StandaloneMonthNameShort:
              return macMonthName(in.toInt(), (type == MonthNameShort || type == StandaloneMonthNameShort));
      

      for some reason it ignores StandaloneMonth* and in macMonthName it uses only
      kCFDateFormatterMonth* in standalone and not standalone case,
      while there is:
      kCFDateFormatterStandaloneMonthSymbols constant

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-86191
          # Subject Branch Project Status CR V

          Activity

            People

              vhilshei Volker Hilsheimer
              evgeniy_dushistov evgeniy_dushistov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes