Debian – Setting the LANG environment variable for xfce

debiandesktop-environmentenvironment-variableslocalexfce

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?

Best Answer

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.

Related Question