Android編程入門教程之設置系統語言和地區,先看源代碼中對此的設置:
- /*
- * Read the persistent locale.
- */
- static void readLocale(char* language, char* region)
- {
- char propLang[PROPERTY_VALUE_MAX], propRegn[PROPERTY_VALUE_MAX];
- property_get("persist.sys.language", propLang, "");
- property_get("persist.sys.country", propRegn, "");
- if (*propLang == 0 && *propRegn == 0) {
- /* Set to ro properties, default is en_US */
- property_get("ro.product.locale.language", propLang, "en");
- property_get("ro.product.locale.region", propRegn, "US");
- }
- strncat(language, propLang, 2);
- strncat(region, propRegn, 2);
- //LOGD("language=%s region=%s\n", language, region);
- }
修改build/tools/buildinfo.sh,增加如下語句
- echo "persist.sys.language=zh"
- echo "persist.sys.country=CN"
- echo "persist.sys.localevar="
- echo "persist.sys.timezone=Asia/Shanghai"
- echo "ro.product.locale.language=zh"
- echo "ro.product.locale.region=CN"
更多Android相關信息見Android 專題頁面 http://www.linuxidc.com/topicnews.aspx?tid=11