9

I am on a multi user Debian Stretch system which has en_US.UTF-8 as default locale, but I want de_DE.UTF-8 for my user. I was able to set it for terminals, by adding export LANG=de_DE.UTF-8 to ~/.bashrc.

The problem is that my X environment (with XFCE as window manager and lightdm as login manager) still uses the default locale, which isn't a surprise as .bashrc is just for bash. So I tried setting the variable in various other files:

~/.xinitrc

This file doesn't seem to get executed at all.

~/.config/xfce4/xinitrc

Setting the variable here didn't work either (no observed change in behaviour). Also, if I switch the window manager, I need to set it for the new one again, which isn't very appealing.

~/.xsession

Setting the variable here presumably works, but I would also need to start the window manager here, so I'm hoping to find a better place.

~/.pam_environment

Seems to be ignored on Debian

~/.xsessionrc

Setting environment variables here actually seems to work, but it looks like LANG is set to en_US.UTF-8 later in the startup process.

~/.i18n

Setting a language here doesn't seem to work.

It seems like all these aren't the right place to set the LANG variable. Where should I set it, to get the desired result?

2
  • ~/.pam_environment is read by default on Debian. Did you write LANG=de_DE.UTF-8 or export LANG=de_DE.UTF-8? export is wrong there, this isn't a shell script, just a list of VARIABLE=value lines. Commented Feb 6, 2016 at 21:41
  • I wrote LANG=de_DE.UTF-8. I also tried TEST=something to be sure that LANG isn't overwritten somewhere else. However, I TEST wasn't set on either physical or X terminals.
    – Kritzefitz
    Commented Feb 7, 2016 at 16:36

2 Answers 2

2

I had the same problem that the language is not correctly set by lightdm (see this bug). Adding the LANG exports to both .bashrc and .xsessionrc did the trick for me. I export to LANG, LANGUAGE and LC_ALL to be sure.

3
  • I tried exporting LANG, LANGUAGE and LC_ALL in .bashrc, .xsessionrc and .config/locale.conf (on archlinux) and it still does not apply.
    – bparker
    Commented Aug 15, 2019 at 21:18
  • @bparker: In what context? Using Thunderbird? Commented Jun 5, 2020 at 3:10
  • @Peter Mortensen XFCE itself. I don't remember how I fixed it but I only have a .dmrc file now so that must have been it (even though others said it doesn't work?) But I can't find any other files on my system (user or root) that have my locale in it and it's working
    – bparker
    Commented Jun 6, 2020 at 12:45
1

Setting ~/.dmrc works on Arch/Manjaro

$ cat ~/.dmrc 
[Desktop]
Session=xfce4
Language=en_US.utf8

This is mentioned in the Arch Wiki:

LightDM will automatically use accountsservice to set a user's locale if it is installed. Otherwise, LightDM stores the user session configuration in ~/.dmrc. It is possible that an unwanted locale setting is retrieved from there as well.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.