1 Language Customization
1.1 icu4c
1.1.1 icu4c Introduction
Icu4c (ICU for C, http://site.icu-project.org/) is the ICU version on the C/C ++ platform, ICU (international component for Unicode) is based on "IBM Public License, an open-source project that works with open-source organizations to support international software development. Icu4c provides the powerful international development capability of the C/C ++ platform. Software developers can use icu4c to solve any international problems. According to the customs and language habits of different regions, to Format And parse numbers, currencies, times, dates, and messages, and convert, sort, search, and sort strings in case, icu4c provides powerful bidi algorithms and provides comprehensive support for bidi languages such as Arabic.
ICU was first developed by taligent, which is now merged into IBM? The Unicode research team of the company's global certification center, and the ICU was further developed by IBM and open-source organizations. The open-source organizations helped the ICU a lot.
At first, the ICU was only available on the Java platform. Later, the ICU classes on this platform were incorporated into JDK developed by Sun and continuously improved in later JDK versions. The ICU on the C ++ and C platforms is transplanted from the icu on the Java platform. The transplanted version is called icu4c, to support international applications under the C/C ++ platforms.
Icu4c is slightly different from icu4c, but because icu4c is open-source and closely follows the Unicode standard, the Unicode standard supported by icu4c is always the latest. At the same time, because the release of icu4j on the Java platform needs to be bound with JDK, icu4c supports Unicode standard changes much faster than icu4j.
1.1.2 Android Language Pack
The Language Pack used by Android is icu4c. The location is external/icu4c. Android supports the following languages:
Locale Canada locale constant for en_ca.
Locale canada_french locale constant for fr_ca.
Locale China locale constant for zh_cn.
Locale Chinese locale constant for Zh.
Locale English locale constant for en.
Locale France locale constant for fr_fr.
Locale French locale constant for Fr.
Locale German locale constant for de.
Locale Germany locale constant for de_de.
Locale Italian locale constant for it.
Locale Italy locale constant for it_it.
Locale Japan locale constant for ja_jp.
Locale Japanese locale constant for Ja.
Locale Korea locale constant for ko_kr.
Locale Korean locale constant for Ko.
Locale PRC locale constant for zh_cn.
Locale simplified_chinese locale constant for zh_cn.
Locale Taiwan locale constant for zh_tw.
Locale traditional_chinese locale constant for zh_tw.
Locale UK locale constant for en_GB.
Locale us locale constant for en_us.
1.2 custom language
Add the required language to the product_locales field, for example:
Product_locales: = en_us zh_cn
Then, the system only has two languages: English and Chinese.
Then the language selection process is performed in external/icu4c/stubdata/Android. mk, as follows:
Config: = $ (word 1 ,/
$ (If $ (findstring AR, $ (product_locales), large )/
$ (If $ (findstring da, $ (product_locales), large )/
$ (If $ (findstring El, $ (product_locales), large )/
$ (If $ (findstring Fi, $ (product_locales), large )/
$ (If $ (findstring he, $ (product_locales), large )/
$ (If $ (findstring HR, $ (product_locales), large )/
$ (If $ (findstring Hu, $ (product_locales), large )/
$ (If $ (findstring ID, $ (product_locales), large )/
$ (If $ (findstring Ko, $ (product_locales), large )/
$ (If $ (findstring Nb, $ (product_locales), large )/
$ (If $ (findstring PT, $ (product_locales), large )/
$ (If $ (findstring Ro, $ (product_locales), large )/
$ (If $ (findstring Ru, $ (product_locales), large )/
$ (If $ (findstring SK, $ (product_locales), large )/
$ (If $ (findstring Sr, $ (product_locales), large )/
$ (If $ (findstring SV, $ (product_locales), large )/
$ (If $ (findstring th, $ (product_locales), large )/
$ (If $ (findstring TR, $ (product_locales), large )/
$ (If $ (findstring UK, $ (product_locales), large )/
$ (If $ (findstring ZH, $ (product_locales), large )/
$ (If $ (findstring Ja, $ (product_locales), US-Japan )/
$ (If $ (findstring it, $ (product_locales), US-Euro )/
$ (If $ (findstring PL, $ (product_locales), US-Euro )/
$ (If $ (findstring CS, $ (product_locales), default )/
$ (If $ (findstring de, $ (product_locales), default )/
$ (If $ (findstring FR, $ (product_locales), default )/
$ (If $ (findstring NL, $ (product_locales), default )/
US)
1.3 default language
In build/CORE/makefile, select the first language from product_locales as the default language, as shown below:
Define default-locale
$ (SUBST _, $ (firstword $(1 )))
Endef
# Selects the first locale in the list given as the argument
# And returns the language (or the region)
Define default-locale-language
$ (Word 2, 2, $ (call default-locale, $(1 )))
Endef
Define default-locale-region
$ (Word 3, 3, $ (call default-locale, $(1 )))
Endef
...
Product_default_language = "$ (call default-locale-language, $ (product_locales ))"/
Product_default_region = "$ (call default-locale-region, $ (product_locales ))"/
Then, use the build/tool/buildinfo. Sh file to write the following section to the file build. Prop, as shown below:
Echo "Ro. Product. locale. Language = $ product_default_language"
Echo "Ro. Product. locale. region = $ product_default_region"
To change the default language, use one of the following two methods:
1 In the product_locales field, put the language to be selected first, for example:
Product_locales: = en_us zh_cn
The default language is English.
2
Specify the language in persist. SYS. Language and persist. SYS. country as follows:
Product_property_overrides: =/
Persist. SYS. Language = zh/
Persist. SYS. Country = Cn
The build. Prop file is processed in system/CORE/init/property_service.c.