Bab 8. I18N dan L10N

Daftar Isi

8.1. Lokal
8.1.1. Alasan untuk lokal UTF-8
8.1.2. Konfigurasi ulang lokal
8.1.3. Pengodean nama berkas
8.1.4. Pesan terlokalkan dan dokumentasi yang diterjemahkan
8.1.5. Efek dari lokal
8.2. Masukan papan ketik
8.2.1. Masukan papan ketik untuk konsol Linux dan X Window
8.2.2. Masukan papan ketik untuk Wayland
8.2.3. Dukungan metode masukan dengan IBus
8.2.4. Contoh untuk bahasa Jepang
8.3. Keluaran tampilan
8.4. Karakter Lebar Karakter Ambigu Asia Timur

Multilingualization (M17N) or Native Language Support for an application software is done in 2 steps.

[Tip] Tip

There are 17, 18, or 10 letters between "m" and "n", "i" and "n", or "l" and "n" in multilingualization, internationalization, and localization which correspond to M17N, I18N, and L10N. See Introduction to i18n for details.

The behavior of programs supporting internationalization are configured by the environment variable "$LANG" to support localization. Actual support of locale dependent features by the libc library requires to install locales or locales-all packages. The locales package requires to be initialized properly.

If neither locales or locales-all package are installed, support of locale features are lost and system uses US English messages and handles data as ASCII. This behavior is the same way as "$LANG" is set by "LANG=", "LANG=C", or "LANG=POSIX".

The modern software such as GNOME and KDE are multilingualized. They are internationalized by making them handle UTF-8 data and localized by providing their translated messages through the gettext(1) infrastructure. Translated messages may be provided as separate localization packages.

The current Debian desktop GUI system normally sets the locale under GUI environment as "LANG=xx_YY.UTF-8". Here, "xx" is ISO 639 language codes and "YY" is ISO 3166 country codes. These values are set by the desktop configuration GUI dialogue and change the program behavior. See Bagian 1.5.2, “Variabel "$LANG"”

The simplest representation of the text data is ASCII which is sufficient for English and uses less than 127 characters (representable with 7 bits).

Even plain English text may contain non-ASCII characters, e.g. slightly curly left and right quotation marks are not available in ASCII.

“double quoted text” is not "double quoted ASCII"
‘single quoted text’ is not 'single quoted ASCII'

In order to support more characters, many character sets and encoding systems have been used to support many languages (see Tabel 11.2, “Daftar nilai pengodean dan penggunaannya”).

Unicode character set can represent practically all characters known to human with 21 bit code point range (i.e., 0 to 10FFFF in hexadecimal notation).

Text encoding system UTF-8 fits Unicode code points into a sensible 8 bit data stream mostly compatible with the ASCII data processing system. This makes UTF-8 the modern preferred choice. UTF stands for Unicode Transformation Format. When ASCII plain text data is converted to UTF-8 one, it has exactly the same content and size as the original ASCII one. So you loose nothing by deploying UTF-8 locale.

Under UTF-8 locale with the compatible application program, you can display and edit any foreign language text data as long as required fonts and input methods are installed and enabled. For example under "LANG=fr_FR.UTF-8" locale, gedit(1) (text editor for the GNOME Desktop) can display and edit Chinese character text data while presenting menus in French.

[Tip] Tip

Both the new standard "en_US.UTF-8" locale and the old standard "C"/"POSIX" locale use the standard US English message, they have subtle differences in sorting order etc. If you want to handle not only ASCII characters but also handle all UTF-8 encoded characters gracefully while maintaining the old "C" local behavior, use the non-standard "C.UTF-8" locale on Debian.

[Catatan] Catatan

Some programs consume more memory after supporting I18N. This is because they are coded to use UTF-32(UCS4) internally to support Unicode for speed optimization and consume 4 bytes per each ASCII character data independent of locale selected. Again, you loose nothing by deploying UTF-8 locale.

In order for the system to access a particular locale, the locale data must be compiled from the locale database.

The locales package does not come with pre-compiled locale data. You need to configure it as:

# dpkg-reconfigure locales

Proses ini melibatkan 2 langkah.

The system wide default locale value set in "/etc/default/locale" may be overridden by the GUI configuration for GUI applications.

[Catatan] Catatan

Actual traditional encoding system can be identified by "/usr/share/i18n/SUPPORTED". Thus, the "LANG=en_US" is "LANG=en_US.ISO-8859-1".

The locales-all package comes with all locale data pre-compiled but doesn't creating "/etc/default/locale".

