set locale on commandline without system-config-language

General support questions
cs12
Posts: 17
Joined: 2007/11/03 16:51:58

Re: set locale on commandline without system-config-language

Post by cs12 » 2012/02/08 16:54:04

For future reference -- I fixed this.
The problem was with incorrect (660) permissions on /etc/profile so any user besides root was not picking up /etc/profile at all. Case closed.

janxy
Posts: 3
Joined: 2011/07/23 12:15:21

Re: set locale on commandline without system-config-language

Post by janxy » 2013/01/08 10:38:13

Dear community,

oddly enough i'm running on CentOS6.3 now, have issues with the locale having changed to german in a self-acting manner, and attempting to find a hint from the web about the reason for this i stumbled upon my own post here...

I.e.: in 6.3 still same issue as back then ;-)

So far the issue boils down to this oddity:

1) upon installation, i configured the locale to be "en_US.UTF-8" and my old logs tell me that initially it also worked for the logins for a while on. Later it changed - maybe triggered by updates?

2) Since then the situation is like this:

#ttys1>[root@myhost](~)$
echo $LANG
de_DE.UTF-8

#ttys1>[root@myhost](~)$
cat /etc/sysconfig/i18n
LANG="en_US.UTF-8"
SYSFONT="latarcyrheb-sun16"

#ttys1>[root@myhost](~)$
locale
LANG=de_DE.UTF-8
LC_CTYPE="de_DE.UTF-8"
LC_NUMERIC="de_DE.UTF-8"
LC_TIME="de_DE.UTF-8"
LC_COLLATE="de_DE.UTF-8"
LC_MONETARY="de_DE.UTF-8"
LC_MESSAGES="de_DE.UTF-8"
LC_PAPER="de_DE.UTF-8"
LC_NAME="de_DE.UTF-8"
LC_ADDRESS="de_DE.UTF-8"
LC_TELEPHONE="de_DE.UTF-8"
LC_MEASUREMENT="de_DE.UTF-8"
LC_IDENTIFICATION="de_DE.UTF-8"
LC_ALL=

Thus while my previous poster cs12 had issues with deviation between administrative and non-administrative accounts, i just have an inconsistency within the privileged account, thus any side effects from...:

#ttys1>[root@myhost](~)$
ls -al /etc/profile
-rw-r--r--. 1 root root 1793 22. Jun 2012 /etc/profile

... might not pertain here.

TrevorH's hint to "/etc/profile.d/lang.sh" tells a lot of how the locale is managed on CentOS, thanks a lot, that was basically what i was looking for back then (in order to understand how thing work).

But still, it does not seem to do it's job here, i.e.: => "2)"

My other potentially relevant parameters are:

3)
#ttys1>[root@myhost](~)$
ls -al cat /etc/environment
ls: Zugriff auf cat nicht möglich: Datei oder Verzeichnis nicht gefunden
-rw-r--r--. 1 root root 0 22. Jun 2012 /etc/environment

#ttys1>[root@myhost](~)$
cat /etc/environment

4)
#ttys1>[root@myhost](~)$
cat ~/.bashrc
# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi


Thus: cutomizing my bashrc might compensate for this, but

- still it feels like this is just a fix and not how it should be configured properly/generically.
- it really looks like i have a similar issue as viniciusfs had: something might act behind the scenes?

If anyone has an idea, it would be gorgeous!

Best

Janxy

marcelk
Posts: 1
Joined: 2013/01/18 10:22:55
Contact:

Re: set locale on commandline without system-config-language

Post by marcelk » 2013/01/18 10:35:40

I had the same problem, and just found what causes the magical locale change. And the answer is: the locale is transferred by ssh from the client to the server. In my case, I'm running Mac OS X locally, and when I run 'locale' locally, I'm getting:

LANG="nl_NL.UTF-8"
LC_COLLATE="nl_NL.UTF-8"

In my local ssh configuration file (/etc/ssh_config), there is a setting that instructs SSH to transfer some environment variables to the server:

SendEnv LANG LC_*

So when I ssh into my CentOS server, I get the same (Dutch) locale as well. If I comment out the "SendEnv" line in my SSH configuration, this doesn't happen any more, and I get the default (English) locale on my CentOS server.

sparrow
Posts: 1
Joined: 2014/02/26 08:56:53

Re: set locale on commandline without system-config-language

Post by sparrow » 2014/02/26 09:12:00

Hi,
I have found an other possible cause. In your home directory their is a file named .dmrc . This file save the default language of your session. "In theory this file should be shared between GDM (Gnome) and KDM (KDE), so users only have to configure things once. This is a standard .ini kind / style configuration file. It has only one section called [Desktop] which has two keys: Session and Language. [...] Normally GDM will write this file when the user logs in for the first time, and rewrite it if the user chooses to change their default values on a subsequent login."

Changing the language to what I wanted that is to say : fr_fr.utf-8 solved the problem for me.

Hope that will help.

Sorry for my bad english, I am french ;)

Post Reply