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

qlocale_unix.cpp mirrors setlocale()'s logic with environment variables

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Unresolved
    • Icon: P4: Low P4: Low
    • None
    • 4.8.0, 6.5
    • Core: Locales (i18n)
    • None
    • Linux/Wayland, Linux/X11, Linux/Yocto, Linux/Other display system
    • 5

      The set-up of the system locale on (non-Apple) Unix consults assorted environment variables to determine how we should do localization. The way it does this exactly matches what setlocale(category, "") does in any case; and QCoreApplication::initLocale() does call setlocale(LC_ALL, ""), so we should be able to just use setlocale(category, nullptr) instead of consulting the environment directly. This would have the benefit of respecting any changes the program may have made since instantiating Q*Application, e.g. in response to command-line options it supports, by which the user has requested a change of environment compared to the one their system is configured to use.

      However, this is only an option if QLocale is specified to not be usable before Q*Application is instantiated. That should be checked first.

      We also have (or have had) code in our configuration of X/xcb and related things that mirrors the same environment checks, so requires similar attention. A full trawl through our code-base for further echoes of the same is probably needed.

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

            Eddy Edward Welbourne
            Eddy Edward Welbourne
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes