jansorg / tom-ui

Qt5-based user interface for the tom time tracker
https://www.tomtime.dev
GNU General Public License v3.0
8 stars 2 forks source link

Follow the standard way to choose the date locale in reports #136

Open tanius opened 1 year ago

tanius commented 1 year ago

Currently, the following will start tom-ui with the date format in reports switched to German:

LC_ALL=en LC_TIME=en LANG=de tom-ui

So it seems that tom-ui evaluates the LANG environment variable directly to choose the date locale based on that.

This does not follow the rather convoluted standard practice for Linux locale switching, where LC_TIME would take preference over LANG, andLC_ALL would take preference over LC_TIME. (For messages, there would also be LANGUAGE overriding LC_ALL but it is not relevant for the date locale – see the details.)

That standard practice is already used by Qt's QLocale at least for the locale of messages – compare my analysis. So probably, some QLocale method can be used to detect the date locale "the standard way".

Additional note: Qt does evaluate the LC_TIME enviroment variable separately indeed. On my system I use by default LANGUAGE=en LC_ALL= LC_TIME=de_DE.UTF-8 LANG=en_US.UTF-8 and get German date chooser widgets in tom-ui as intended already. Just not yet a German date format in tom-ui's reports.