【问题标题】:How to internationalize the text attribute of a TreeItem in UIBinder?如何国际化 UIBinder 中 TreeItem 的文本属性?
【发布时间】:2011-07-21 12:27:24
【问题描述】:

给定这样的 UIBinder 树:

<g:Tree ...>
    <g:TreeItem text='Links1' >
        <g:Hyperlink ... />
        <g:Hyperlink ... />
    <g:TreeItem text='Links2' >
        <g:Hyperlink ... />
        <g:Hyperlink ... />
</g:Tree>   

如何将TreeItem 元素的“文本”属性国际化(不诉诸编程方式)?

【问题讨论】:

    标签: gwt internationalization tree uibinder


    【解决方案1】:

    如果你已经有一个消息(或常量)接口,你可以这样做: 将ui:with 资源添加到 UiBinder xml:

    <ui:with field='i18n' type="com.example.myapp.client.i18n.MyMessages" />
    

    接下来使用如下:

    <g:Tree ...>
        <g:TreeItem text='{i18n.links1}' >
            <g:Hyperlink ... />
            <g:Hyperlink ... />
        <g:TreeItem text='{i18n.links2}' >
            <g:Hyperlink ... />
            <g:Hyperlink ... />
    </g:Tree>
    

    其中links1links2 指的是MyMessages 接口上的方法名称。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-01-18
      • 1970-01-01
      • 1970-01-01
      • 2011-06-05
      • 1970-01-01
      • 2014-01-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多