|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.tapestry5.internal.util.LocaleUtils
public class LocaleUtils
Contains code borrowed from commons-lang.
Constructor Summary | |
---|---|
LocaleUtils()
|
Method Summary | |
---|---|
static Locale |
toLocale(String input)
Converts a String to a Locale. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LocaleUtils()
Method Detail |
---|
public static Locale toLocale(String input)
Converts a String to a Locale.
This method takes the string format of a locale and creates the locale object from it.
LocaleUtils.toLocale("en") = new Locale("en", "") LocaleUtils.toLocale("en_GB") = new Locale("en", "GB") LocaleUtils.toLocale("en_GB_xxx") = new Locale("en", "GB", "xxx") (#)
(#) The behaviour of the JDK variant constructor changed between JDK1.3 and JDK1.4. In JDK1.3, the constructor upper cases the variant, in JDK1.4, it doesn't. Thus, the result from getVariant() may vary depending on your JDK.
This method validates the input strictly. The language code must be lowercase. The country code must be uppercase. The separator must be an underscore. The length must be correct.
input
- the locale String to convert, null returns null
IllegalArgumentException
- if the string is an invalid format
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |