Lars,

Depending how large the text is, the i18n UiBinder 
tools<https://developers.google.com/web-toolkit/doc/latest/DevGuideUiBinderI18n>should
 work easily for you here. You said the text was for a button, so 
clearly a large text file is a bit of overkill.

Use the i18n messages interface 
file<https://developers.google.com/web-toolkit/doc/latest/DevGuideI18nMessages>.
 
Create a simple properties file such as *buttonNames_en.properties*, and 
put all your strings in there. Then just make a matching messages 
interface. Since you are using the UiBinder, the easiest way to set the 
values is the <ui:text> and <ui:with> tags (below).

<ui:with field='msg' type='com.project.i18n.ButtonMessages'/> 
        <g:HTMLPanel>
                <ui:text from="{msg.getString}"/>
        <g:HTMLPanel>

Once the code is in the i18n messages file, you can also access it 
programmatically when you like, such as the following:

private static final ButtonMessages messages = 
ButtonMessages.Default.getInstance();
public void someMethod() {
        // set string programmatically
        someElement.setInnerText(messages.getString());}

While this may seem like Java overkill in itself, it is a great thing to 
have no string literals at all in your project's Java/UiBinder files and 
will make you happy in the future if you ever need to support other 
languages.

Sincerely,
Joseph

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/Rym_aayFnHQJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to