List of usage examples for java.util Locale getAvailableLocales
public static Locale[] getAvailableLocales()
From source file:Main.java
public static void main(String[] argv) throws Exception { Locale[] locales = Locale.getAvailableLocales(); for (int i = 0; i < locales.length; i++) { String country = locales[i].getCountry(); }/*from w w w .ja v a2s . com*/ }
From source file:Main.java
public static void main(String[] argv) throws Exception { Locale[] locales = Locale.getAvailableLocales(); for (int i = 0; i < locales.length; i++) { // Get the 2-letter language code String language = locales[i].getLanguage(); }/* w w w . ja va 2s. com*/ }
From source file:Main.java
public static void main(String args[]) { // create an object of locale class Locale[] array = Locale.getAvailableLocales(); // print the results for (int i = 0; i < 10; i++) { System.out.println(array[i].getISO3Country()); }/*from w ww . j a va 2 s .c o m*/ }
From source file:Main.java
public static void main(String[] args) { // create a new array and get all installed locales Locale[] locales = Locale.getAvailableLocales(); System.out.println("Installed locales are:"); for (int i = 0; i < locales.length; i++) { System.out.println(i + ":" + locales[i]); }//from w w w . java 2s. co m }
From source file:org.eclipse.swt.snippets.Snippet370.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Snippet 370"); shell.setLayout(new RowLayout(SWT.VERTICAL)); Locale[] locales = Locale.getAvailableLocales(); for (Locale locale : locales) { createForLocale(shell, locale);// w ww . j a va 2 s .c o m } shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:Main.java
public static boolean hasLocalChina() { boolean has = false; Locale locale[] = Locale.getAvailableLocales(); for (int i = 0; i < locale.length; i++) { if (locale[i].equals(Locale.CHINA)) { has = true;/*from www. j a va2 s . co m*/ break; } } return has; }
From source file:Main.java
public static ArrayList<String> getCountriesArray1() { Locale[] locales = Locale.getAvailableLocales(); ArrayList<String> countries = new ArrayList<String>(); for (Locale locale : locales) { String country = locale.getDisplayCountry(); Currency currency = Currency.getInstance(locale); if (country.trim().length() > 0 && !countries.contains(country) && !country.trim().equals("World")) { countries.add(country + " (" + currency + ")"); }//from w w w .ja va 2 s .c o m } Collections.sort(countries); setCountriesISOMap(); return countries; }
From source file:Main.java
/** * get a descriptions of all the languages available as determined by * {@link TextToSpeech#isLanguageAvailable(Locale)} *//*from w ww . j a v a 2 s . com*/ public static String getLanguageAvailableDescription(TextToSpeech tts) { StringBuilder sb = new StringBuilder(); for (Locale loc : Locale.getAvailableLocales()) { int availableCheck = tts.isLanguageAvailable(loc); sb.append(loc.toString()).append(" "); switch (availableCheck) { case TextToSpeech.LANG_AVAILABLE: break; case TextToSpeech.LANG_COUNTRY_AVAILABLE: sb.append("COUNTRY_AVAILABLE"); break; case TextToSpeech.LANG_COUNTRY_VAR_AVAILABLE: sb.append("COUNTRY_VAR_AVAILABLE"); break; case TextToSpeech.LANG_MISSING_DATA: sb.append("MISSING_DATA"); break; case TextToSpeech.LANG_NOT_SUPPORTED: sb.append("NOT_SUPPORTED"); break; } sb.append(NEW_LINE); } return sb.toString(); }
From source file:ShowCurrencies.java
public ShowCurrencies() { setDefaultCloseOperation(EXIT_ON_CLOSE); final Locale[] locales = Locale.getAvailableLocales(); TableModel model = new AbstractTableModel() { public int getColumnCount() { return 3; }/*from w w w. jav a 2 s . c o m*/ public String getColumnName(int column) { if (column == 0) return "Locale"; else if (column == 1) return "Currency Code"; else return "Currency Symbol"; } public int getRowCount() { return locales.length; } public Object getValueAt(int row, int col) { if (col == 0) return locales[row]; else try { if (col == 1) return Currency.getInstance(locales[row]).getCurrencyCode(); else return Currency.getInstance(locales[row]).getSymbol(locales[row]); } catch (IllegalArgumentException iae) { return null; } } }; JTable table = new JTable(model); JScrollPane sp = new JScrollPane(table); getContentPane().add(sp); pack(); setVisible(true); }
From source file:org.eclipse.wb.internal.core.nls.ui.FlagImagesRepository.java
private static void init() { if (m_locales == null) { // prepare sorted Locale's {/*from www . j a va2 s.com*/ List<Locale> locales = Lists.newArrayList(); Collections.addAll(locales, Locale.getAvailableLocales()); Collections.sort(locales, new Comparator<Locale>() { public int compare(Locale o1, Locale o2) { return o1.toString().compareTo(o2.toString()); } }); m_locales = locales.toArray(new Locale[locales.size()]); } } }