GWT Internationalization throws an exception while rebinding
- by Stephane Grenier
I'm trying to internationalize a test application with GWT following the instruction and I have:
com.example.client.MyConstants.java
com.example.client.MyConstants_en.properties
com.example.client.MyConstants_fr.properties
com.example.client.MyAppEntryPoint.java
In this code I have:
public interface MyConstants extends Constants
{
@DefaultStringValue("HelloWorld")
String hellowWorld();
}
And
public class MyAppEntryPoint implements EntryPoint
{
public void onModuleLoad()
{
MyConstants constants = GWT.create(MyConstants.class);
VerticalPanel mainPanel = new VerticalPanel();
mainPanel.add(new Label(constants.hellowWorld()));
RootPanel.get("myContainer").add(mainPanel);
}
}
For MyApp.gwt.xml I have:
<module rename-to="myModule">
<inherits name="com.google.gwt.xml.XML" />
<inherits name="com.google.gwt.i18n.I18N"/>
<inherits name='com.google.gwt.user.theme.standard.Standard'/>
<!-- Specify the app entry point class. -->
<entry-point class='com.example.client.MyAppEntryPoint'/>
<extend-property name="locale" values="en,fr"/>
</module>
In the html I have:
...
It all seems to work as long as I don't include in the xml file. As soon as I do, I get the following exception:
[ERROR] Generator 'com.google.gwt.i18n.rebind.LocalizableGenerator' threw threw an exception while rebinding 'com.example.client.myConstants'
java.lang.NullPointerException: null
...
Any help would be greatly appreciated on why it's throwing the exception.
-