我想使用動態字符串i18n國際化我的應用程序與GWT UI活頁夾運行。 UI binder是否支持動態字符串i18n?請讓我知道這是否可能。GWT動態字符串i18n與uibinder
1
A
回答
1
UiBinder模板可以標記爲本地化。您使用
<ui:msg>
和<ui:attribute>
元素來指示應翻譯模板的哪些部分,然後在構建應用程序時提供包含 消息的本地化版本的屬性文件。 More它
更新時間: 看到這個GWT Dynamic String Internationalization,我認爲你可以找到有一個解決方案。
0
回答你的問題 - 是的,i18n由UI Binder支持。請參閱可用文檔here和here。爲了支持我的要求,這裏是直接引用:
UiBinder的...提供了國際化與GWT的國際化設施運行良好的直接支持;
你只需做一些* .properties文件與指定的語言環境,使在GWT-XML國際化模塊,創造出的方法(返回字符串)既可以在Java代碼和用戶界面的XML文件進行訪問的接口。
+0
感謝您的回覆。但是我想知道DYNAMIC i18n是否可能。我知道靜態字符串i18n可以使用uibinder – javalearner 2012-01-12 07:16:42
0
我們已經使用Dictionary完成了該操作。基本上,您使用動態主機頁面(例如jsp)在主機頁面中動態創建常量。要使用UiBinder的使用他們,你有幾種選擇,但最直接的是創建一個圍繞字典包裝類,例如
package org.gwt.dictionary.test
public class CurrentTheme {
Dictionary theme = Dictionary.getDictionary("CurrentTheme");
public String highlightColor() {
return theme.get("highlightColor");
}
public String shadowColor() {
return theme.get("shadowColor");
}
public String errorColor() {
return theme.get("errorColor");
}
public String errorIconSrc() {
return theme.get("errorIconSrc");
}
public String errorLabel() {
return theme.get("errorLabel");
}
public String someTextContent() {
return theme.get("someTextContent");
}
}
然後你可以使用它在gwt.xml這樣
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
<ui:with field="themeConstants" type="org.gwt.dictionary.test.CurrentTheme"/>
<g:HTMLPanel>
<g:Label text="{themeConstants.errorLabel}" styleName="{themeConstants.errorColor}"/>
<div class="aler alert-info"><ui:text from="{themeConstants.someTextContent}"/></div>
</g:HTMLPanel>
</ui:UiBinder>
希望它有幫助
相關問題
- 1. TreeItem與I18N GWT
- 2. gwt中的uibinder的動態值
- 3. 如何動態創建GWT UIBinder元素?
- 4. GWT動態字符串國際化
- 5. ExtGWT與GWT UIBinder合作
- 6. GWT UiBinder的屬性字段
- 7. GWT MVC + UIBinder
- 8. UiBinder gwt pushButton
- 9. GWT LazyPanel with UiBinder
- 10. GWT UiBinder TabPanel
- 11. GWT uibinder複合
- 12. Rails i18n字符串自動縮小?
- 13. uibinder的替代方案I18n
- 14. GWT UiBinder保證金
- 15. GWT 1.4 TO 2.0 UiBinder
- 16. GWT中的LazyPanel(Uibinder)
- 17. 如何使用JavaScript與gwt Uibinder
- 18. GWT uiBinder的工作與繼承?
- 19. GWT UiBinder的Eclipse自動完成(+ UiBinder文檔)
- 20. Objective-C:常量字符串與動態字符串
- 21. 字符串與模板,動態變量
- 22. Angular 2動態字符串與管道
- 23. GWT自動從UiBinder創建Java類
- 24. GWT - 更換DockLayoutPanel的<g:center>在UiBinder的動態
- 25. GWT UiBinder任何方式有動態的小部件列表?
- 26. GWT中的動態嵌套無序列表UIBinder
- 27. GWT UiBinder任何方式有動態圖像列表
- 28. UiBinder的動態DockPanel中
- 29. 鏈接小部件GWT - uiBinder
- 30. gwt css uibinder共享資源
感謝您的回覆。但是我想知道DYNAMIC i18n是否可能。我知道靜態字符串i18n是可能的與uibinder – javalearner 2012-01-12 07:17:31
該鏈接澄清靜態國際化。你可以從消息界面看到。這不是動態的 – javalearner 2012-01-12 08:28:53