The default language of the Android system is English, and the customized system may need to be simplified Chinese when the user is on the machine.
We can modify system attributes to implement the default language.
There are two methods, which can be used for reference:
1. Add the following code to init. RC or other boot initialization files, such as default. Prop:
[persist.sys.language]: [zh][persist.sys.country]: [CN][persist.sys.localevar]: [][persist.sys.timezone]: [Asia/Shanghai][ro.product.locale.language]: [zh][ro.product.locale.region]: [CN]
2. During compilation, you can specify the compilation parameters to be simplified Chinese. In this way, the system property files compiled by Traditional compilation are displayed in
During system initialization, the above attributes will be correctly initialized, for example:
Make PRODUCT-machineID-eng-zh_CN
Other related materials:
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.
It provides powerful bidi algorithms and 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. Icu4j is slightly different from icu4c, but because icu4c is open-source and closely follows the Unicode standard, Unicode standards supported by icu4c are 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.
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_FRENCHLocale constant for fr_CA.Locale CHINALocale constant for zh_CN.Locale CHINESELocale constant for zh.Locale ENGLISHLocale constant for en.Locale FRANCELocale constant for fr_FR.Locale FRENCHLocale constant for fr.Locale GERMANLocale constant for de.Locale GERMANYLocale constant for de_DE.Locale ITALIANLocale constant for it.Locale ITALYLocale constant for it_IT.Locale JAPANLocale constant for ja_JP.Locale JAPANESELocale constant for ja.Locale KOREALocale constant for ko_KR.Locale KOREANLocale constant for ko.Locale PRCLocale constant for zh_CN.Locale SIMPLIFIED_CHINESELocale constant for zh_CN.Locale TAIWANLocale constant for zh_TW.Locale TRADITIONAL_CHINESELocale constant for zh_TW.Locale UKLocale constant for en_GB.Locale USLocale constant for en_US.
3. Custom Language
The custom language adds 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)
4. 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)))endefdefine 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" 。
Therefore, you can use either of the following methods to change the default language:
4.1 In the product_locales field, place the language to be selected first, for example, product_locales: = en_us zh_cn. The default language is English;
4.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
Product_locales
Where is the environment variable?
Build/target/product/SDK. mk
Find this variable, and then modify
Product_locales
Variable
Product_locales: = \
En_us \
Zh_cn \
Zh_tw
Compile and burn files,
The system language version remains unchanged. Check the files carefully, or you cannot find them.
Finally, in build/target/product/CORE. mk
Take the following
Product_locales
:= \
En_us \
Zh_cn \
Zh_tw
Add it here, re-compile it, and the installation is successful ~! I don't know why !!!