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

Qlocale::system returns wrong language on MacOS



    • macOS


      Getting the system locale with QLocale::system() is returning the wrong language on MacOS Mojave. When changing both the system language and region, the locale name returned by Qt will correctly update the region but the language is always English.

      Language and region both changed to German in system preferences:

      QLocale::system().name() returns "en_DE" - gets the region change correct but language is stuck on English

      I found that opening the application's info.plist file and changing the CFBundleDevelopmentRegion key to German (or de_DE) will then cause the app to start up in German. This will also persist if I switch the system language back to English, so this setting is overriding the system language. Removing this setting from info.plist also works on 10.14, but on 10.13 this then causes the app to revert back to English (with the region still set to Germany), even if the system locale is set to German.  I tried various combinations of system locale settings, CFBundleDevelopmentRegion values in the application, and OS versions.  The discrepancies are highlighted


      System locale CFBundleDevelopmentRegion (Info.plist) Qlocale::system().name() (10.14.1 / 10.13)
      English/US English / en_US en_US / en_US
      English/US German de_DE / en_US
      English/US de_DE de_DE / de_DE
      English/US <removed> en_US / en_US
      German/Germany English en_DE / de_DE
      German/Germany en_US en_DE / en_DE
      German/Germany German / de_DE de_DE / de_DE
      German/Germany <removed> de_DE / en_DE
      English/UK English / en_US en_GB / en_GB
      English/UK German de_DE / en_GB
      English/UK de_DE de_DE / de_DE
      English/UK <removed> en_GB / en_GB


      I tried rebuilding the application with Qt 5.12.0 and found no change in any of this behavior


        Issue Links

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



              vestbo Tor Arne Vestbø
              rdowell Ryan Dowell
              6 Vote for this issue
              13 Start watching this issue



                Gerrit Reviews

                  There are no open Gerrit changes