Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I logged in to Ubuntu 12.04 desktop via ssh, the env variables of locale had been set are followed:
env | grep LC

LC_PAPER=zh_CN.UTF-8  
LC_ADDRESS=zh_CN.UTF-8  
LC_MONETARY=zh_CN.UTF-8  
LC_NUMERIC=zh_CN.UTF-8  
LC_TELEPHONE=zh_CN.UTF-8  
LC_IDENTIFICATION=zh_CN.UTF-8  
LC_MEASUREMENT=zh_CN.UTF-8  
LC_TIME=zh_CN.UTF-8  
LC_NAME=zh_CN.UTF-8  

so my question is:

where set such env, and why LC_CTYPE and LC_MESSAGES NOT set?

share|improve this question
1  
This question appears to be off-topic because it is speculative in nature –  bodhi.zazen Dec 18 '13 at 16:52
1  
@bodhi.zazen: I really don't understand what you mean by "speculative in nature". To me they are questions about how Ubuntu works. –  Gunnar Hjalmarsson Dec 19 '13 at 14:02
    
I suppose your question seemed ambiguous, I could not tell if you were ashing how to set environmental variables and/or speculate why the developers choose to set some and not other variables. –  bodhi.zazen Dec 19 '13 at 14:12
    
@bodhi.zazen: There is nothing about LC_* or LANG in file /etc/environment and there is only one line: LANG=zh_CN.UTF-8 in /etc/default/locale. But when log in Ubuntu 12.04 desktop, I found LC_* but LC_MESSAGES, LC_CTYPE and LC_COLLATE were set zh_CN.UTF-8. So I confused with that! And Gunnar Hjalmarsson's answer help me! –  sfz Dec 19 '13 at 15:36

2 Answers 2

up vote 0 down vote accepted

When you use Language Support to set language and regional formats, the resulting environment variables are written to ~/.pam_environment, as you already have found out. When you apply system-wide, the variables are written to /etc/default/locale.

The reason why LC_MESSAGES, LC_CTYPE and LC_COLLATE are not set explicitly is that LANG is set, and the locale name in LANG is inherited by those three LC_* variables. You can check that by running the locale command instead of env | grep LC.

share|improve this answer
    
Yes, locale command can list all LC_* variables; but why LC_MESSAGES, LC_CTYPE and LC_COLLATE are NOT set in ~/.pam_environment? –  sfz Dec 19 '13 at 7:05
    
Didn't I cover that in my answer? Because LANG is set, and LC_MESSAGES, LC_CTYPE and LC_COLLATE inherit the LANG value, which is good since they should have the same value as LANG. In other words there is no need to set them explicitly in ~/.pam_environment. –  Gunnar Hjalmarsson Dec 19 '13 at 9:29
    
Thank you for your patient. I really really understand. –  sfz Dec 19 '13 at 12:37

System wide environmental variables are set in /etc/environment and, for locales /etc/default/locale

/etc/environment - This file is specifically meant for system-wide environment variable settings. It is not a script file, but rather consists of assignment expressions, one per line. Specifically, this file stores the system-wide path settings.

/etc/default/locale - This file is specifically meant for system-wide locale (LC_*) environment variable settings. It is not a script file, but rather consists of assignment expressions, one per line.

For additional information, see https://help.ubuntu.com/community/EnvironmentVariables#System-wide_environment_variables and https://help.ubuntu.com/community/Locale

As to "why LC_CTYPE and LC_MESSAGES NOT set?", I could not find a discussion, I suggest you might have better luck filing a bug report, feature request, or perhaps IRC. That part of your question may be considered off topic and speculative.

share|improve this answer
    
in /etc/environment there are nothing about LC_* and only one line: LANG=zh_CN.UTF-8 in /etc/default/locale –  sfz Dec 18 '13 at 17:00
    
I found the such env variables defined in $HOME/.pam_environment. thx very much! –  sfz Dec 18 '13 at 17:09
    
OK, glad you got it sorted =) –  bodhi.zazen Dec 18 '13 at 17:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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