Bug 335301 - Changing country leads to invalid locale
Summary: Changing country leads to invalid locale
Status: RESOLVED DOWNSTREAM
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_language (show other bugs)
Version: 4.11.9
Platform: Kubuntu Linux
: NOR major
Target Milestone: ---
Assignee: John Layt
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-24 22:31 UTC by Dimitris Kardarakos
Modified: 2014-05-26 12:53 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitris Kardarakos 2014-05-24 22:31:40 UTC
New installation of Kubuntu 14.04 and upgraded via kubuntu-ppa. Initially, country is set to "United States". The locale settings are the following:

dimitris@ulysses:~/.kde/env$ cat setlocale.sh 
export LANG=en_US.UTF-8
export LANGUAGE=en:el:en
export LC_NUMERIC=en_US.UTF-8
export LC_TIME=en_US.UTF-8
export LC_MONETARY=en_US.UTF-8
export LC_PAPER=en_US.UTF-8
export LC_IDENTIFICATION=en_US.UTF-8
export LC_NAME=en_US.UTF-8
export LC_ADDRESS=en_US.UTF-8
export LC_TELEPHONE=en_US.UTF-8
export LC_MEASUREMENT=en_US.UTF-8

Then, I change Country to Greece, via System Settings. Locale changes as follows:

export LANG=en_GR.UTF-8
export LANGUAGE=en:el:en
export LC_NUMERIC=en_GR.UTF-8
export LC_TIME=en_GR.UTF-8
export LC_MONETARY=en_GR.UTF-8
export LC_PAPER=en_GR.UTF-8
export LC_IDENTIFICATION=en_GR.UTF-8
export LC_NAME=en_GR.UTF-8
export LC_ADDRESS=en_GR.UTF-8
export LC_TELEPHONE=en_GR.UTF-8
export LC_MEASUREMENT=en_GR.UTF-8

As far as I know, en_GR.UTF-8 is not a valid entry. A severe loss of functionality is that accents cannot be set properly to greek vowels. Changing manually setlocale.sh to:

export LANG=el_GR.UTF-8
export LANGUAGE=en:el:en
export LC_NUMERIC=el_GR.UTF-8
export LC_TIME=el_GR.UTF-8
export LC_MONETARY=el_GR.UTF-8
export LC_PAPER=el_GR.UTF-8
export LC_IDENTIFICATION=el_GR.UTF-8
export LC_NAME=el_GR.UTF-8
export LC_ADDRESS=el_GR.UTF-8
export LC_TELEPHONE=el_GR.UTF-8
export LC_MEASUREMENT=el_GR.UTF-8

solves the issue.
Comment 1 Rog131 2014-05-25 07:33:13 UTC
Earlier - https://bugs.kde.org/show_bug.cgi?id=322688 - Christoph Feck wrote about the ~/.kde/env/setlocale.sh: "KDE does not create that file, so it must be a distribution-specific patch."

Maybe the Launchpad would be the correct place to report the bug ??
Comment 2 Dimitris Kardarakos 2014-05-25 08:41:41 UTC
I have opened https://bugs.launchpad.net/ubuntu/+source/kde-runtime/+bug/1322968 so as kubuntu team to investigate.
Comment 3 Dimitris Kardarakos 2014-05-26 06:43:51 UTC
Kubuntu team mentioned regarding setting Country to X and Language to Y : "Invalid country language combinations lead to invalid locales." So, KDE System Settings do not support a 
"Country  != Language" combination?
Comment 4 Christoph Feck 2014-05-26 08:38:17 UTC
KDE does, because it does not change or use the system locale. Kubuntu adds some logic which also changes system locale, but apparently this either does not support all combinations, or the logic is wrong.
Comment 5 John Layt 2014-05-26 10:39:56 UTC
The KDE4 Locale settings only affect KDE4 apps which use a different way of localizing things to the rest of the Linux world.  We set and manage regional format settings and translation languages separately, allowing combinations to be mixed and matched as the user wants.  Unfortunately this doesn't map well to non-KDE apps which use POSIX locales in fixed combinations.  We think our way is better, but sadly no-one else has adopted it so in KF5 and Plasma Next we are reverting back to the POSIX standard way of doing it.  Kubuntu has implemented a distro-specific patch to take the two settings and apply them as POSIX locales, but obviously haven't thought to check first that the result is actually a valid installed POSIX locale file.  Kubuntu needs to add a validity check, and then a fallback if it isn't valid, I'd suggest just using the language instead.  They also don't need to export all the LC_* settings, just LANG is enough.  Or they could borrow the new Plasma Next KCM for setting the POSIX locales and add that as a "Non-KDE Locale" option.
Comment 6 orasis 2014-05-26 12:53:38 UTC
Various fresh installations of Kubuntu 14.04 LTS x64 lead to the same problem.
After install followed by system update (and reboot), I change nothing other than the region to "Greece".
Everything else is left to "US English", keyboard layouts etc. And reboot again.
Then if I open a terminal I get this:

$ locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_GR.UTF-8
LANGUAGE=en
LC_CTYPE="en_GR.UTF-8"
LC_NUMERIC=en_GR.UTF-8
LC_TIME=en_GR.UTF-8
LC_COLLATE="en_GR.UTF-8"
LC_MONETARY=en_GR.UTF-8
LC_MESSAGES="en_GR.UTF-8"
LC_PAPER=en_GR.UTF-8
LC_NAME=en_GR.UTF-8
LC_ADDRESS=en_GR.UTF-8
LC_TELEPHONE=en_GR.UTF-8
LC_MEASUREMENT=en_GR.UTF-8
LC_IDENTIFICATION=en_GR.UTF-8
LC_ALL=

As mentioned by Dimitris, notice above, the en_GR -- this does not exist in fact. There is el_GR or en_GB but not en_GR.
Now if I add "Greek" to the languages and reboot the systm becomes Greek/English -- a mix of English and Greek (most Greek), although Greek is not 1st in the list.

The only solution (except editing setlocale.sh manually), is to add "British English" and set it 1st in the list.
Only then, after reboot, I get:

$ locale
LANG=en_GB.UTF-8
LANGUAGE=en
LC_CTYPE="en_GB.UTF-8"
LC_NUMERIC=en_GB.UTF-8
LC_TIME=en_GB.UTF-8
LC_COLLATE="en_GB.UTF-8"
LC_MONETARY=en_GB.UTF-8
LC_MESSAGES="en_GB.UTF-8"
LC_PAPER=en_GB.UTF-8
LC_NAME=en_GB.UTF-8
LC_ADDRESS=en_GB.UTF-8
LC_TELEPHONE=en_GB.UTF-8
LC_MEASUREMENT=en_GB.UTF-8
LC_IDENTIFICATION=en_GB.UTF-8
LC_ALL=

But that causes other problems when using ssh to remote computers.
It appears that setlocale.sh file, is generated (or edited) wrongly by the script that runs when changing locale settings through gui. In a way Kubuntu 14.04 so far does not "like" American English" to be 1st in the list of languages when the Country is set to "Greece" or some other (I haven't tested).