Linux Q & A of i18n and l10n Linux Chinese issues

zhaozj2021-02-11  219

Q & A of i18n and l10n

Ideal (2001-05-20 09:54) 〖Back〗 〖转 转

Copyright (C) 2001-2003 Marquis Weng This file is part of "Q & A of I18N and L10N" documentation This documentation is free documentation;. You can redistribute it and / or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;. without even The Implied Warranty of Merchantability Or Fitness for a Particular Purpose. See The gnu general public license for more details. * / q. What is I18N and L10n? A. I18N is an abbreviation of Internationalization, there is 18 letters between the first i and the end N, so it is quite ie I18n; the same reason L10N is an abbreviation of localization (regionalization). Q. OK, I know what I18n and L10n are, but what use is it? My purpose is just that I want my system to support Chinese, and I don't need to talk to me such a big topic? A. This is going to talk from how to support Chinese. Now let the program support Chinese generally three methods: 1. Use an external Chinese system. This method basically only enters and displays Chinese functions, such as UCDOS under DOS; the chineseStar under Windows; GCE and CCE under Linux (Turbolinux, the Unicon is to support Chinese by modifying the kernel, because I don't have I have used this thing, I don't know if it should be classified into an external type); X The following is implemented by ld_preeload, such as Turbo's zhwinPro, by setting the LD_PRELOAD environment variable, put the X Central Plains does not support Chinese display The function is replaced with a function that can be displayed, from which to display Chinese. This method is relatively simple, but the function is limited, only Chinese can only be displayed correctly, and it is still handling a Chinese character as two single-bytes. The most obvious result is often the time when editing. Half Chinese characters appear. And due to LD_PRELOAD limits, programs that cannot be processed and the library do static connection, often cause system unstable, so this method is slowly abandoned. 2. Add Chinese support directly to the program. It is generally obtained by modifying the existing program source code. For example, the currently used CXTERM is currently obtained by modifying the code of XTERM; as the Chinese Academy of Sciences developed the TEX pre-processing software CCT (personal feeling, in Chinese version, CCT is stronger than CJK-TEX).

This method is of course very easy to use, and the program written, even more than the original program. However, regret is that this method is too low, and others' procedures are upgraded once, and the old followed the program. Therefore, in addition to the very few programs, most of the programs, etc., etc. 3. The third is the protagonist I18N L10N of this FAQ. I18n provides an architecture for programming, allowing the same program to apply on various language habits and encoding systems, program designers only use this architecture mechanism to write applications, you can do not need to recompile the program Next, nature supports a wide variety of languages. At present, the basic principle of I18N's design is to independently of partial information related to the processing and language coding in the program. These materials include the definition of the coding system (such as the mainland's Simplified Chinese GB2312; Taiwan's BIG5 encoding); number; date; currency format, etc. Of course, it also includes output information that may be the most important program for users. These and language environments are known as relevant information, known as Locale Database. Once this part is out, you can define an interface that is not related to the language environment detail, so that the programmer can be limited by a particular locale when writing a program. When the program is executed, the Locale Database used by the language environment is contacted by the Locale Database used by the user to obtain the language support. After I18N's architecture, the support for some language only needs to have LOCALE DATABASE in the language. Realizing the support for this language is called L10N. For Chinese users, Chinese culture is only one of L10n. Q. It seems that it is very good, but I still don't quite understand how to cultivate. A. There is no difference in regionalization of Chinese and other languages. The most important thing is to build Locale Database. For ordinary users, the Locale Database in the system part basically doesn't have to worry about it. Now there is a Chinese Locale Database, and recently launched a few Linux Distribution with Chinese Locale Database, you only need to install it. Then just tell the procedure that you are using the language environment. Tell the procedure that the language environment you are using can be implemented by setting the environment variable lc_all. For Chinese users, LC_ALL can be set to zH_CN.GB2312 or zH_CN.GBK. After this, you have supported the support of Simplified Chinese. Of course, the premise is that you have installed the corresponding Locale Database. Q. zh_cn.gb2312, zh_cn.gbk? Very blame name, can you tell me what does it mean? A. Locale Database (Locale) The name contains the following sections, where [] is optional: language [_territory [.encoding]] [@ modifier] Configuring: zh_cn.gb2312, zh represents Chinese The meaning, CN indicates that China mainland, GB2312 indicates that the encoding method used is GB2312; the same zh_tw.big5 represents the Chinese LOCALE of Taiwan's BIG5 encoding.

Language is usually two lowercase letters, which uses language abbreviations specified by ISO 639; the area is two uppercase letters, follow ISO 3166 standards (ISO639 and ISO3166 these two standards can be from ftp: // Dkuug .dk / i18n / below is found). In addition, it should be noted that in GLIBC-2.2, the encoding (Encoding) part is lowercase, ie, zh_cn.gb2312 should be written into zh_cn.gb2312 according to the standard, but due to historical reasons, the current is still common. Q. How do I determine if a Locale is installed? A. Run Locale -a to see all of your system installed all Locale. If there is the name of the Locale you want, it means that the Locale has been installed. Q. My system is not installed in Chinese locale, what should I do? A. Because of different systems, there are different installation methods, I can only say the installation of the system I have used. Since the system of Locale is not implemented in GLIBC-2.1, the system below GLIBC-2.1 should list the schedule of the upgrade system in your schedule. Glibc-2.1 itself does not have Chinese Locale, but fortunately, all Linux Distribution has brought Chinese locale. For example, Turbo has a locale-zh-0.97-1.rpm package, you can install it. For other Glibc-2.1, but there is no Chinese LOCALE's Linux Distribution, such as Slackware-7.0, to install Chinese locales or softened, from other systems, the Source of Chinese Locale, the compilation and installation can be. There is a zh-local in the Potato of Debian, which is a Chinese locale package, and it will be installed with DSELECT or APT-GET. GLIBC-2.2 has included Chinese locale inside, so there is no need to install Chinese Locale package. However, some system itself does not generate these locale, requiring users to generate themselves. For example, debian's Woody, you need to modify the /etc/locale.gen file, remove the comments of the Chinese Locale corresponding to the row, and then run local Locale. Q. I used the system based on GLIBC-2.1, which has already installed ZH_CN.GB2312 LOCALE, why can't I use this Locale? A. One possible reason is that you use the Distribution not telling glibc how to handle the GB2312 code, the solution is the word in / usr / lib / gconv-modules search GB2312, if not found, just in this document Look for the words "Modules Euc-CN", then add ALIAS GB2312 / / EUC-CN / / saved before this line. So your system is almost the same, you should support zh_cn.gb2312 this LOCALE. Q. Now I can determine that my system has already installed and supports Chinese locale, but how do I determine if I have set a Locale environment? A. Run the local command, you can see what the current Locale environment is.

转载请注明原文地址:https://www.9cbs.com/read-3570.html

New Post(0)