设为首页 加入收藏

TOP

Android 2.1 架构解析(一)
2014-11-24 01:01:08 来源: 作者: 【 】 浏览:5
Tags:Android 2.1 架构 解析

ICU4C(ICU for Chttp://site.icu-project.org/)ICUC/C++平台下的版本, ICU(International Component for Unicode)是基于"IBM公共许可证"的,与开源组织合作研究的, 用于支持软件国际化的开源项目。ICU4C提供了C/C++平台强大的国际化开发能力,软件开发者几乎可以使用ICU4C解决任何国际化的问题,根据各地的风俗和语言习惯,实现对数字、货币、时间、日期、和消息的格式化、解析,对字符串进行大小写转换、整理、搜索和排序等功能,必须一提的是,ICU4C提供了强大的BIDI算法,对阿拉伯语等BIDI语言提供了完善的支持。


  ICU首先是由Taligent公司开发的,Taligent公司现在被合并为IBM 公司全球化认证中心的Unicode研究组,然后ICUIBM和开源组织合作继续开发,开源组织给与了ICU极大的帮助。


  开始ICU只有Java平台的版本,后来这个平台下的ICU类被吸纳入SUN公司开发的JDK1.1,并在JDK以后的版本中不断改进。C++C平台下的ICU是由JAVA平台下的ICU移植过来的,移植过的版本被称为ICU4C,来支持这C/C++两个平台下的国际化应用。


ICU4CICU4C区别不大,但由于ICU4C是开源的,并且紧密跟进Unicode标准,ICU4C支持的Unicode标准总是最新的;同时,因为JAVA平台的ICU4J的发布需要和JDK绑定,ICU4C支持Unicode标准改变的速度要比ICU4J快的多。


Android 使用的语言包就是ICU4C,位置:external/icu4cAndroid支持的语言有:


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


PRODUCT_LOCALES字段里添加需要语言,如:


PRODUCT_LOCALES := en_US zh_CN


则系统里只有英语和汉语两种语言。


然后语言的选择处理是在external/icu4c/stubdata/Android.mk里进行的,如下:


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)


默认语言的选择实现是在build/core/Makefile里,从PRODUCT_LOCALES里选择第一个语言作为默认语言,如下:


define default-locale


$(subst _, , $(firstword $(1)))


endef



# Selects the first locale in the list

首页 上一页 1 2 下一页 尾页 1/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇C++ 异常处理 terminate函数使用 下一篇Linux-2.6驱动开发

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: