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

Qt Linux does not respect locale

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 6.6
    • Core: Locales (i18n)
    • None
    • Linux/X11
    • 13
    • Foundation PM Staging

      In our unit tests we set the locale to be German to get a consistent output between Windows and Linux builds. We figured out that in Windows the year has 4 digits and on Linux it hast 2 digits.

      Digging into this I always thought that this was due to Linux but I figured out that Qt just does not seem to take the installed locale into account.

      On my system (Ubuntu 23.04) the locale de_DE says

      % Appropriate date representation (%x)
      
      d_fmt   "%d.%m.%Y"
       

      which should be the same as on Windows (4 digits).

      Interestingly my KDE5 desktop also shows the date in 2 digits.

       

      A good workaround would be if it was possible to specify the date format of a QLocale programmatically (eg. a setter method). This would also be very helpful for our unit tests.

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

            Eddy Edward Welbourne
            davidweisgerber David Weisgerber
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes