Noninteractively configure system locales.

Inspect file used to define generated locales.

$ cat /etc/locale.gen
# This file lists locales that you wish to have built. You can find a list
# of valid supported locales at /usr/share/i18n/SUPPORTED, and you can add
# user defined locales to /usr/local/share/i18n/SUPPORTED. If you change
# this file, you need to rerun locale-gen.


# aa_DJ ISO-8859-1
# aa_DJ.UTF-8 UTF-8
# aa_ER UTF-8
# aa_ER@saaho UTF-8
# aa_ET UTF-8
[...]
# en_SC.UTF-8 UTF-8
# en_SG ISO-8859-1
# en_SG.UTF-8 UTF-8
# en_US ISO-8859-1
# en_US.ISO-8859-15 ISO-8859-15
en_US.UTF-8 UTF-8
# en_ZA ISO-8859-1
# en_ZA.UTF-8 UTF-8
# en_ZM UTF-8
# en_ZW ISO-8859-1
# en_ZW.UTF-8 UTF-8
[...]
# zh_TW BIG5
# zh_TW.EUC-TW EUC-TW
# zh_TW.UTF-8 UTF-8
# zu_ZA ISO-8859-1
# zu_ZA.UTF-8 UTF-8

List locales that will be generated.

$ grep ^[a-z] /etc/locale.gen 
en_US.UTF-8 UTF-8

Update this file to include every locale you want to use.

$ grep ^[a-z] /etc/locale.gen 
de_DE.UTF-8 UTF-8
pl_PL.UTF-8 UTF-8
en_US.UTF-8 UTF-8

Noninteractively generate locales (alternatively execute locale-gen directly).

$ sudo dpkg-reconfigure --frontend=noninteractive locales
Generating locales (this might take a while)...
  de_DE.UTF-8... done
  en_US.UTF-8... done
  pl_PL.UTF-8... done
Generation complete.

Inspect current local settings.

$ locale
LANG=en_US.UTF-8
LANGUAGE=en_US:en
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=

Inspect default locale settings.

$ cat /etc/default/locale 
#  File generated by update-locale
LANG=en_US.UTF-8
LANGUAGE="en_US:en"

Update this file to globally reflect your choice.

$ cat  /etc/default/locale 
#  File generated by update-locale
LANG=de_DE.UTF-8
LANGUAGE="de_DE:de"

Users can always override these settings.

$ echo "export LC_TIME=pl_PL.UTF-8" | tee -a ~/.profile

Next time you log into the terminal you will get the desired configuration.

$ locale
LANG=de_DE.UTF-8
LANGUAGE=de_DE:de
LC_CTYPE="de_DE.UTF-8"
LC_NUMERIC="de_DE.UTF-8"
LC_TIME=pl_PL.UTF-8
LC_COLLATE="de_DE.UTF-8"
LC_MONETARY="de_DE.UTF-8"
LC_MESSAGES="de_DE.UTF-8"
LC_PAPER="de_DE.UTF-8"
LC_NAME="de_DE.UTF-8"
LC_ADDRESS="de_DE.UTF-8"
LC_TELEPHONE="de_DE.UTF-8"
LC_MEASUREMENT="de_DE.UTF-8"
LC_IDENTIFICATION="de_DE.UTF-8"
LC_ALL=

Display a list of all available locales.

$ locale -a
C
C.UTF-8
de_DE.utf8
en_US.utf8
pl_PL.utf8
POSIX

Done.