org.apache.turbine.services.localization
Class LocaleDetector

java.lang.Object
  |
  +--org.apache.turbine.services.localization.LocaleDetector

Deprecated. Use LocaleTokenizer instead.

public class LocaleDetector
extends java.lang.Object

This class returns a Locale object based on the HTTP Accept-Language header. This class is based on examples from Jason Hunter's book Java Servlet Programming.

Author:
Frank Y. Kim, Jon S. Stevens

Constructor Summary
LocaleDetector()
          Deprecated.  
 
Method Summary
static java.util.Locale getLocale(RunData data)
          Deprecated. Attempts to pull the "Accept-Language" header out of the HttpServletRequest object and then parse it.
static java.util.Locale getLocale(java.lang.String languageHeader)
          Deprecated. This method parses the Accept-Language header and attempts to create a Locale out of it.
private static java.util.Locale getLocaleForLanguage(java.lang.String language)
          Deprecated. This method creates a Locale from the language.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Constructor Detail

LocaleDetector

public LocaleDetector()
Deprecated. 
Method Detail

getLocale

public static java.util.Locale getLocale(RunData data)
Deprecated. 
Attempts to pull the "Accept-Language" header out of the HttpServletRequest object and then parse it. If the header is not present, it will return a null Locale.
Parameters:
data - Turbine information.
Returns:
A Locale.

getLocale

public static java.util.Locale getLocale(java.lang.String languageHeader)
Deprecated. 
This method parses the Accept-Language header and attempts to create a Locale out of it.
Parameters:
languageHeader - A String with the language header.
Returns:
A Locale.

getLocaleForLanguage

private static java.util.Locale getLocaleForLanguage(java.lang.String language)
Deprecated. 
This method creates a Locale from the language.
Parameters:
language - A String with the language.
Returns:
A Locale.


Copyright © 2000-2002 Apache Software Foundation. All Rights Reserved.