Questo capitolo copre tutto quanto viene normalmente considerato con «configurazione di base»: rete, lingue e localizzazioni, utenti e gruppi, stampa, punti di mount, ecc.
8.1. Configurare il sistema per un'altra lingua
Se il sistema è stato installato inizialmente in italiano, la macchina avrà già probabilmente l'italiano come lingue predefinita. È comunque meglio conoscere cosa l'installatore fa per impostare la lingua, cosicché, poi, se ne capita la necessità, la si possa cambiare.
8.1.1. Impostare la lingua predefinita
A locale is a group of regional settings. This includes not only the language for text, but also the format for displaying numbers, dates, times, and monetary sums, as well as the alphabetical comparison rules (to properly account for accented characters). Although each of these parameters can be specified independently from the others, we generally use a locale, which is a coherent set of values for these parameters corresponding to a “region” in the broadest sense. These locales are usually indicated under the form, language-code_COUNTRY-CODE
, sometimes with a suffix to specify the character set and encoding to be used. This enables consideration of idiomatic or typographical differences between different regions with a common language.
The locales package includes all the elements required for proper functioning of “localization” of various applications. During installation, this package will ask to select a set of supported languages. This set can be changed at any time by running dpkg-reconfigure locales
as root.
The first question invites you to select “locales” to support. Selecting all English locales (meaning those beginning with “en_
”) is a reasonable choice. Do not hesitate to also enable other locales if the machine will host foreign users. The list of locales enabled on the system is stored in the /etc/locale.gen
file. It is possible to edit this file by hand, but you should run locale-gen
after any modifications. It will generate the necessary files for the added locales to work, and remove any obsolete files.
The second question, entitled “Default locale for the system environment”, requests a default locale. The recommended choice in the U.S.A. is “en_US.UTF-8
”. British English speakers will prefer “en_GB.UTF-8
”, and Canadians will prefer either “en_CA.UTF-8
” or, for French, “fr_CA.UTF-8
”. The /etc/default/locale
file will then be modified to store this choice. From there, it is picked up by all user sessions since PAM will inject its content in the LANG
environment variable.
8.1.2. Configurare la tastiera
Even if the keyboard layout is managed differently in console and graphical mode, Debian offers a single configuration interface that works for both: it is based on debconf and is implemented in the keyboard-configuration package. Thus the dpkg-reconfigure keyboard-configuration
command can be used at any time to reset the keyboard layout.
The questions are relevant to the physical keyboard layout (a standard PC keyboard in the US will be a “Generic 104 key”), then the layout to choose (generally “US”), and then the position of the AltGr key (right Alt). Finally comes the question of the key to use for the “Compose key”, which allows for entering special characters by combining keystrokes. Type successively
Compose ' e and produce an e-acute (“é”). All these combinations are described in the
/usr/share/X11/locale/en_US.UTF-8/Compose
file (or another file, determined according to the current locale indicated by
/usr/share/X11/locale/compose.dir
).
Si noti che la configurazione della tastiera per la modalità grafica descritta qui interessa unicamente la diposizione predefinita: gli ambienti GNOME e KDE, così come altri, forniscono un pannello di controllo della tastiera tra le proprie preferenze consentendo ad ogni utente di avere la propria configurazione. Alcune opzioni aggiuntive riguardanti il comportamento di alcuni tasti particolari sono inoltre disponibili in questi pannelli di controllo.
La generalizzazione della codifica UTF-8 è stata una soluzione attesa a lungo per le numerose difficoltà con l'interoperabilità, poiché facilita lo scambio internazionale e rimuove i limiti arbitrari sui caratteri che possono essere utilizzati in un documento. L'unica controindicazione è che si è dovuta attraversare una fase di difficile transizione. Poiché non ha potuto essere completamente trasparente (cioè, non è potuta avvenire contemporaneamente in tutto il mondo), due operazioni di conversione sono state necessarie: una sul contenuto dei file e l'altra sul loro nome. Fortunatamente la maggior parte di questa migrazione è stata completata e ne discuteremo più ampiamente per riferimento.
Per ciò che riguarda i nomi dei file la migrazione può essere relativamente semplice. Lo strumento convmv
(contenuto nell'omonimo pacchetto) è stato creato specificatamente a questo scopo: permette di rinominare i file da una codifica ad un'altra. L'uso di questo strumento è relativamente semplice, ma raccomandiamo di farlo in due fasi per evitare sorprese. L'esempio seguente illustra un ambiente UTF-8 che contiene nomi di directory codificati in ISO-8859-15 e l'uso del comando convmv
per rinominarli.
$
ls travail/
Ic?nes ?l?ments graphiques Textes
$
convmv -r -f iso-8859-15 -t utf-8 travail/
Starting a dry run without changes...
mv "travail/�l�ments graphiques" "travail/Éléments graphiques"
mv "travail/Ic�nes" "travail/Icônes"
No changes to your files done. Use --notest to finally rename the files.
$
convmv -r --notest -f iso-8859-15 -t utf-8 travail/
mv "travail/�l�ments graphiques" "travail/Éléments graphiques"
mv "travail/Ic�nes" "travail/Icônes"
Ready!
$
ls travail/
Éléments graphiques Icônes Textes
For the file content, conversion procedures are more complex due to the vast variety of existing file formats. Some file formats include encoding information that facilitates the tasks of the software used to treat them; it is sufficient, then, to open these files and re-save them specifying UTF-8 encoding. In other cases, you have to specify the original encoding (ISO-8859-1 or “Western”, or ISO-8859-15 or “Western (Euro)”, according to the formulations) when opening the file.
Per file di testo semplice è possibile usare recode
(contenuto nell'omonimo pacchetto) che consente la ricodifica automatica. Questo strumento ha numerose opzioni che è possibile specificare per modificare il suo comportamento. Noi raccomandiamo di consultare la documentazione, la pagina di manuale recode(1), oppure la pagina di info recode (più completa).