How to set all locale settings in Ubuntu

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


The easier way

  1. Export all locales into a file

    locale > import

  2. Open file and add export at the start of each line

  3. Make it executable with the command chmod ugo+rx import

  4. Copy to desired profile and execute ./import


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