Using UIBinder internationalisation features can be difficult.
To overcome this problem, GWTP makes it easy for you to store all your translations in:
However, it is still necessary to keep all these files synchronized with one another. In addition, you want to make sure they contain any message included in a UIBinder xml file. To do so, GWTP lets you use the python script
mergelocales.py. The script can be found in the Downloads section.
The exact process is as follows:
* Compile GWT code by adding parameter
mergelocales extras/YourProjectName src/com/google/gwt/i18n/client/
* Go through the
LocalizableResource_xxxx.properties files and solve the TODO comments.
For more details on the script, run
GWT looks for the
LocalizableResource???.properties files in the directory of your class implementing Constants or Messages, and in the directory of any super interfaces. The problem with
UiBinder translations is that the associated
LocalizableResource files aregenerated in the folder of the
UiBinder file, so your resources are spread across your directories.
mergelocales looks for all of these and merges them intelligently in a central location: com.google.gwt.i18n.client. This is legit since this package is the directory of the
LocalizableResource, a superinterface common to both Constants and Messages.
When compiling a localized GWT project, one has to
* compile 1st time, to generate extras locales
mergelocale and update translations
* compile 2nd time, so translations are included in the results