Note:
- round buttons
- selected county name
- text in different character set
- money notation depending on selected country
Step : create a new IntelliJ Module
- Module name DisplayLocale
- create packages as shown in the picture below
- find country flags icons about 64x64x
- get some translation texts
Step: Create your translation .profile files
Example Australian English file
morning_greeting=G'day Mate!evening_greeting=G'evening Mate!
Step: Create class DisplayLocaleMain extends Application
- import java.util.*
- import javafx.*
- extends Application -- JavaFX Application
- implements Initializable -- automatic injection of Locale
- main method
- @FXML - annotation
- @override start method
- css/buttons.css
Note:
- @Overrite initialize method
- Currency.getInstance(bundle.getLocale());
- NumberFormat.getCurrencyInstance(bundle.getLocale());
- FXMLLoader fxmlLoader
- ResourceBundle.getBundle("bundles.Language", locale, new UTF8Control());
- fxmlLoader.setResources(languageBundle);
- getResource("views/TranslatedPhrasesPane.fxml");
- Pane pane = (BorderPane) fxmlLoader.load(url.openStream()); stage.getScene().getRoot()).getChildren().get(1); LanguageButtonEvent implements EventHandler
- @Override handle method
- LocaleBuilder.byLanguageCode(button.getId());
see next part