org.apache.maven.xdoc.util
Class LocaleUtil

java.lang.Object
  extended byorg.apache.maven.xdoc.util.LocaleUtil

public final class LocaleUtil
extends Object

Utility class to handle the java.util.Locale object.

Version:
$Id: LocaleUtil.java 532339 2007-04-25 12:28:56Z ltheussl $
Author:
Vincent Siveton

Constructor Summary
LocaleUtil()
           
 
Method Summary
static Locale[] codesToLocales(String localeCodes)
          Parse a comma separated list of locale codes and converts to an array of java.util.Locale object.
static Locale codeToLocale(String localeCode)
          Converts a locale code like "en", "en_US" or "en_US_win" to a java.util.Locale object.
static String displayName(Locale locale)
          Returns the name for the locale.
static String displayName(Locale locale, Locale localeWanted)
          Returns the name for the locale.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocaleUtil

public LocaleUtil()
Method Detail

codeToLocale

public static Locale codeToLocale(String localeCode)
Converts a locale code like "en", "en_US" or "en_US_win" to a java.util.Locale object.
If localeCode = "default", return the current value of the default locale for this instance of the Java Virtual Machine.

Parameters:
localeCode - the locale code string.
Returns:
a java.util.Locale object instancied or null if errors occurred
See Also:
java.util.Locale#getDefault()

codesToLocales

public static Locale[] codesToLocales(String localeCodes)
Parse a comma separated list of locale codes and converts to an array of java.util.Locale object.

Parameters:
localeCodes - a comma separated list of locale codes.
Returns:
a array of java.util.Locale object instancied or null if errors occurred

displayName

public static String displayName(Locale locale)
Returns the name for the locale. This will be the values returned by java.util.Locale.getDisplayName(), but the first character will be in upper case.

Parameters:
locale - The locale to display
Returns:
The display name of the locale with the first character in upper case

displayName

public static String displayName(Locale locale,
                                 Locale localeWanted)
Returns the name for the locale. This will be the values returned by java.util.Locale.getDisplayName(), but the first character will be in upper case. The display name can be in a locale wanted.

Parameters:
locale - The locale to display
localeWanted - The locale wanted to display the locale
Returns:
The display name of the locale with the first character in upper case


Copyright © 2001-2007 Apache Software Foundation. All Rights Reserved.