9

In what configuration file is the LANGUAGE environment variable set? (Or how can I change it by other means?)

Background: I was playing around with language settings in kubuntu and installed Russian by accident. Now it won't totally go away. Yes, english shows up in the GUI, but it's Russian on the command line. As best I can figure, it's due to the LANGUAGE environment variable. See the third line:

leon@leon-Desktop:~$ locale
LANG=en_US.UTF-8
LANGUAGE=en:ru:en
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=en_US.UTF-8
LC_TIME=en_US.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=en_US.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=en_US.UTF-8
LC_NAME=en_US.UTF-8
LC_ADDRESS=en_US.UTF-8
LC_TELEPHONE=en_US.UTF-8
LC_MEASUREMENT=en_US.UTF-8
LC_IDENTIFICATION=en_US.UTF-8
LC_ALL=

Everything is set correctly except for LANGUAGE. I've gone through a number of instructions for how to configure the locale/language, but nothing seems to change LANGUAGE (although they have changed other environmental variables, like LANG). So, I'm not interested in an overview of how to change the locale. I need to specifically know how to change LANGUAGE (unless I'm totally misunderstanding the situation). For what it's worth, LANG is set in /etc/default/locale, but LANGUAGE is not set there. (I tried setting LANGUAGE there, and it gets overridden somehow.) If I manually set LANGUAGE to en, then that particular shell works fine, so I think that only LANGUAGE needs to be changed.


EDIT:

Just to make clear, setting LANGAUGE in /etc/default/locale does not help. Additionally, ~/.pam_environment does not exist.

See below. LANGUAGE is set to "en" in /etc/default/locale. I restarted the machine. I verified the contents of /etc/default/locale. However, apt-get still outputs in Russian because LANGUAGE was overwritten elsewhere (producing the above output from locale).

leon@leon-Desktop:~$ cat /etc/default/locale 
LANG="en_US.UTF-8"
LANGUAGE="en"
leon@leon-Desktop:~$ cat ~/.pam_environment
cat: /home/leon/.pam_environment: No such file or directory
leon@leon-Desktop:~$ sudo apt-get update
Игн http://mirror.anl.gov utopic InRelease

...

EDIT 2:

It looks like ~/.kde/env/setlocale.sh was the culperate. I guess I'll file a KDE bug report.

$ cat ~/.kde/env/setlocale.sh
export LANGUAGE=en:ru:en
export LANG=en_US.UTF-8
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
4

Taken from help.ubuntu.com

The LANGUAGE priority list

The "LANGUAGE" environment variable, which is set by the GUIs more often than not on 
Ubuntu desktops, controls language for message and menu display for GNU compatible 
applications. For such applications it overrides whatever locale names are set in 
"LANG" and "LC_MESSAGES".

Unlike "LANG" and "LC_*", "LANGUAGE" should not be assigned a complete locale name 
including the encoding part (e.g. ".UTF-8"). Instead "LANGUAGE" should contain a 
colon separated priority list of language codes, for instance "es:de:en". A single 
language code is also correct.

As lame as a link answer is, this is probably what you want.

The post referenced in the link above explains that if you want to change the language that appears on the command-line then you need to set both LANG and LANGUAGE accordingly in either /etc/default/locale or ~/.pam_environment.

Since you've already tried setting LANGUAGE in /etc/default/locale, I'd try setting it in ~/.pam_environment since that's a user config file and its contents should overwrite anything set in the global environment.

EDIT:

I went ahead and tried duplicating the problem that you described by setting LANGUAGE in /etc/default/locale to "en:ru:en" logging out and then logging back in. It worked. Error messages were then displayed in Russian, at least for the root account (which was the account I was testing this on). Changing the value of LANGUAGE to "en" fixed it.

  • Unfortunately, as I noted, setting the variable in /etc/default/locale is not enough. (See the original post and the edit for clarification.) Apparently, the variable gets overwritten somewhere, and I need to know where that somewhere is. – lnmaurer Dec 27 '14 at 21:17
  • @lnmaurer I know. Did you try setting it in ~/.pam_environment? I saw your comment about it not existing. You could try grep LANGUAGE /etc -r | less and then go through and manually check every single instance of LANGUAGE. Also, be sure to check ~/.profile and ~/.xsessionrc – Alexej Magura Dec 28 '14 at 3:11
  • 2
    I took your advice grepping. /etc turned up nothing, but grepping my home directory turned up /.kde/env/setlocale.sh. It looks like that was the problem. – lnmaurer Dec 28 '14 at 19:14
1

It sounds like you have the LANGUAGE variable set to ru:en or something in /etc/default/locale, so try to change it there to just en.

The answer, which Alexej Magura wrote, also mentions ~/.pam_environment. Possibly, since you have Kubuntu, other files may be involved instead (or also).

  • ~/.pam_environment doesn't exist for me. Any other thoughts for what file might be to blame? – lnmaurer Dec 27 '14 at 21:18
  • @lnmaurer: Possibly ~/.kde/share/config/kcmlocale-grouping has something to do with it. It can be changed via System Settings -> Locale -> Languages. – Gunnar Hjalmarsson Dec 28 '14 at 3:16
  • 1
    You're right that it was something KDE specific. It looks like ~/.kde/env/setlocale.sh was the problem. – lnmaurer Dec 28 '14 at 19:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.