Refresh Screen for language change in JavaFX


I am building a JavaFX application with multi language support. So while loading the fxml file by:

AnchorPane page = (AnchorPane) FXMLLoader.load(Main.class.getResource("fxml/RealTimeInitialPanel.fxml"),Language.getBundle());

I am passing the resource bundle based on the default Language. Above Language class extends ResourceBundle and returns String based on the current Locale. To change language, I just have to call up Language.setLocale(..). Everything works well.

But say now the user changes the language on the go. How do I signal the fxml or UI to refresh the screen. That way they will again call up getString(..) and the text gets updated based on the setLocale. In swing, it does refresh periodically. But with fx iam unable to

1/31/2013 9:43:24 AM

At per Benefits of FXML, matter no 3:

The content of an FXML file can be localized as the file is read. For example, if an FXML file is loaded using the en_US locale, then it produces the string "First Name" for a label based on the following resource string: If the locale is changed to fr_FR and the FXML file is reloaded, then the label shows "Prénom." ...

So if you are aiming to localize the app through FXMLLoader then you cannot signal FXML to refresh its bundled texts other than reloading it again, I think.

1/31/2013 7:22:58 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow