Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have generated en_US.utf8, et_EE.iso88591 and ru_RU.utf8 localisation files. Now if I try to change any of the locale variables to a ru_RU.utf8 or en_US.utf8, then this does not have any effect:

# locale -a
C
en_US.utf8
et_EE
et_EE.iso88591
POSIX
ru_RU.utf8
# LC_TIME=ru_RU.utf8
# locale | grep LC_TIME
LC_TIME="et_EE.iso88591"
# LC_TIME="ru_RU.utf8"
# locale | grep LC_TIME
LC_TIME="et_EE.iso88591"
# 

However, if I change the LANG= variable, then all other variables but LANGUAGE= and LC_ALL= take the value of the LANG= variable. Is there a way to modify each locale variable separately? In addition, am I correct that locale variables aren't regular shell variables, but more like parameters to locale utility?

share|improve this question
    
Which distro is this? –  slm May 3 '13 at 23:47

3 Answers 3

Under the Fedora/CentOS/RHEL based distros I believe you can change the locale to one of the locale's displayed when you run the locale -a command in this system file:

/etc/sysconfig/i18n

For example on my Fedora 14 system:

$ more /etc/sysconfig/i18n 
LANG="en_US.UTF-8"
SYSFONT="latarcyrheb-sun16"

Under GNOME you can run the help app:

system-config-language

Which brings up this GUI:

             ss of lang. gui

I think it's slightly different for the Debian/Ubuntu distros. I believe it's this file:

/etc/default/locale

I believe they're environment variables but not entirely sure how applications make use of them if at all.

References

share|improve this answer

You can set any locale category independently. LANG applies only to the categories that are not explicitly set.

LANG and LC_xxx are ordinary environment variables. They are not settings for the locale utility: the locale program isn't involved in any locale processing, it's just a small utility to report current and available locale settings.

When you write LC_TIME=ru_RU.utf8, this doesn't set an environment variable, only a shell variable. Shell variables are internal to the shell, they are not seen by other programs. Environment variables, on the other hand, are inherited by the programs that the shell starts. You need to export the variable to the environment as well:

$ LC_TIME=ru_RU.utf8
$ locale | grep LC_TIME
LC_TIME="et_EE.iso88591"
$ export ru_RU.utf8
$ locale | grep LC_TIME
LC_TIME="ru_RU.utf8"

or directly

$ export LC_TIME=ru_RU.utf8
$ locale | grep LC_TIME
LC_TIME="ru_RU.utf8"
share|improve this answer

This may not be directly related to your question about adding new locales. However if you succeed to, please note there are many I18N samples available at http://vouters.dyndns.org/. Just query its search engine with "Internationalizing". You may give some coding samples a try to demonstrate you correctly added as many locales as are available to you.

Yours truly,

share|improve this answer

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.