I am working currently on internalization functionality in my application.
I created bundle folder with 2 files, 2 languages available:
messages_pl.properties and messages_en.properties.
In my main fxml file (containing menuBar as well) I set internalization resource for each and every controls.
This piece of code works perfectly for me, I can switch from "en" to "pl"
public void start(Stage primaryStage) throws Exception {
Locale.setDefault(new Locale("en"));
Pane borderPane = FxmlUtils.fxmlLoader(BORDER_PANE_MAIN_FXML);
Scene scene = new Scene(borderPane);
primaryStage.setScene(scene);
primaryStage.setTitle(FxmlUtils.getResourceBundle().getString("tittle.application"));
primaryStage.show();
The problem is that I don't want manipulate the code, switching from en to pl each time I need to change language.
I would like to have it dynamically, based if I choose RadioMenuItem "Polish" or RadioMenutItem "English".
Do you know how to adapt my source code consequently?