User Tools

Site Tools


locale

If you want to send us your comments, please do so. Thanks
More on comments


Locale

Commands

CommandFunction
locale -aShow the currently activated languages
localeShow the locale settings
dpkg-reconfigure localesAs root Select the languages you need
update-locale
locale-genAs root Generate the locale files from the template
localectl statusShow the locale settings

POSIX locale is equal to C locale is a default locale

File locations

Check if your system uses systemd with whereis systemd

FileRemark
systemd systems: /etc/default/locale
non systemd systems: /etc/locale.confIf the file does not exist create it. After saving the file you are done. You can check the result with localectl status. systemd seems to ignore LC_CTYPE, LC_COLLATE, LC_MESSAGES and LC_ALL
/etc/locale.nopurge

We noticed that systemd might also use /etc/default/locale. To be save put the data in both files. To be investigated
After updating reboot your computer. We have not found a way yet to do the system wide update without rebooting. update-locale does not do it. If you know a way please let us know. Thanks

Example of the locale.conf file

Path: /etc/locale.conf
An example file, contents see below, can be downloaded here

locale.conf
#  File generated by update-locale
LANG="en_US.UTF-8"
LANGUAGE="en_US:en"
 
# To be added by the system administrator:
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="nl_NL.UTF-8"
LC_TIME="nl_NL.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="nl_NL.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="nl_NL.UTF-8"
LC_NAME="nl_NL.UTF-8"
LC_ADDRESS="nl_NL.UTF-8"
LC_TELEPHONE="nl_NL.UTF-8"
LC_MEASUREMENT="nl_NL.UTF-8"
LC_IDENTIFICATION="nl_NL.UTF-8"
#LC_ALL=

If you put one or more, changed, lines in .bashrc those settings will only apply to terminals, not to the GUI

Configuration

  • Log in as root
  • Check the installed locales with
    • Pre systemd: locales -a
    • systemd: localectl status
  • Check the environment variables with locale
  • Run update-locale check if it generates no errors when ran
    • If there are errors copy the extracted locale.conf.gz file to /etc and adapt it to your needs
    • Log out and log in again. If you know a way to install /etc/default/locale (pre systemd: locale.conf) without logging out please let us know. We clould not find it so far. The method described on the Arch Linux pages did not work for us. Thanks.

Solving errors

Grub issues

The locale as set in grub can have influcence. To be investigated.

Libre Office Calc

Calc needs a period where a comma should work in a number =56,78+1 To be solved

UTF-8 and the terminal

When UTF-8 does not work well in a terminal you can replace it with ISO-8859-1 Run

dpkg-reconfigure locales

and select the language of choice. Unselect the UTF-8 variant
Replace UTF-8 with ISO-8859-1 in

/etc/default/locale

Reboot the system
Run

locale-gen
update-locale

The later should give no output, just a new prompt. Then all is well.
Test it with the application which did not display well

Special characters

Localepurge

Saves diskspace by deleting locales in languages not needed and man pages in languages not needed
Inital setup is done with dpkg-reconfigure localepurge

  • Use dpkg --path-exclude? choose No (The default)
    • If Yes is chosen --path-exclude is set to on and localepurge will configure dpkg to exclude the desired locales at unpack time
    • Using --path-exclude can be risky and break your system. See the dpkg man page on --path-exclude and the localepurge man page
  • Based on the same locale information you choose, localepurge can also delete localized man pages.
    • Also delete localized man pages?
      • Choose Yes (The default)
  • Next time, when you run aptitude to remove or install the locales will be purged. In our case it freed about 470MB of hard disk space

Then check the settings in

/etc/locale.nopurge

and make changes as needed. Proposal

#USE_DPKG
MANDELETE
#DONTBOTHERNEWLOCALE
SHOWFREEDSPACE
#QUICKNDIRTYCALC
#VERBOSE
en
en_US.UTF-8
nl
nl_NL.UTF-8

Main subjects on this wiki: Linux, Debian, HTML, Microcontrollers, Privacy

RSS
Disclaimer
Privacy statement
Bugs statement
Cookies
Copyright © : 2014 - 2024 Webevaluation.nl and the authors
Changes reserved.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
locale.txt · Last modified: 05-10-2023 10:22 by wim