54 lines
1.7 KiB
Plaintext
54 lines
1.7 KiB
Plaintext
|
====== Setting default locale ======
|
|||
|
{{ :dummy.png?75x75|Nom de la section}}
|
|||
|
|
|||
|
Dans un Terminal Linux sous Raspberry Pi OS, lorsque j’exécute une commande ''apt update'' par exemple, le message suivant apparaît :
|
|||
|
<code>
|
|||
|
perl: warning: Setting locale failed.
|
|||
|
perl: warning: Please check that your locale settings:
|
|||
|
LANGUAGE = (unset),
|
|||
|
LC_ALL = (unset),
|
|||
|
LC_CTYPE = "fr_FR.UTF-8",
|
|||
|
LANG = "en_GB.UTF-8"
|
|||
|
are supported and installed on your system.
|
|||
|
perl: warning: Falling back to a fallback locale ("en_GB.UTF-8").
|
|||
|
locale: Cannot set LC_CTYPE to default locale: No such file or directory
|
|||
|
locale: Cannot set LC_ALL to default locale: No such file or directory
|
|||
|
</code>
|
|||
|
|
|||
|
Cela signifie que les locales ne sont pas renseignées correctement.
|
|||
|
|
|||
|
On peut vérifier les locales actives avec la commande ''localectl list-locales''
|
|||
|
|
|||
|
Imaginons que nous voulions activer la locale ''fr_FR.UTF-8''.
|
|||
|
|
|||
|
1. Dé-commenter la ligne dans le fichier ''/etc/locale.gen''
|
|||
|
|
|||
|
sudo sed -i 's/^# *\(fr_FR.UTF-8\)/\1/' /etc/locale.gen
|
|||
|
|
|||
|
2. Exécuter la commande ''locale-gen'' pour générer les fichiers
|
|||
|
|
|||
|
sudo locale-gen
|
|||
|
|
|||
|
3. La commande ''update-locale'' modifie le fichier''/etc/default/locale'' afin de définir correctement les variables pour tous les comptes Linux.
|
|||
|
|
|||
|
sudo update-locale LANG=fr_FR.UTF-8 LANGUAGE=fr_FR.UTF-8 LC_ALL=fr_FR.UTF-8
|
|||
|
|
|||
|
4. Redémarrer et vérifier avec la commande ''locale''
|
|||
|
|
|||
|
<code>
|
|||
|
LANG=fr_FR.UTF-8
|
|||
|
LANGUAGE=fr_FR.UTF-8
|
|||
|
LC_CTYPE="fr_FR.UTF-8"
|
|||
|
LC_NUMERIC="fr_FR.UTF-8"
|
|||
|
LC_TIME="fr_FR.UTF-8"
|
|||
|
LC_COLLATE="fr_FR.UTF-8"
|
|||
|
LC_MONETARY="fr_FR.UTF-8"
|
|||
|
LC_MESSAGES="fr_FR.UTF-8"
|
|||
|
LC_PAPER="fr_FR.UTF-8"
|
|||
|
LC_NAME="fr_FR.UTF-8"
|
|||
|
LC_ADDRESS="fr_FR.UTF-8"
|
|||
|
LC_TELEPHONE="fr_FR.UTF-8"
|
|||
|
LC_MEASUREMENT="fr_FR.UTF-8"
|
|||
|
LC_IDENTIFICATION="fr_FR.UTF-8"
|
|||
|
LC_ALL=fr_FR.UTF-8
|
|||
|
</code>
|