Lars,
Depending how large the text is, the
i18n UiBinder tools 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. 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