12

I installed Debian sid with Xfce and I would like to change the language used in the interface. I would like to set the language to English (US) which is meant to replace French. The change must apply to both GUI and CLI.

What I tried :

  1. Reconfiguring locales

    It works only for root and not for normal user (my menu is still in French on Xfce)

    # dpkg-reconfigure locales
    # locale
    LANG=en_US.UTF-8
    LANGUAGE=
    LC_CTYPE="en_US.UTF-8"
    LC_NUMERIC="en_US.UTF-8"
    LC_TIME="en_US.UTF-8"
    LC_COLLATE="en_US.UTF-8"
    LC_MONETARY="en_US.UTF-8"
    LC_MESSAGES="en_US.UTF-8"
    LC_PAPER="en_US.UTF-8"
    LC_NAME="en_US.UTF-8"
    LC_ADDRESS="en_US.UTF-8"
    LC_TELEPHONE="en_US.UTF-8"
    LC_MEASUREMENT="en_US.UTF-8"
    LC_IDENTIFICATION="en_US.UTF-8"
    LC_ALL=
    

    As normal user:

    $ dpkg-reconfigure locales
    -bash: dpkg-reconfigure : commande introuvable
    
    $ locale
    LANG=fr_FR.utf8
    LANGUAGE=
    LC_CTYPE="fr_FR.utf8"
    LC_NUMERIC="fr_FR.utf8"
    LC_TIME="fr_FR.utf8"
    LC_COLLATE="fr_FR.utf8"
    LC_MONETARY="fr_FR.utf8"
    LC_MESSAGES="fr_FR.utf8"
    LC_PAPER="fr_FR.utf8"
    LC_NAME="fr_FR.utf8"
    LC_ADDRESS="fr_FR.utf8"
    LC_TELEPHONE="fr_FR.utf8"
    LC_MEASUREMENT="fr_FR.utf8"
    LC_IDENTIFICATION="fr_FR.utf8"
    LC_ALL
    
  2. Creating a file .dmrc

    Creating this file does not work (I still have the menu in Xfce in French)

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

4 Answers 4

6

The OP does not indicate if they need to change the system language, or the user language.

Assuming it's the user language which you want to change, @markusN answer is the way to go: setting environment variables, only for the user logging in, leaving the system and other users unaffected.

export LANGUAGE=en_US.utf8
export LANG=en_US.utf8
export LC_ALL=en_US.utf8

Obviously, you need to first generate the locale you are referring to.

In my case (xfce4.12) this solution was not enough: apparently the script ~/.i18n was not being executed as part of the xfce startup sequence.

Make sure you are writing these instructions somewhere more appropriate, and it will work. For example, assuming you have already written them in ~/.i18n, you could write this ~/.config/xfce4/xinitrc file too:

#!/bin/sh
if [ -f "$HOME/.i18n" ]; then
    . "$HOME/.i18n"
fi
. /etc/xdg/xfce4/xinitrc

It works for me, on Debian-10.

1
  • This is the answer that worked for me, too, on Debian 10 Buster. The trick is to have the .i18n file and the xinitrc file. Commented May 25, 2021 at 2:31
4

You can change the language by generating a file ".i18n" in your HOME directory. Either use a text editor for this with the following content:

export LANGUAGE=en_US.utf8
export LANG=en_US.utf8
export LC_ALL=en_US.utf8

...or simply run this command in a terminal which generates the file as well:

echo "export LANGUAGE=en_US.utf8
export LANG=en_US.utf8
export LC_ALL=en_US.utf8" > $HOME/.i18n

Then logout and login.

EDIT 2021:

See the additional "xinitrc" trick as per @mariotomo answer below.

6
  • 1
    this still didn't work for me.
    – Meetai.com
    Commented Mar 11, 2015 at 1:17
  • 1
    @Meetai.com Me neither. Try running sudo update-locale LC_ALL=en_US.UTF-8 Make sure that whatever locale you pick is spelled the same as in /etc/locale.gen.
    – Eyal
    Commented Dec 5, 2017 at 9:52
  • -1, since it does not work. Added a complete answer
    – Alex
    Commented Apr 17, 2018 at 19:12
  • In your answer you modify the system, this is not a recommended practice
    – markusN
    Commented Apr 20, 2018 at 11:59
  • Fails: must also have the xinitrc as per @mariotomo answer below. Commented May 25, 2021 at 2:35
4

Standard:

sudo dpkg-reconfigure locales 

Doing it step by step manually:

sudo nano /etc/locale.gen (uncomment the one you want)
sudo locale-gen
sudo update-locale LC_ALL=en_US.UTF-8

Afterward logout and login.

Tested manual way with debian stretch / xfce.

The full documentation about changing locales in debian can be found in the debian Wiki.

2
  • Looks like a bad idea to modify the system files
    – markusN
    Commented Apr 20, 2018 at 11:58
  • No, it is not. That's what debian suggests to do in the debain wiki: wiki.debian.org/Locale#Manually
    – Alex
    Commented Apr 21, 2018 at 20:09
0

In the Debian documentation I found that the default locale was defined in /etc/default/locale, so if you have root access and you are not searching for a way to set a locale per user, I think this is the easiest way...

2
  • No, it's not the easiest way and /etc/default/locale shouldn't be modified by hand.
    – ppr
    Commented Aug 20, 2015 at 16:30
  • @ppr: or running something like update-locale LANG=en_DK.UTF-8 LANGUAGE=en_DK:en as a super user?
    – boumbh
    Commented Aug 21, 2015 at 9:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .