开发者

Localized date and numberformats in GWT

I have a monolingual GWT application (English开发者_运维问答) and I would like to use localized date and number formats.

I have added <inherits name="com.google.gwt.i18n.I18N"/> to my gwt.xml, but the formats remain in en-us. I have checked the browser lacale using this script

private native String getBrowserLocale() /*-{
      return navigator.language!=null ? navigator.language : navigator.browserLanguage; 
}-*/;

which reports da_DK.

I also tried forcing the locale by adding <meta name="gwt:property" content="locale=da"> to the index.html, but no luck.

The only way i can get the correct formats is by directly adding the locales to the gwt.xml using <extend-property name="locale" values="da" />, which is quite annoying because there is quite a few locales available.

Does anybody know a workaround for this?


There is no other way to use the build in date and numberformats.

This is because I18N uses deferred binding.

The properties files with the localized formats are actually compiled into localized html/javascript. Only one format pr language. The correct localized bundle is loaded by the browser.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