I know i can use the language.properties file in XML like this:
<resourceBundle id="statics" filename="Language/statics"/>
<resourceBundle id="buttons" filename="Language/buttonsAndLabels"/>
label="${buttons.mySuperDuperButton}"
But how would i ask for that file, if i were the current Controller and wanted to get a value out of that for maybe a “setText” command on a label ?
I am just unfamiliar in using this, so i can’t really search anything worthy for my question…
pspeed
February 9, 2015, 7:39pm
2
So is this a nifty question? Or are you using some other gui toolkit?
This is a nifty question.
Otherwise i have that properties and they should be anywhere in my App i think, so i could get them.
I know they come along anyway in this
Properties parameter, Attributes controlDefinitionAttributes
so they should be, where i want them to be.
But how do i choose them now ?
Short:
My Controller wants to set a new Text, which is held in the language file
Any further ideas on naming this method ???
It’s working:
public String getLanguageFileText(String file, String object){
return nifty.getResourceBundles().get(file).getObject(object).toString();
}
It’s plain old Java really.
final ResourceBundle resourcebundle = ResourceBundle.getBundle("Language/buttonsAndLabels");
textRenderer.setText(resourceBundle.getString("buttons.mySuperDuperButton"));
1 Like