Compiere 3.1

org.compiere.cm.utils
Class LocaleHandler

java.lang.Object
  extended by org.compiere.cm.utils.LocaleHandler

public class LocaleHandler
extends Object

Version:
$Id$
Author:
YS

Constructor Summary
LocaleHandler(String languages, String charsets)
          Constructs a new LocaleHandler language list, and charset list.
 
Method Summary
 String getCharset()
          Gets the chosen charset.
static String getCharset(Locale loc)
          Gets the preferred charset for the given locale, or null if the locale is not recognized.
protected  String getCharsetForLocale(Locale loc, String charsets)
          Gets the best charset for a given locale, selecting from a charset list.
 Locale getLocale()
          Gets the chosen locale.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocaleHandler

public LocaleHandler(String languages,
                     String charsets)
Constructs a new LocaleHandler language list, and charset list.

Parameters:
languages - the Accept-Language header
charsets - the Accept-Charset header
Method Detail

getLocale

public Locale getLocale()
Gets the chosen locale.

Returns:
the chosen locale

getCharset

public String getCharset()
Gets the chosen charset.

Returns:
the chosen charset

getCharsetForLocale

protected String getCharsetForLocale(Locale loc,
                                     String charsets)
Gets the best charset for a given locale, selecting from a charset list. Currently ignores the charset list. Subclasses can override this method to take the list into account.

Parameters:
loc - the locale
charsets - a comma-separated charset list
Returns:
the best charset for the given locale from the given list

getCharset

public static String getCharset(Locale loc)
Gets the preferred charset for the given locale, or null if the locale is not recognized.

Parameters:
loc - the locale
Returns:
the preferred charset

Compiere 3.1

Compiere® is a registered trademark of ComPiere, Inc. ©2004-2008 HumanFlash.com All rights reserved.