This chapter reviews everything included in what we could call the “basic configuration”: networking, language and locales, users and groups, printing, mount points, etc.
8.1. Configuring the System for Another Language
If the system was installed using French, the machine will probably already have French set as the default language. But it is good to know what the installer does to set the language, so that later, if the need arises, you can change it.
8.1.1. Setting the Default Language
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_US
”) is a reasonable choice. Do not hesitate to choose 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's picked up by all user sessions since PAM will inject its content in the LANG
environment variable.
8.1.2. Configuring the Keyboard
Even if the keyboard layout is managed differently in console and graphical mode, Debian offers a single configuration interface that works for both: it's 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
).
Note that the keyboard configuration for graphical mode described here only affects the default layout; the GNOME and KDE environments, among others, provide a keyboard control panel in their preferences allowing each user to have their own configuration. Some additional options regarding the behavior of some particular keys are also available in these control panels.
8.1.3. Migrating to UTF-8
The generalization of UTF-8 encoding has been a long awaited solution to numerous difficulties with interoperability, since it facilitates international exchange and removes the arbitrary limits on characters that can be used in a document. The one drawback is that it had to go through a rather difficult transition phase. Since it could not be completely transparent (that is, it could not happen at the same time all over the world), two conversion operations were required: one on file contents, and the other on filenames. Fortunately, the bulk of this migration has been completed and we discuss it largely for reference.
As far as file names are concerned, the migration can be relatively simple. The convmv
tool (in the package with the same name) was created specifically for this purpose; it allows renaming files from one encoding to another. The use of this tool is relatively simple, but we recommend doing it in two steps to avoid surprises. The following example illustrates a UTF-8 environment containing directory names encoded in ISO-8859-15, and the use of convmv
to rename them.
$
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.
For simple text files, you can use recode
(in the package of the same name) which allows automatic recoding. This tool has numerous options so you can play with its behavior. We recommend you consult the documentation, the recode(1) man page, or the recode info page (more complete).