How to add a new language for Android

Source: Internet
Author: User

Some time ago, because the customer requested to add the Persian language, but currently android2.3.1 does not have this language, the customer must have the Persian language, after a long time of exploration and online help, finally, the Persian language was added.

The following describes how to add a language:

1. Add the abbreviation of language and country internationalization in sdkdemo. mkCodeSuch as Iran: IR, and FA, which is an international standard and cannot be written at will. If you do not know the abbreviation of a country or region, you can search for it online.

Product_locales: =Fa_irEn_us zh_cn en_GB fr_fr it_it es_es ........

Path of sdkdemo. mk: gingerbread \ device \ rockchip \ sdkdemo. mk.

2. Add a Persian font under the framework/base/data/font directory, such as droidsansarabic. TTF.

3. After adding the font, it is necessary to call the font, the file that calls the font is in external/skia/src/ports/SKFontHost-android.app,

Static const fontinitrec gsystemfonts [] = {

{"Droidsans. TTF", gsansnames },

.........

{"Droidsansarabic. TTF", gfbnames },

4. The font is ready, and some makefiles need to be modified. Under external/icu4c/studata/Android. mk:

Config: = $ (word 1 ,\

$ (If $ (findstring AR, $ (product_locales), large )\

$ (If $ (findstring FA, $ (product_locales), large )\

5. Add a new values-fa-RIR folder under frameworks/base/CORE/RES/and create a new strings. xml file.

6. After the preceding five steps are completed, the Persian option will appear in the settings à Language & keyboard à Select language list, but no Persian text will appear after you select Persian. In this case, create a folder named values-fa-RIR under Res/in the corresponding app and translate the strings. xml file. For example, the main app's strings. XML Path is: gingerbread \ packages \ apps \ export top2d_mbx_new \ res \ values-fa-RIR \ strings. xml

 

Finally, remember:

Make clean

Make prebuild

Make

Related Article

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.