Bug 416771

Summary: If more than one language is listed in Language KCM, the default one is not applied to GTK2 and GTK3 apps
Product: [Applications] systemsettings Reporter: Patrick Silva <bugseforuns>
Component: kcm_languageAssignee: Eike Hein <hein>
Status: RESOLVED DUPLICATE    
Severity: normal CC: katyaberezyaka, kde, linux2019, matt, nate, plasma-bugs
Priority: NOR    
Version: 5.22.90   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: screenshot

Description Patrick Silva 2020-01-26 00:37:58 UTC
Created attachment 125420 [details]
screenshot

SUMMARY
See the attached screenshot please.
My default language is american english, but gtk3 app Gnome Disks is translated to portuguese. Nautilus, Gedit text editor, inkscape and gimp are also affected. 

Operating System: Arch Linux 
KDE Plasma Version: 5.17.90
KDE Frameworks Version: 5.66.0
Qt Version: 5.14.0
Comment 1 David Edmundson 2020-01-26 06:50:09 UTC
Please include output of "env"
Comment 2 Patrick Silva 2020-01-26 10:07:21 UTC
output of env

alias systemctl='systemctl -l'
SHELL=/bin/bash
SESSION_MANAGER=local/Arch-PC:@/tmp/.ICE-unix/977,unix/Arch-PC:/tmp/.ICE-unix/977
WINDOWID=62914567
QT_SCREEN_SCALE_FACTORS=VGA-1=1;HDMI-1=1;HDMI-2=1;DP-1=1;HDMI-3=1;
COLORTERM=truecolor
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session1
LANGUAGE=en_US:pt_BR
FREETYPE_PROPERTIES=truetype:interpreter-version=40
SHELL_SESSION_ID=a55317112a29484d8ce56ef2bece8a8b
DESKTOP_SESSION=/usr/share/xsessions/plasma
GTK_MODULES=canberra-gtk-module
XDG_SEAT=seat0
PWD=/home/myusername
XDG_SESSION_DESKTOP=KDE
LOGNAME=myusername
XDG_SESSION_TYPE=x11
XAUTHORITY=/home/myusername/.Xauthority
HOME=/home/myusername
LANG=pt_BR.UTF-8
XDG_CURRENT_DESKTOP=KDE
KONSOLE_DBUS_SERVICE=:1.60
KONSOLE_DBUS_SESSION=/Sessions/1
PROFILEHOME=
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
KONSOLE_VERSION=191201
KDE_SESSION_UID=1003
XDG_SESSION_CLASS=user
TERM=xterm-256color
GTK_OVERLAY_SCROLLING=0
USER=myusername
COLORFGBG=0;15
KDE_SESSION_VERSION=5
PAM_KWALLET5_LOGIN=/run/user/1003/kwallet5.socket
DISPLAY=:0
SHLVL=1
XDG_VTNR=1
XDG_SESSION_ID=2
MOZ_PLUGIN_PATH=/usr/lib/mozilla/plugins
XDG_RUNTIME_DIR=/run/user/1003
XCURSOR_THEME=breeze_cursors
XDG_DATA_DIRS=/home/myusername/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share:/var/lib/snapd/desktop
KDE_FULL_SESSION=true
PATH=/home/myusername/kde/src/kdesrc-build:/usr/local/sbin:/usr/local/bin:/usr/bin:/var/lib/flatpak/exports/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/var/lib/snapd/snap/bin
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1003/bus
MAIL=/var/spool/mail/myusername
_JAVA_OPTIONS=-Dawt.useSystemAAFontSettings=on
KONSOLE_DBUS_WINDOW=/Windows/1
_=/usr/bin/env
Comment 3 David Edmundson 2020-01-26 15:54:38 UTC
>LANG=pt_BR.UTF-8

Even though LANGUAGE is correct :/
Comment 4 linux2019 2020-10-06 06:37:56 UTC
I have observed this bug - it seems there is some issue with the definition and / or "correct" usage of language codes in environment variables.

POSIX vars: for example LANG, LC_ALL with long language like de_DE.UTF-8 , de_DE

however

KDE / Plasma seems to use 2 letter from ISO-3166-1 :
Those are added to the LANGUAGE var that the UI uses and that is configured and manipulated in the "Settings" with a fallback / plasma translations (?) list.
source: https://help.ubuntu.com/community/EnvironmentVariables#The_LANGUAGE_priority_list 

This can be verified by executing
qemu-system-x86_64  # English Menu
LANGUAGE=de:en_GB qemu-system-x86_64 # English
LANGUAGE=de_DE:en_GB qemu-system-x86_64 # German / Deutsch

also curious:
LANGUAGE=de:en_GB:en:fr:zh_CN qemu-system-x86_64 # Chinese
LANGUAGE=de:en_GB:en:fr:en_US:zh_CN qemu-system-x86_64 # Chinese
LANGUAGE=de:en_GB:en:fr_FR:en_US:zh_CN qemu-system-x86_64 # French

env|grep LANG
LANGUAGE=de:en_GB:en_US:fr
LANG=de_DE.UTF-8

using plasma 5.19.5 Arch Linux here
Comment 5 soredake 2021-01-04 09:34:01 UTC
Any progress on this?
Comment 6 Matthew Cline 2021-05-19 09:19:35 UTC
The problem seems to be that many GTK apps don't explicitly name or alias their English locale as "en" or "en_US", but instead make it the default locale, which is "C".  For these apps if you have "LANGUAGE=en_US" it will try to find the en_US locale, fail, and fallback to the default locale, C, which just usually happens to be English, so it *seems* to work.  But if you have "LANGUAGE=en_US:zh_CN" it tries to find en_US, fails, moves onto zh_CN, finds it, and so displays Chinese.  This can be verified by using "LANGUAGE=C:zh_CN", which for most GTK apps should cause them to display English.  Or at least *mostly* English: for Evolution it causes some fields/labels to be in Chinese.

Possible solutions:

1) When generating plasma-localerc, try to guess a good place to insert "C" into LANGUAGE.

2) In the "Configure Plasma translations" GUI, have a "GTK default" language which will be second in the list when plasma-localerc has no [Translations] section.  The user can then change its position in the list or delete it.
Comment 7 Nate Graham 2021-09-30 20:59:24 UTC

*** This bug has been marked as a duplicate of bug 192019 ***