Locale settings doesn't work, or overrides

I have this issue I really can’t figure out. It shouldn’t be a problem, and I’ve done this many times before. But, setting LC_MESSAGES=en_US.utf8 overrides the rest of the system, and tthe whole system shows up in english. At the moment, I have only LANG set to my language (sv_SE.utf8), as set on install.

As soon as I add LC_MESSAGES - either as an export in a .bash_file, or in /etc/locale.conf - it all turns into english. And if I add LANGUAGE=sv to the mix, then that one overrides LC_MESSAGES (and I think LANGUAGE is supposed to be empty, right). What am I missing?

/* Also read some RedHat paper that said locale.conf now is the place to make the changes after being in some othe place in /etc before. I also tried the ~/.i18 file - but withe the same result. */

Misc output …

This turns the system into english

$ sudo grep Lang /var/lib/AccountsService/users/<username>
Language=sv_SE.utf8
~$ localectl
   System Locale: LANG=sv_SE.utf8
                  LC_MESSAGES=en_US.utf8
       VC Keymap: se
      X11 Layout: se
$ cat /etc/locale.conf 
LANG=sv_SE.utf8
LC_MESSAGES=en_US.utf8
$ cat /etc/lenvironment
LANG=sv_SE.utf8

// System: RL8.7 :: Xfce

Managed to get it to work, I think.

So, where ever I add LC_MESSAGES=en_US.utf8 - on restart the whole system is english. And when checking all parameters (printenv, localectl, locale), it says LANG=sv_SE.utf8. I’ve tried to add it in .bashrc, .profile, .i18, and also tested a drop-in script in /etc/profile.d/my_script.sh.

I’m really courious why this isn’t working, and why it’s taking over the system language?

Anyyway… Adding it in .bashrc without “export”, just as a variable - then it seems to work.

· Eric

Nope, was just a half-fix. Some in EN, but most in SE. This is so frustrating. :confused:

Ok, now I’ve solved it. I added some code to restrict it to the interactive shell.

case $- in
    *i*) ;;
      *) return;;
esac

Then LC_MESSAGES works as “normal”. So, I added it to /etc/skel/.bashrc as well.

Maybe it’s a miss from me, or a miss in the the installation media to not add/include that (eg. it seems to be required), but still… It doesn’t explain (or make sense) why LC_MESSAGES hijacks the system-language and makes it an all english system - espacially since all settings says it’s set to Swedish.

Well, all is good now. :crossed_fingers::+1:

 

/* If someone happen to sit on an explaination, please do share. I’m really interested to know why this happened. I’ve never experienced this before (with or without the interactive shell code check). */

1 Like