On Thursday, September 27, 2012 4:04:07 PM UTC+2, Ritesh Jagga wrote:
We are using UIBinder to create UI screens and implementing internationalization in them. We are able to read values associated with keys from the LocalizableResource_<locale>.properties file. The docs here https://developers.google.com/web-toolkit/doc/latest/DevGuideUiBinderI18n says that this file should be present at this location com/google/gwt/i18n/client. As far as we are following the package structure and the name of properties file, internationalization works.
Is there a way in which we can change/configure the package structure?
You can make all your generated interfaces extend an interface you create (using ui:baseMessagesInterface in your UiBinder templates); you can then put all your properties' files relative to this interface. And you can also take advantage of annotation inheritance. E.g.
package com.example.myapp.shared;
@DefaultLocale("en-US")
@Generate(format = "com.google.gwt.i18n.server.PropertyCatalogFactory")
public interface Messages extends com.google.gwt.i18n.client.Messages {
}
<ui:UiBinder xmlns:ui="…" ui:baseMessagesInterface="com.example.myapp.shared.Messages">
The reason is that GWT I18N looks up the interface hierarchy to find the messages for a given interface, and given that all I18N interface ultimately extend com.google.gwt.i18n.client.LocalizableResource, you can be sure that GWT will look at that place, so it's the "most central" place where you can put your properties files.