ICU首先是由Taligent公司开发的,Taligent公司现在被合并为IBM?公司全球化认证中心的Unicode研究组,然后ICU由IBM
和 开源组织合作继续开发,开源组织给与了ICU极大的帮助。
开始ICU只有Java平台的版本,后来这个平台下的ICU类被吸纳入SUN公司开发的JDK1.1,并在JDK以后的版本中不断改进。C++和C平台
下 的ICU是由JAVA平台下的ICU移植过来的,移植过的版本被称为ICU4C,来支持这C/C++两个平台下的国际化应用。 ICU4J和
ICU4C区别不大,但由于ICU4C是开源的,并且紧密跟进Unicode标准,ICU4C支持的Unicode标准总是最新的;同时,因 为
JAVA平台的ICU4J的发布需要和JDK绑定,ICU4C支持Unicode标准改变的速度要比ICU4J快的多。
2、 ANDROID语言包
Android 使用的语言包就是ICU4C,位置:external/icu4c。Android支持的语言有: 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、定制语言
定制语言在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)
4、默认语言
默认语言的选择实现是在build/core/Makefile里,从PRODUCT_LOCALES里选择第一个语言作为默认语言,如下:
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))"
然后通过build/tool/buildinfo.sh文件将如下段写到文件build.prop,如下:
echo "ro.product.locale.language=$PRODUCT_DEFAULT_LANGUAGE"
echo "ro.product.locale.region=$PRODUCT_DEFAULT_REGION" 。
因此,要改变默认语言用下面两种方法中的一种就行了:
4.1、在PRODUCT_LOCALES字段里,将要选择的语言放在第一位,如: PRODUCT_LOCALES := en_US zh_CN
默认语言是英语;
4.2、在persist.sys.language 和persist.sys.country 里指定语言,如下:
PRODUCT_PROPERTY_OVERRIDES := \
persist.sys.language=zh \
persist.sys.country=CN build.prop文件的处理是在system/core/init/
property_service.c。