/** * Returns the locale's ISO3 language code. * * @return the current language code, or {@code null} if no locale is set */ public String getLocale() { if (locales != null) { Locale locale = locales.getLocale(); return (locale != null) ? locale.getISO3Language() : null; } return null; }
/** * Sets the selected locale on the installation data. * * @param code the locale ISO code */ public void propagateLocale(String code) { try { locales.setLocale(code); Locale newLocale = locales.getLocale(); Locale.setDefault(newLocale); installData.setLocale(locales.getLocale(), locales.getISOCode()); installData.setMessages(locales.getMessages()); AbstractInstallDataProvider.addCustomLangpack(installData, locales); } catch (Exception exception) { logger.log(Level.SEVERE, exception.getMessage(), exception); } } }
/** * Constructs a {@code Languages}. * * @param locales the locales * @param installData the installation data * @param font the font to verify that language display names can be displayed. May be {@code null} */ public Languages(Locales locales, ConsoleInstallData installData) { DisplayNameCollector collector = new DefaultDisplayNameCollector(); for (String code : locales.getISOCodes()) { collector.addDisplayName(code, locales.getLocale(code), displayNames); } }
/** * Sets the selected locale on the installation data. * * @param code the locale ISO code */ public void propagateLocale(String code) { try { locales.setLocale(code); Locale newLocale = locales.getLocale(); Locale.setDefault(newLocale); JComponent.setDefaultLocale(newLocale); SwingUtilities.updateComponentTreeUI(this); installData.setLocale(locales.getLocale(), locales.getISOCode()); installData.setMessages(locales.getMessages()); AbstractInstallDataProvider.addCustomLangpack(installData, locales); // Configure buttons after locale has been loaded installData.configureGuiButtons(); } catch (Exception exception) { logger.log(Level.SEVERE, exception.getMessage(), exception); } }
/** * Load a default locale in the installData * * @param installData the installation data * @param locales the supported locales * @throws IOException for any I/O error */ protected void loadDefaultLocale(AutomatedInstallData installData, Locales locales) { Locale locale = locales.getLocale(); if (locale != null) { installData.setInstallationRecord(new XMLElementImpl("AutomatedInstallation")); installData.setLocale(locale, locales.getISOCode()); installData.setMessages(locales.getMessages()); } }
collector.addDisplayName(code, locales.getLocale(code), displayNames);
Locale locale = (locales != null) ? locales.getLocale() : null; String country = null; String language = null;
installData.setLocale(locales.getLocale(), locales.getISOCode()); installData.setMediaPath(mediaPath);