Beep6581 / RawTherapee

A powerful cross-platform raw photo processing program
https://rawtherapee.com
GNU General Public License v3.0
2.82k stars 319 forks source link

Incorrect locale environment variable handling on Linux #6368

Open VorpalBlade opened 3 years ago

VorpalBlade commented 3 years ago

Short description On Linux the LANG, LC_MESSAGES etc environment variables determine locale settings to be used. It appears rawtherapee only uses LANG. The correct behaviour is that:

However, rawtherapee completely ignores LC_MESSAGES and just uses LANG instead for the text in the GUI. I have not checked if this also applies to LC_NUMERIC, LC_TIME etc (this could affect things like the decimal separator).

Steps to reproduce

  1. Execute in a shell:
    export LANG=sv_SE.UTF-8
    export LC_MESSAGES=en_US.UTF-8
    rawtherapee
  2. Notice that menus are translated to Swedish, even though they should be in English. LC_ALL should also override, but doesn't. Note: Swedish translation is incomplete (which is yet another reason I don't want to use it), so some text will be in English.

Expected behavior The various locale environment variables should be respected so that people who prefers an English GUI but other things (such as time & date formatting, decimal separators etc) in their native locale get the correct experience.

Additional information

Screenshot showing program being translated when it shouldn't be: rawtherapee_in_swedish

innir commented 2 years ago

Yes, true, RawTherapee only checks for LANG, see https://github.com/Beep6581/RawTherapee/blob/dev/rtgui/multilangmgr.cc#L142-L153 and https://github.com/Beep6581/RawTherapee/blob/dev/rtgui/multilangmgr.cc#L252-L258

Correct behavior would be to check for LC_ALL first, then for LC_MESSAGES and fallback to LANG if neither LC_ALL nor LC_MESSAGES exist.

NB: The decimal separator is forced to dot regardless the local.