1

我有一個單語言GWT應用程序(英文),我想使用本地化的日期和數字格式。GWT中的本地化日期和數字格式

我已將<inherits name="com.google.gwt.i18n.I18N"/>添加到我的gwt.xml,但格式保留在en-us。我已使用此腳本檢查了瀏覽器的lacale

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

哪些報告da_DK

我也嘗試強制將<meta name="gwt:property" content="locale=da">加到index.html,但沒有運氣。

我可以得到正確格式的唯一方法是使用<extend-property name="locale" values="da" />直接將區域設置添加到gwt.xml,這非常煩人,因爲有相當多的區域設置可用。

有沒有人知道這個解決方法?

回答

2

在date和numberformats中沒有其他方法來使用構建。

這是因爲I18N使用延遲綁定。

具有本地化格式的屬性文件實際上被編譯爲本地化的html/javascript。只有一種格式的PR語言。正確的本地化軟件包由瀏覽器加載。