本文介绍了以编程方式从LocalizedResource.properties读取密钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在uibinder中使用LocalizedResource.properties。让我说我有在Java文件中编程创建的小部件。如何从LocalizedResource.properties中读取关键字,具体取决于用户选择的语言en,fr..etc?

解决方案

如果你的LocalizedResource.properties的生成方式如所以我不明白你为什么要从中读取密钥

如果.properties是为消息或常量接口创建的,那么您可以通过http://*.html?locale = fr_CA读取* fr_CA.properties,因此对于任何您想要的语言。



有用的链接是

  • 或尝试 @UiTemplate 为不同的lan准备了tamplates轨距。要找到当前的语言环境,您可以使用 LocaleInfo.getLocaleName()



    有用的链接是



  • I able to use LocalizedResource.properties with uibinder. let say i have widget that created programmatically in java file. how to read in key from LocalizedResource.properties depending on language "en,fr..etc" selected by users?

    解决方案

    It's difficult to say something definitely.

    1. If your LocalizedResource.properties is generated as described by "Internationalization - UiBinder" so I don't understand why you want to read in key from it

    2. If .properties made for Message or Constant interface so you could read *fr_CA.properties by http://*.html?locale=fr_CA and so for any languge you want.

      Helpful link is Internationalizing GWT: Creating the translation for each language supported

    3. or try @UiTemplate to switch between tamplates prepared for different languages. To find out current locale you can use LocaleInfo.getLocaleName().

      Helpful link is Apply different XML templates to the same widget

    这篇关于以编程方式从LocalizedResource.properties读取密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

    09-22 03:19