use of com.xenoage.utils.jse.lang.LanguageInfo in project Zong by Xenoage.
the class PlayerFrame method createLanguageItems.
private void createLanguageItems() {
// clear old menu items
mnuSettingsLanguage.getItems().clear();
// add language menu items
List<LanguageInfo> langs = null;
try {
langs = LanguageInfo.getAvailableLanguages(LangManager.defaultLangPath);
} catch (Exception ex) {
handle(Companion.fatal(ex));
}
ToggleGroup toggleGroup = new ToggleGroup();
for (final LanguageInfo lang : langs) {
String name = lang.getLocalName();
String intName = lang.getInternationalName();
ImageView icon = null;
if (lang.getFlag16Path() != null)
icon = new ImageView(imageOrNull(lang.getFlag16Path()));
String text = name + (name.equals(intName) ? "" : " (" + intName + ")");
RadioMenuItem mnu = new RadioMenuItem(text, icon);
mnu.setToggleGroup(toggleGroup);
mnu.setOnAction(e -> app().execute(new LanguageChange(lang.getID())));
if (Lang.getCurrentLanguage().getID().equals(lang.getID()))
mnu.setSelected(true);
mnu.setUserData(lang.getID());
mnuSettingsLanguage.getItems().add(mnu);
}
}
Aggregations