Holger's
Java API

com.antelmann.util
Class I18n

java.lang.Object
  extended by com.antelmann.util.I18n

public class I18n
extends Object

some utility methods useful for internationalization.

Author:
Holger Antelmann

Constructor Summary
I18n()
           
 
Method Summary
static boolean isSupportedCountry(String countryCode)
          based on uppercase ISO 3166 2-letter code
static Locale localeFor(String localeIdentifier)
          retrieves the Locale based on the toString() method of a supported Locale, or null if none is available.
static Locale localeForCountry(String countryCode)
          retrieves a supported Locale based on a given uppercase ISO 3166 2-letter code or null if none is available.
static String sampleString(Locale l)
          returns a sample String for the given locale - displayed in the default locale
static String sampleString(Locale l, Locale lang)
          returns a sample String for the first given locale displayed in the second given locale
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

I18n

public I18n()
Method Detail

sampleString

public static String sampleString(Locale l)
returns a sample String for the given locale - displayed in the default locale


sampleString

public static String sampleString(Locale l,
                                  Locale lang)
returns a sample String for the first given locale displayed in the second given locale


localeFor

public static Locale localeFor(String localeIdentifier)
retrieves the Locale based on the toString() method of a supported Locale, or null if none is available. The string comparison is case-insensitive.


localeForCountry

public static Locale localeForCountry(String countryCode)
retrieves a supported Locale based on a given uppercase ISO 3166 2-letter code or null if none is available. If there are more supported Locale object for the given country code, simply the first one encountered is returned.


isSupportedCountry

public static boolean isSupportedCountry(String countryCode)
based on uppercase ISO 3166 2-letter code



(c) 2001-2006 Holger Antelmann - all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads