Jump to content

Localization: Difference between revisions

From postmarketOS Wiki
 
Roboe (talk | contribs)
Add localectl instructions
 
(6 intermediate revisions by 6 users not shown)
Line 17: Line 17:
From now software, that has the translations files will use selected language.
From now software, that has the translations files will use selected language.


== With systemd ==
<code>localectl</code> may be used to query and change the system locale and keyboard layout settings. It allows to modify the <code>/etc/locale.conf</code> and <code>/etc/vconsole.conf</code> files.
To inspect current settings:
<syntaxhighlight lang="shell-session">
$ sudo localectl status
</syntaxhighlight>
To set up, e.g. Spanish (Spain), locale:
<syntaxhighlight lang="shell-session">
$ sudo localectl set-locale es_ES.UTF-8
</syntaxhighlight>
To set the system keyboard mapping to Spanish:
<syntaxhighlight lang="shell-session">
$ sudo localectl list-keymaps | grep ^es
$ sudo localectl set-keymap es
</syntaxhighlight>
Notably, the later sets the keyboard mapping used before login, i.e. in the display manager, on laptops or convertibles.


== Languages packages ==
== Languages packages ==
Line 22: Line 46:
In Alpine Linux, translations for applications are shipped in a separate package with -lang at the end of their name. Usually, it can be easily found by <code> $ apk list ''packagename''-lang </code> or <code> $ apk list ''packagename''-lang-* </code>, if each language ships in separate package (like libreoffice).
In Alpine Linux, translations for applications are shipped in a separate package with -lang at the end of their name. Usually, it can be easily found by <code> $ apk list ''packagename''-lang </code> or <code> $ apk list ''packagename''-lang-* </code>, if each language ships in separate package (like libreoffice).


The list below contains useful information about some language packages.
It's possible to automatically install <code>-lang</code> subpackages for installed software by installing <code>lang</code> metapackage: <code> $ apk add lang </code>
 
=== MATE ===


Run <code> # apk add $(apk list mate-*-lang | grep -o "^[A-Za-z\-]*" | rev | cut -c 2- | rev) && apk add caja-lang </code>. This will find and install all necessarry packages automaticly. All applets (network-manager, etc.) also needs their lang packages.
[[Category:Guide]]

Latest revision as of 12:35, 28 June 2025

This article explains how to set up language and locale for the entire system and apps in particular.

Locale

Locale names are typically of the form language[_territory][.codeset][@modifier] , where language is an ISO 639 language code, territory is an ISO 3166 country code, and codeset is a character set or encoding identifier like ISO-8859-1 or UTF-8.

To set up your locale you need to change LANG and LC_COLLATE in /etc/profile.d/locale.sh file.

Config for Russian language, for example:

/etc/profile.d/locale.sh
export CHARSET=UTF-8
export LANG=ru_RU.UTF-8
export LC_COLLATE=ru_RU

From now software, that has the translations files will use selected language.

With systemd

localectl may be used to query and change the system locale and keyboard layout settings. It allows to modify the /etc/locale.conf and /etc/vconsole.conf files.

To inspect current settings:

$ sudo localectl status

To set up, e.g. Spanish (Spain), locale:

$ sudo localectl set-locale es_ES.UTF-8

To set the system keyboard mapping to Spanish:

$ sudo localectl list-keymaps | grep ^es
$ sudo localectl set-keymap es

Notably, the later sets the keyboard mapping used before login, i.e. in the display manager, on laptops or convertibles.

Languages packages

In Alpine Linux, translations for applications are shipped in a separate package with -lang at the end of their name. Usually, it can be easily found by $ apk list packagename-lang or $ apk list packagename-lang-* , if each language ships in separate package (like libreoffice).

It's possible to automatically install -lang subpackages for installed software by installing lang metapackage: $ apk add lang