Managing Locale Settings

Managing Locale Settings

A locale is a collection of language and cultural rules used by an operating system and its applications. It controls settings such as message language, character encoding, and lexicographic conventions.

Platform-managed templates use English locale preferences by default. The following workflow shows how to review the current locale configuration and add support for another language inside a container.

View Available Locales

1Connect to the container

Open Web SSH or another supported shell connection to the required container.

Run the following command to display the locales currently available on the container:

locale -a
Default locale settings in a container
Review the locale settings available by default.

Generate a New Locale

Use the localedef utility to add support for another language and character encoding:

sudo localedef -i {language}_{country} -f {codeset} {language}_{country}.{codeset}
Generate a new locale with localedef
Use localedef to generate the required language and encoding combination.

Locale Command Parameters

  • {language}_{country} specifies the language and country codes.
  • {codeset} defines the character-encoding identifier, such as UTF-8.

To review the locale definitions that can be generated, run:

ls /usr/share/i18n/locales
Choose a language and country definition that exists in /usr/share/i18n/locales, and use a compatible character encoding.

Verify the New Locale

Run the locale-list command again:

locale -a
Verify the newly generated locale
The newly generated locale appears in the list and is available to applications.
Application usage: Generating a locale makes it available inside the container. Individual applications may still require their own language or locale configuration.

What’s next?