For cross platform data exchanges (see Bagian 10.1.7, “Perangkat penyimpanan lepasan”), you may need to mount some filesystem with particular encodings. For example, mount(8) for vfat filesystem assumes CP437 if used without option. You need to provide explicit mount option to use UTF-8 or CP932 for filenames.

[Catatan] Catatan

When auto-mounting a hot-pluggable USB memory stick under modern desktop environment such as GNOME, you may provide such mount option by right clicking the icon on the desktop, click "Drive" tab, click to expand "Setting", and entering "utf8" to "Mount options:". The next time this memory stick is mounted, mount with UTF-8 is enabled.

[Catatan] Catatan

If you are upgrading system or moving disk drives from older non-UTF-8 system, file names with non-ASCII characters may be encoded in the historic and deprecated encodings such as ISO-8859-1 or eucJP. Please seek help of text conversion tools to convert them to UTF-8. See Bagian 11.1, “Alat konversi data teks”.

Samba uses Unicode for newer clients (Windows NT, 200x, XP) but uses CP850 for older clients (DOS and Windows 9x/Me) as default. This default for older clients can be changed using "dos charset" in the "/etc/samba/smb.conf" file, e.g., to CP932 for Japanese.

Translations exist for many of the text messages and documents that are displayed in the Debian system, such as error messages, standard program output, menus, and manual pages. GNU gettext(1) command tool chain is used as the backend tool for most translation activities.

Di bawah "Tugas" → "Pelokalan" aptitude(8) menyediakan daftar panjang paket biner yang berguna yang menambahkan pesan terlokalkan ke aplikasi dan menyediakan dokumentasi yang diterjemahkan.

For example, you can obtain the localized message for manpage by installing the manpages-LANG package. To read the Italian-language manpage for programname from "/usr/share/man/it/", execute as the following.

LANG=it_IT.UTF-8 man programname

GNU gettext can accommodate priority list of translation languages with $LANGUAGE environment variable. For example:

 $ export LANGUAGE="pt:pt_BR:es:it:fr"

For more, see info gettext and read the section "The LANGUAGE variable".

The sort order of characters with sort(1) is affected by the language choice of the locale. Spanish and English locale sort differently.

The date format of ls(1) is affected by the locale. The date format of "LANG=C ls -l" and "LANG=en_US.UTF-8" are different (see Bagian 9.3.4, “Customized display of time and date”).

Number punctuation are different for locales. For example, in English locale, one thousand one point one is displayed as "1,000.1" while in German locale, it is displayed as "1.000,1". You may see this difference in spreadsheet program.

Each detail feature of "$LANG" environment variable may be overridden by setting "$LC_*" variables. These environment variables can be overridden again by setting "$LC_ALL" variable. See locale(7) manpage for the details. Unless you have strong reason to create complicated configuration, please stay away from them and use only "$LANG" variable set to one of the UTF-8 locales.

For GNOME on Wayland desktop system, Bagian 8.2.1, “Masukan papan ketik untuk konsol Linux dan X Window” can't support non-English European languages. IBus was made to support not only Asian languages but also European languages. The package dependency of GNOME Desktop Environment recommends "ibus" via "gnome-shell". The code of "ibus" has been updated to integrate setxkbmap and XKB option functionalities. You need to configure ibus from "GNOME Settings" or "GNOME Tweaks" for the multilingualized keyboard input.

[Catatan] Catatan

If ibus is active, your classic X keyboard configuration by the setxkbmap may be overridden by ibus even under classic X-based desktop environment. You can disable installed ibus using im-config to set input method to "None". For more, see Debian Wiki on keyboard.

Konsol Linux hanya dapat menampilkan karakter terbatas. (Anda perlu menggunakan program terminal khusus seperti jfbterm(1) untuk menampilkan bahasa non-Eropa pada konsol non-GUI.)

Lingkungan GUI (Bab 7, Sistem GUI) dapat menampilkan karakter apa pun di UTF-8 selama fonta yang diperlukan terpasang dan diaktifkan. (Pengodean data fonta asli diurus dan transparan kepada pengguna.)

Di bawah lokal Asia Timur, gambar kotak, karakter Yunani, dan Sirilik dapat ditampilkan lebih lebar dari lebar yang Anda inginkan untuk menyebabkan keluaran terminal yang tidak selaras (lihat Unicode Standard Annex # 11).

Anda dapat mengatasi masalah ini:

  • gnome-terminal: Preferensi → Profil → Nama profil → Kompatibilitas → Karakter lebar-ambigu → Sempit

  • ncurses: Atur lingkungan export NCURSES_NO_UTF8_ACS=0.