Building an internationalized application with GWT and UI Binder requires some steps to be followed:
- For every
<ui:UiBinder>
tag inside each view, the following attributes need to be provided - Text inside the client views (the “*.ui.xml” files) that is to be translated needs to be surrounded by
the tags<ui:msg></ui:msg>
- The GWT compiler can now generate .properties files for holding translations.
For this, the compiler must be given an-extra
parameter. - There is a python script mergelocales.py at google code which takes care of merging the .properties file
- The last step is to manually write the translated values inside the corresponding LocalizableResource_XX.properties
file
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
ui:generateFormat='com.google.gwt.i18n.rebind.format.PropertiesFormat'
ui:generateKeys="com.google.gwt.i18n.rebind.keygen.MD5KeyGenerator"
ui:generateLocales="default">
Values can differ for the attributes. A more detailed use of these fields can be found at
GWT official documentation
For this tag, the “description” attribute must always be provided
This will be created relative to the project path, and will hold a .properties file for each of the ui xml views, and other generated files.
It is not enough to run the project with the “-extra” parameter, it needs to be compiled in order to generate the .properties files.
At this point we have the generated .properties files, and we can write the actual translations inside them. But they will only be considered if they will be moved in the same directory as the UI templates themselves.
The following steps are optional, but they help in organizing these .properties files into one single unit.
Because these generated .properties file have long names and because there can be many resulting files, one for each view, they can all be gathered inside one single .properties file for each language.
These generated files will be merged into a single LocalizableResource.properties file. Note that this exact name is a requirement.
This is the default file which will hold the fallback values for a translated string if there is no corresponding language file for the associated language.
This means there can also be some other hand made files which respect this following rule name
LocalizableResource_xx.properties
For example, for a german properties file, the name will be LocalizableResource_de.properties
These files must be placed in the same folder the default LocalizableResource.properties is created.
When the script is run, all the .properties files are populated with the default value for the translatable strings. But if we modify one of the translations, it will not be overriden when the python script is run again. It will be merged.
Running this script implies having Python installed
You can download python from here
The script takes exactly two parameters:
– the first one being the parent folder for the generated .properties file (inside extra directory)
– the second one being this path “/src/com/google/gwt/i18n/client/” which must contain the
“LocalizableResource.properties” file with this exact name.
When the script mergelocales.py is run again, the already translated values will NOT be overwritten.
Also, the mergelocales.py adds comments for each entry, to help with managing the file.
For a detailed information type “python mergelocales.py –help” inside cmd
Note
These steps are only fit for internationalizing the pieces of translatable text from inside the “*.ui.xml” templates. In order to internationalize any user message that the client code needs to send to the client, you can use the features provided by the Messages and Constants classes.
For more information, visit com.google.gwt.i18n.client.Constants com.google.gwt.i18n.client.Messages
After these steps, you can change the locale for the application by appending a “?locale=xx” at the end of the application url, and you should see, after a refresh, the application changing it’s locale.
Finally, there’s another very important peculiarity of what does Cialis that brings it so high above its alternatives. It is the only med that is available in two versions – one intended for use on as-needed basis and one intended for daily use. As you might know, Viagra and Levitra only come in the latter of these two forms and should be consumed shortly before expected sexual activity to ensure best effect. Daily Cialis, in its turn, contains low doses of Tadalafil, which allows to build its concentration up in your system gradually over time and maintain it on acceptable levels, which, consequently, makes it possible for you to enjoy sex at any moment without having to time it.