Sitemap
Ajgutierrez

Ajgutierrez

Dr. Alfredo de Jesús Gutiérrez Gómez has experience in the implementation of technologies across various fields and a professor and researcher.

Locale

3 min readOct 4, 2024

--

Press enter or click to view image in full size
Photo by Enrique Abundez on Unsplash

The locale command allows the creation of regional and linguistic configurations on the O.S. It uses parameters that handle data related to dates, numbers, currency, and text. That is, the locale adapts how the system and applications display on the user's screen, according to the specific language or region.

Aspect principal of locale

The locale command is divided into many categories that cover different aspects of localization, including:

  • lang: Defines the general location of the system. This is the main value that affects all the configurations; if not specified, it takes the form of individuality.
  • lc_type: Defines the behavior of the classification of characters and how special characters are managed. It is important for determining how the interpreter handles uppercase and lowercase letters, as well as the UTF-8 encoding.
  • lc_numeric:This controls the format of the number, including how the decimal and thousands separators are displayed.
  • lc_time: Affects how dates and times are displayed, including the format of hours (24-hour vs. 12-hour), the presentation of the current week, months, and others.
  • lc_collate:Defines the rules of ordering and comparison of text strings, as well as how data is ordered in alphabetical lists.
  • lc_monetary:Defines the format in which money is displayed, including the currency symbol, the decimal separator, and the placement of the currency symbol in relation to the numeric value.
  • lc_ messages: Affects the language in which the system and application messages are displayed, such as error messages.
  • lc_paper, lc_name, lc_address, lc_telephone, lc_measurement, lc_identification: This category is responsible for more specific details, such as the default paper type, the representation of names and addresses, the format of telephone numbers, the units of measurement (metric, imperial), and other identification data.
  • lc_all: This is the value that is applied to all configurations afterwards. If LC_ALL is enabled, it takes priority over other variables like LC_* and LANG.

Configurations

Regularly, this configuration is done using a terminal with the commands described below.

  1. To install the package, use the following instruction: sudo dnf install glibc-langpack-es. This installs support for UTF-8.
  2. Now, create the locale using the command sudo nano /etc/locale.conf. Inside this file, add the following lines
LANG=es_ES.UTF-8
LC_ALL=es_ES.UTF-8

3. After saving the changes in the file locale.conf, it’s time to set the type. of configuration. To do this, execute the command: sudo localectl set-locale LANG=es_ES.UTF-8.

Get Ajgutierrez’s stories in your inbox

Join Medium for free to get updates from this writer.

4. Don’t forget to verify the configuration. To do this, execute the following command: localectl list-locales | grep es_ES.UTF-8.

5. Reboot the operating system with the command sudo reboot.

6. Verify the configuration that command locale.

Mistakes

The errors that usually appear or indicate that the locale is not configured or installed are the following:

  • Failed to issue method call: Locale es_ES.UTF-8 not installed, refusing.
  • locale: Cannot set LC_CTYPE to default locale: No such file or directory.
  • locale: Cannot set LC_MESSAGES to default locale: No such file or directory.
  • locale: Cannot set LC_ALL to default locale: No such file or directory.

Learning

Usually, when you are provided with development or production servers, one does not tend to worry about language settings because they come pre-configured. However, various techniques can be used to display Spanish accentuation correctly, such as using meta tags in HTML or functions that allow you to take care of such aspects within the programming language.

version in Spanish here

--

--

Written by Ajgutierrez

Dr. Alfredo de Jesús Gutiérrez Gómez has experience in the implementation of technologies across various fields and a professor and researcher.