Setting locale for user

15,835

Solution 1

X login is annoyingly inconsistent about which startup file names are used. On the system I'm using you would just need to modify $HOME/.xsessionrc. But it does vary. I generally put my environment variable settings in a separate file and source that from .profile and .xsessionrc.

If .xsessionrc does not work for you, check the documentation or read the scripts in /etc/X11/.

Solution 2

Setting any locale incorrectly can produce unwanted results, but first and foremost I would refrain from using en_US.utf8 - instead use en_US.UTF-8.

Lowercase .utf8 may be usefull in certain programming environments but a normal user would need the correct value.

Edit .xsessionrc,.bashrc and/or .profile to include the line(s) they may need, such as these:

LANG=en_US.UTF-8
LC_NUMERIC=es_ES.UTF-8
LC_MONETARY=es_ES.UTF-8
LC_PAPER=es_ES.UTF-8
LC_NAME=es_ES.UTF-8
LC_ADDRESS=es_ES.UTF-8
LC_TELEPHONE=es_ES.UTF-8
LC_MEASUREMENT=es_ES.UTF-8
LC_IDENTIFICATION=es_ES.UTF-8
LC_TIME=en_GB.UTF-8
PAPERSIZE=a4
LANGUAGE=en_US
LANG=en_US.UTF-8

Note , I have different values for different locale types. Each to their own! Remove those you don't need and look here for more info.

Share:
15,835

Related videos on Youtube

peoro
Author by

peoro

Apparently, this user has nothing to say.

Updated on September 18, 2022

Comments

  • peoro
    peoro over 1 year

    I'd like to set a locale for my user different than system locale.

    By putting export LANG=en_US.utf8 in .bashrc I could do that for the shells, but still it's not working for applications not started via a shell (i.e. the desktop environment, LXDE, which is started through GDM3).

    Is there any way to set a different default locale (used by any kind of application, even if not started via bash) for my user?

    • Admin
      Admin about 12 years
      Not .bashrc. Usually ~/.profile, but unfortunately there's no universal answer. See Alternative to .bashrc