How to set all locale settings in Ubuntu

75,472

Solution 1

You can set locale manually using update-locale:

sudo update-locale LANG=de_DE.UTF-8 LC_MESSAGES=POSIX

Read the man page for more information.

Alternatively, you can manually change your system's locale entries by modifying the file /etc/default/locale.

For example on a German system, to prevent system messages from being translated, you may use:

LANG=de_DE.UTF-8
LC_MESSAGES=POSIX

Note: changes take effect only after a fresh login.

Source: https://help.ubuntu.com/community/Locale

Solution 2

There are some recommendations when configuring locales in remote machines

1) In Debian machines (remote machine), run the command (as root):

dpkg-reconfigure locales

On the first screen, select the desired locales. After that you will be prompted to choose which is the default locale. Select "none" (reference: https://wiki.debian.org/Locale#Standard ).

2) Configure your ssh service (/etc/ssh/sshd_config) to accept environment variables from the client: uncomment the line:

AcceptEnv LANG LC_*

Restart you ssh server, logoff and log back in and run the locale command. It must match your local machine's locale

Share:
75,472

Related videos on Youtube

d0x
Author by

d0x

#SOreadytohelp :D

Updated on September 18, 2022

Comments

  • d0x
    d0x almost 2 years

    A remote installed application has some encoding problems and on my local machine it is running fine.

    What is the best way to "copy" my locales to the remote machine?

    The locales on my personal machine are configured like this:

    $ locale
    LANG=de_DE.UTF-8
    LANGUAGE=de_DE:en
    LC_CTYPE="de_DE.UTF-8"
    LC_NUMERIC=en_US.UTF-8
    LC_TIME=en_US.UTF-8
    LC_COLLATE="de_DE.UTF-8"
    LC_MONETARY=en_US.UTF-8
    LC_MESSAGES="de_DE.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=
    
    • Admin
      Admin almost 12 years
      a user-specific locale (for one user) or generally for the whole system?
  • macrobook
    macrobook almost 12 years
    I think update-locale needs sudo. Personally I like your alternative solution, maybe you should make it a primary one. :)
  • green
    green almost 12 years
    updated it!! :)
  • Admin
    Admin almost 12 years
    (a) "Copy to desired profile" -- does this mean to move the file to the home of the user (b) Is this a permanent solution?
  • green
    green over 11 years
    Run the following command: sudo dpkg-reconfigure locales.
  • Sopalajo de Arrierez
    Sopalajo de Arrierez over 9 years
    You said "On the first screen, select the desired locales", but I have tested on Ubuntu V14.04.2LTS and all the process is done automatically (Generating locales... ... and later Generation complete.) I get no selection screen.
  • Admin
    Admin almost 7 years
    And what would have been the shell script to write the import on each line ?
  • Admin
    Admin almost 7 years
    Didn't work for me. I tried to do it from my computer to another ssh.
  • Girol
    Girol over 6 years
    @SopalajodeArrierez did you solve that?
  • Sopalajo de Arrierez
    Sopalajo de Arrierez over 6 years
    Well, as for today, I am using v16.04 and, indeed, the "first screen" exists and I can select the desired locales. Maybe it was just a problem with v14.
  • Girol
    Girol over 6 years
    Nice! Sorry about my huge delay. I didn't know how to use this tool that time and forgot about my account since then. Best regards.
  • Loenix
    Loenix almost 4 years
    @green I have the same issue and dpkg-reconfigure locales seems not setting local in /etc/default/locale. is there a way to apply update-locale for all ?