Search code examples
javagwtinternationalizationuibinder

read key from LocalizedResource.properties programmatically


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?


Solution

  • 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