How to modify the language in Android

Source: Internet
Author: User

 

I checked a lot of webpages and only wrote the product_locales field to be modified.

However, there are too many. mk files. I haven't found the definition of this field for a long time.

Final result:

./Device/rockchip/sdkdemo/boardconfig. mk.

This folder belongs to the custom file directory in the standard Android code. You can find the corresponding folder in the corresponding project. modify this folder.

 

The modification method is to place the default country in the first position of this field. The default value is English.

For example, South Korea: product_locales: = ko_kr en_us zh_cn

 

Additional article:

This is detailed and contains another modification method. For more information, see.

Transferred from:

Http://www.ziyouku.com/archives/android-custom-system-language-to-simplified-chinese.html

 

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_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.

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 )))
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 ".

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 build. Prop file processing is performed in system/CORE/init/property_service.c

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.