我正在尝试使用属性文件将UIBinder应用程序国际化。由于com.google.gwt.i18n.client.Messages接口(interface)(GWT 1.7.1)公开了许多翻译,因此我们希望重用这些消息。

我尝试了以下方法:

<!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"
 xmlns:res="ui:with:be.credoc.iov.webapp.client.MessageConstants">

 <g:HTMLPanel>
  <div>
   <res:msg key="email">Emaileke</res:msg>:
   <g:TextBox ui:field="email" />
  </div>
 </g:HTMLPanel>
</ui:UiBinder>

MessageConstants类如下所示:
@DefaultLocale("nl")
public interface MessageConstants extends Messages {
 String email();
}

但是,这不起作用。我怎样才能做到这一点?

最佳答案

更新:

自从Igor写出答案以来,已经有了一种在ui绑定(bind)程序中使用消息的新方法。

<span>This <ui:text from="{msgRes.message}" /> has been internationalized</span>

此方法使用GWT的text resource UiBinder integration

关于gwt - 如何使用消息国际化GWT UIBinder页面?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/2287693/

10-11 22:32
查看更多