Locale in CentOS

To compile a locale in CentOS, do something like this:

root# localedef -c -f UTF-8 -i en_US en_US.utf8

To see all locales available, do this:

$ locale -a

To set locale, do something like this:

$ export LANG=en_US.UTF-8

To enable global utf-8 support, we can create a file /etc/sysconfig/i18n, and add the following:

LANG="en_US.UTF-8" 

The file /etc/sysconfig/i18n sets the default language, any supported languages, and the default system font. For example:

LANG="en_US.UTF-8" 
SUPPORTED="en_US.UTF-8:en_US:en" 
SYSFONT="latarcyrheb-sun16"

 

 

 

Comments

How to set it for the whole system?

When we do these commands, the locale are set for the current console only.

How can we set the locale for the whole system and to have those values when I log on my system?

/etc/profile

You can add those commands in /etc/profile.