Tuesday, May 5, 2009

Java code to list all the available Locales

While implementing Internationalization (I18N) concept, there will be a requirement to find the Locales.Check the following java code to list all the available Locales

Locale[] locales = Locale.getAvailableLocales();

for (int i=0; i
// Get the two letter language code
String language = locales[i].getLanguage();

// Get the two letter country code;
String country = locales[i].getCountry();


// Get localized name suitable for display
String locName = locales[i].getDisplayName();
}

0 comments:

Blog Widget by LinkWithin

JS-Kit Comments

  © Blogger template Newspaper III by Ourblogtemplates.com 2008

Back to TOP