[arch-general] cannot set locale (systemd)

Tom Gundersen teg at jklm.no
Fri Aug 31 05:39:10 EDT 2012


On Fri, Aug 31, 2012 at 11:30 AM, Thanos Zygouris
<athanasios.zygouris at gmail.com> wrote:
> After upgrading systemd (189-3) and filesystem (2012.8-1) my locale
> isn't en_US.UTF-8 anymore. Instead, it defaults to C.
>
> # cat /etc/locale.conf:
> LOCALE=en_US.UTF-8
> LC_COLLATE=C
>
> # locale
> LANG=C
> LC_CTYPE="C"
> LC_NUMERIC="C"
> LC_TIME="C"
> LC_COLLATE=C
> LC_MONETARY="C"
> LC_MESSAGES="C"
> LC_PAPER="C"
> LC_NAME="C"
> LC_ADDRESS="C"
> LC_TELEPHONE="C"
> LC_MEASUREMENT="C"
> LC_IDENTIFICATION="C"
> LC_ALL=

Do you have a $HOME/.config/locale.conf? What does it contain?

> I tried to run /etc/profile.d/locale.sh manually, but nothing changed.
> If i manually export LANG="en_US.UTF-8", it works, but i suspect it's
> not the "correct" way.

Could you put some debug output in the if/else block to figure out
what is happening? E.g.,


if [ -n "$XDG_CONFIG_HOME" ] && [ -r "$XDG_CONFIG_HOME/locale.conf" ]; then
  echo "using XDG_CONFIG_HOME"
  . "$XDG_CONFIG_HOME/locale.conf"
elif [ -n $HOME ] && [ -r $HOME/.config/locale.conf ]; then
  echo "using HOME"
  . "$HOME/.config/locale.conf"
elif [ -r /etc/locale.conf ]; then
  echo "using system-wide"
  . /etc/locale.conf
elif [ -r /etc/rc.conf ]; then
  echo "using rc.conf"
  LANG=$(. /etc/rc.conf 2>/dev/null; echo "$LOCALE")
fi

And then run it manually to see what is happening.

Cheers,

Tom


More information about the arch-general mailing list