org.brains2b.util
Class LocaleHelper

java.lang.Object
  extended byorg.brains2b.util.LocaleHelper

public class LocaleHelper
extends java.lang.Object

A function library giving some extra help dealing with java.util.Locale.

Since:
TwelBox 0.30
Version:
0.10.1 [30-06-2007]
Author:
dennis@brains2b.nl

Constructor Summary
LocaleHelper()
           
 
Method Summary
static java.util.Locale getLocale(java.lang.String localeAbbr)
          gets Locale from a String representing a Locale
static boolean isCountry(java.lang.String isoLang)
          Determines if a two letter combination is a valid ISO country code.
static boolean isLanguage(java.lang.String isoLang)
          Determines if a two letter combination is a valid ISO language code.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocaleHelper

public LocaleHelper()
Method Detail

getLocale

public static final java.util.Locale getLocale(java.lang.String localeAbbr)
gets Locale from a String representing a Locale

the String has the form of language_country as used by ResourceBundles and should comply to the two letter ISO definitions of language and country.

If the String default is supplied an empty Locale is returned.

Parameters:
localeAbbr - String, the String representing a locale. This function is case insensitive.
Returns:
Locale the Locale that could be determined. If it cannot be determined null is returned.

isLanguage

public static final boolean isLanguage(java.lang.String isoLang)
Determines if a two letter combination is a valid ISO language code.

Parameters:
isoLang - String, the two letter String combination.
Returns:
boolean, true if the String combination is a valid ISO language code

isCountry

public static final boolean isCountry(java.lang.String isoLang)
Determines if a two letter combination is a valid ISO country code.

Parameters:
isoLang - String, the two letter String combination.
Returns:
boolean, true if the String combination is a valid ISO country code