Recipe 15.2 Listing Available Locales


You want to see what locales are available.


Call Locale.getAvailableLocales( ) .


A typical runtime may have dozens of locales available. The program ListLocales uses the method getAvailableLocales( ) and prints the list:

// File Locale[] list = Locale.getAvailableLocales( );         for (int i=0; i<list.length; i++)             System.out.println(list[i]);     } }

The list is far too long to show here, as you can judge by the first few entries:

> java ListLocales en en_US ar ar_AE ar_BH ar_DZ ar_EG ar_IQ ar_JO ar_KW ar_LB ar_LY ar_MA ar_OM ar_QA ar_SA ar_SD ar_SY ar_TN ar_YE be be_BY

On my system, the complete list has an even dozen dozen (144) locales, as listed by the command java ListLocales | wc -l.

Java Cookbook
Java Cookbook, Second Edition
ISBN: 0596007019
EAN: 2147483647
Year: 2003
Pages: 409
Authors: Ian F Darwin

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: