GWT UiBinder I18n

As the title says I need some help with GWT’s i18n in use with UiBinder. I want to internationalize my application using static i18n. The book I use for learning only presents a way of internationalizing ui.xml files by having the compiler generate keys for Constants/Messages and a default file, but there has to be an easier way to do this. That’s why I tried using the ui:with tag like this to use my internationalized constants (inside the upFace):

<ui:with type="havis.ui.shared.resourcebundle.ConstantsResource" field="lang"></ui:with>    
<g:ToggleButton ui:field="observeButton">
        <g:upFace>{lang.observe}</g:upFace>
        <g:downFace>Observing</g:downFace>
</g:ToggleButton>

This doesn’t work, the button shows the text {lang.observe} which also seems logical, but now my question is: Is there any way to use constants like this? And if not could someone explain how I should use constants in UiBinder files instead (without having the compiler generate files and keys)?


Source: java

Leave a Reply