I've just started writing my first JavaFX 2 application after learning the basics and would like to internationalize it.
I notice that in JavaFX 1.x, the scripting language allowed for very simple internationalization of strings. Are there any similar features in JavaFX 2?
Basically: what is the best practice for internationalizing a JavaFX 2 application?
The basic steps (among others) of a java app internationalizing, are
Locale
lizing and resource bundling. In JavaFX, you can useFXMLLoader#setResources()
for that purposes. Here a SSCCE demo to demonstrate it. The codes are self-descriptive.Demo package structure:
MyBundle_en.properties
MyBundle_kg.properties
MyView.fxml
MyController.java
BundleDemo.java
Screenshot:
This works for me:
In the bundles package are
Sample content:
To load them I use the following code:
Look at my example
More I described here or on GitHub
Update:
the solution is in
Messages.java
and in
PropertyLoader.java