本文转载自:
http://www.iteye.com/topic/246869
一直在研究国际化的问题,但如果用html一直没有很好的解决。最近发现了Ext中也有i18n
1.用法:var bundle = new Ext.i18n.Bundle({bundle='Application'});
bundle.onReady(
alert('example'+ bundle.getMsg('key1'));
);
2.类似于java的属性文件,如果浏览器的语言是es-ES则属性文件Application_es-ES.properties:
#This is a simple comment
key1 "英文 Eric is a good man"
如果 Application_es-ES.properties 不存在则系统会去找Application.properties。
#This is a simple comment
key1 "中文 佛说他是个好人"
3.Bundle语法
Bundle(config): config: {bundle: , resource:}
bundle: properties文件名.
如{bundle: 'mybundle'}则系统会找
http:/yourdomain/yourApp/mybundle_[language].properties.
至少你要准备一个mybundle.properties file.
path: (optional) 文件路径
{bundle: 'mybundle, path: 'resources'}
文件定位如下:
http:/yourdomain/yourApp/resources/mybundle_[language].properties.
本文转载自:
http://www.iteye.com/topic/246869