A feature request</a> made Nifty user lynorics</a> create a patch that solved the issue and it directly point to solve the localization feature request</a> too :)</p>
Every attribute of every Nifty element can now contain a special markup "${...}"</strong> that gets replaced with something else when the xml is loaded.</p>
Example: You have the following options now to use this new feature: Localization Details</strong></p>
Currently Nifty Localization is using standard Property file based Resourcebundles. This simply means you can create a property file containing keys that are referenced from the xml files. Example: dialog_de.properties: dialog_en.properties: Now that Nifty knows about your resourceBundle you can access it with the method mentioned above: Nifty stuff and Kudos goes out to lynorics! :D void<text text="your home directory: ${ENV.HOME}" /></pre>
The "${ENV.HOME}" will be replaced with your $HOME environment variable! :D</p>
</ul>
If for some reason the replacement does not work out then nothing is replaced and you'll get the original ${...} String back.</p>
dialog.properties:
hello = Hello World in Default Language</p>
hello = Hallo Welt in Deutsch
hello = hello world in english</pre>
Once you have created these files you need to register the resourceBundle "dialog" with Nifty so that Nifty knows that it exists. You can do that with the new "resourceBundle" tag:<resourceBundle id="dialog" filename="src/main/resources/dialog" /></pre></p>
</pre></p>
<text text="${dialog.hello}" /></pre></p>
</pre>
Now Nifty will use the current set default locale to access the ResourceBundle with the id "dialog" and looks up the value for "hello". If you don't like that Nifty uses the default Locale you can set the Locale that Nifty should use with the "nifty.setLocale(Locale)" method.</p>