10

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
    
5

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.

4
  • 1
    this still didn't work for me. – Meetai.com Mar 11 '15 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 Dec 5 '17 at 9:52
  • -1, since it does not work. Added a complete answer – Alex Apr 17 '18 at 19:12
  • In your answer you modify the system, this is not a recommended practice – markusN Apr 20 '18 at 11:59
3

Standard:

  1. sudo dpkg-reconfigure locales

Manually:

  1. sudo nano /etc/locale.gen (uncomment the one you want)
  2. sudo locale-gen
  3. sudo update-locale LC_ALL=en_US.UTF-8
  4. 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 Apr 20 '18 at 11:58
  • No, it is not. That's what debian suggests to do in the debain wiki: wiki.debian.org/Locale#Manually – Alex Apr 21 '18 at 20:09
1

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.

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 Aug 20 '15 at 16:30
  • @ppr: or running something like update-locale LANG=en_DK.UTF-8 LANGUAGE=en_DK:en as a super user? – boumbh Aug 21 '15 at 9:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.