List of usage examples for java.util Locale getAvailableLocales
public static Locale[] getAvailableLocales()
From source file:com.gammalabs.wifianalyzer.wifi.band.Country.java
Country() { countries = new TreeMap<>(); for (Locale locale : Locale.getAvailableLocales()) { String countryCode = locale.getCountry(); if (StringUtils.isNotEmpty(countryCode) && StringUtils.isAlpha(countryCode) && countryCode.length() == 2) { countries.put(StringUtils.capitalize(countryCode), locale); }// w w w.j a v a 2s . c o m } }
From source file:com.aqnote.app.wifianalyzer.wifi.band.Country.java
public Country() { countries = new ArrayList<>(); for (Locale locale : Locale.getAvailableLocales()) { String countryCode = locale.getCountry(); if (StringUtils.isNotEmpty(countryCode)) { countries.add(locale);/*from w w w .jav a 2s .co m*/ } } Collections.sort(countries, new LocaleCountryComparator()); }
From source file:org.projectforge.web.wicket.converter.LanguageConverter.java
public static final Locale getLanguage(final String language, final Locale locale) { synchronized (localeMap) { if (localeMap.containsKey(locale) == false) { final Map<String, Locale> m = new HashMap<String, Locale>(); for (final Locale lc : Locale.getAvailableLocales()) { m.put(lc.getDisplayName(locale), lc); }/*w ww . j a v a2s. c om*/ localeMap.put(locale, m); } } return localeMap.get(locale).get(language); }
From source file:com.application.akscorp.yandextranslator2017.TranslateScreen.java
/** * Load available locale for Speech and initialization data for spinner with languages list *///from w w w. ja va2 s. co m private void InitAvailableLocalList() { Locale loc = new Locale("en"); TTSLocaleAvailable = loc.getAvailableLocales(); int i = 0; LangsTranslateNameSpinner = new String[LanguagesName.size()]; LangsCodeSpinner = new String[LanguagesName.size()]; for (String key : LanguagesName.keySet()) { LangsTranslateNameSpinner[i] = LanguagesName.get(key); LangsCodeSpinner[i] = key; if (LangsCodeSpinner[i].equals(myApp.LANGUAGE_START_CODE)) { FromLang = i; } if (LangsCodeSpinner[i].equals(myApp.LAST_LANGUAGE_TRANSLATE_CODE)) { ToLang = i; } i++; } }
From source file:com.switchfly.inputvalidation.sanitizer.LocaleCodeSanitizer.java
@Override public String execute(String content) { if (StringUtils.isBlank(content)) { return content; }/*from w ww . jav a 2 s .c o m*/ Locale locale; try { locale = LocaleUtils.toLocale(content); } catch (Exception e) { return getDefaultLocale(content); } if (!Arrays.asList(Locale.getAvailableLocales()).contains(locale)) { return getDefaultLocale(content); } return locale.toString(); }
From source file:com.jaspersoft.studio.swt.widgets.WLocale.java
public static String[] getLocales() { if (locales == null) { locales = Locale.getAvailableLocales(); strLocales = new String[locales.length]; for (int i = 0; i < strLocales.length; i++) strLocales[i] = locales[i].getDisplayName(); Arrays.sort(strLocales);/*w w w . j ava 2 s . c o m*/ } return strLocales; }
From source file:com.vrem.wifianalyzer.wifi.band.Country.java
Country() { countries = new TreeMap<>(); IterableUtils.forEach(/* w w w. j a v a2 s . c o m*/ CollectionUtils.select(Arrays.asList(Locale.getAvailableLocales()), new CountryPredicate()), new CountryClosure()); }
From source file:architecture.common.util.LocaleUtils.java
public static Locale[] getAvailableLocales() { Locale locales[] = Locale.getAvailableLocales(); Arrays.sort(locales, new Comparator<Locale>() { public int compare(Locale locale1, Locale locale2) { return locale1.getDisplayName().compareTo(locale2.getDisplayName()); }// w w w. j a va 2s.c o m }); return locales; }
From source file:org.fao.geonet.kernel.LocaleUtil.java
/** * Attempts to match the code to a Locale. If no match then the default Locale is returned * Case is ignored// w w w .j av a 2 s . com * * @param langCode A 2 or 3 character ISO language code * @param defaultLocale the local returned if not match is made * @return the associated Locale or the default locale if no match is founde * */ public static Locale toLocale(String langCode, Locale defaultLocale) { for (Locale loc : Locale.getAvailableLocales()) { if (loc.getISO3Language().toLowerCase().startsWith(langCode)) { return loc; } } return defaultLocale; }
From source file:com.cyclopsgroup.waterview.ui.view.system.status.SetLocale.java
/** * Overwrite or implement method execute() * * @see com.cyclopsgroup.waterview.Module#execute(com.cyclopsgroup.waterview.RuntimeData, com.cyclopsgroup.waterview.Context) */// w w w. j a v a2 s . c om public void execute(RuntimeData data, Context context) throws Exception { Locale[] locales = Locale.getAvailableLocales(); TreeMap availableLocales = new TreeMap(); for (int i = 0; i < locales.length; i++) { Locale locale = locales[i]; if (StringUtils.isEmpty(locale.getCountry())) { continue; } String key = locale.getCountry() + '|' + locale.getLanguage(); availableLocales.put(key, locale); } context.put("availableLocales", availableLocales.values()); context.put("currentLocale", data.getSessionContext().get(RuntimeData.LOCALE_NAME)); }