You are not logged in.

#1 2022-01-30 13:07:30

blablaalb
Member
Registered: 2022-01-30
Posts: 2

User specific locale isn't applied

Basically I had the same problem  the OP had in this thread.
I have activated 3 locales inside the /etc/locale.gen file. After installing Arch I added 2 user accounts. One of the user accounts uses en_US locale (the main/default locale) and for another account I specified different locale inside the ~/.config/locale.conf file and then I ran locale-gen . The language didn't change after system reboot, running the locale command showed that no languages has been changed for the user but If I run

unset LANG
source /etc/profile.d/locale.sh

terminal's output changes to the language I had specified inside the  ~/.config/locale.conf   file and the locale command's output changes to the second locale.
Now, I managed to fix the problem by modifying the etc//profile.d/locale.sh file.

#!/bin/sh
 
# load locale.conf in XDG paths.
# /etc/locale.conf loads and overrides by kernel command line is done by systemd
# But we override it here, see FS#56688
# if [ -z "$LANG" ]; then
  if [ -n "$XDG_CONFIG_HOME" ] && [ -r "$XDG_CONFIG_HOME/locale.conf" ]; then
    . "$XDG_CONFIG_HOME/locale.conf";
  elif [ -n "$HOME" ] && [ -r "$HOME/.config/locale.conf" ]; then
    . "$HOME/.config/locale.conf";
  elif [ -r /etc/locale.conf ]; then
    . /etc/locale.conf;
  fi
# fi

 
# define default LANG to C if not already defined
LANG=${LANG:-C}
 
# export all locale (7) variables when they exist
export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY \
       LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT \
       LC_IDENTIFICATION
 

I commented out the

if [ -z "$LANG" ]; then

condition and now the user's locale is applied.
I wonder if it's a bug or something I overlooked?

PS I'm mainly Windows user and not well familiar with linux & bash. I followed the guidance.

Last edited by blablaalb (2022-01-30 13:11:13)

Offline

#2 2022-01-30 14:28:57

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,091

Re: User specific locale isn't applied

Your desktop environment might steamroll over this or rather set $LANG

Offline

#3 2022-01-30 16:31:42

blablaalb
Member
Registered: 2022-01-30
Posts: 2

Re: User specific locale isn't applied

The desktop environment is XFCE. I have also tried two desktop managers: lxdm and lighdm. In both cases locale was automatically reset to the default one. I'm not well familiar with Linux yet, so I'm googling and searching. I also suspect it might be that either desktop environment or desktop manager overrides the user specific locale.

Last edited by blablaalb (2022-01-30 16:32:26)

Offline

#4 2022-01-30 17:24:37

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,091

Re: User specific locale isn't applied

You can check

tr '\0' '\n' < /proc/$(pidof xfce4-session)/environ

to see what $LANG the session binary has.

Offline

Board footer

Powered by FluxBB