读书人

gxt 汉语言

发布时间: 2012-08-22 09:50:35 作者: rapoo

gxt 中文

在使用gxt的时候 发现默认使用的是English

这样的话应用开发起来不能够完全中文化

这样可是太不方便了哈

?

在gxt的官方网站中找到了提示:http://www.sencha.com/forum/showthread.php?40607-How-to-translate-Ext-GWT-s-messages/page6

只是改变一下配置文件就行了

在gxt的jar文件中已经包括了XMessage_zh.properties文件

故能够帮助我们实现中文化

下面把主要的内容粘贴下来:

    <module><inherits name="com.google.gwt.user.User"/><inherits name="com.google.gwt.i18n.I18N"/><!-- Below is the line. Replace the "id" string to your country code (same as your XMessages_<country code>) file --><extend-property name="locale" values="id"/></module>
    ?Your translation (locale) is already included in your gwt module. Now you must specify your locale to be loaded by the client side script (html). Add this line to your html file like this:

    <html><head><!-- Below is the line. Replace the "id" string to your country code (same as your XMessages_<country code>) file --><meta name="gwt:property" content="locale=id"></head><body><!-- Load the GWT compiled module code --><script src="com.google.gwt.examples.i18n.ColorNameLookupExample.nocache.js " /></body></html>
    ?You can also load the locale by setting from query string like:
    http://www.example.org/myapp.html?locale=idRefresh your browser or recompile your project. Done. Your gxt is now in your language

读书人网 >Web前端

热点推荐