|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.fulcrum.localization.SimpleLocalizationServiceImpl
org.apache.fulcrum.localization.DefaultLocalizationService
public class DefaultLocalizationService
This class is the single point of access to all localization resources. It caches different ResourceBundles for different Locales.
Usage example:
LocalizationService ls = (LocalizationService) TurbineServices
.getInstance().getService(LocalizationService.SERVICE_NAME);
Then call SimpleLocalizationServiceImpl.getString(String, Locale, String)
, or one of
four methods to retrieve a ResourceBundle:
Field Summary |
---|
Fields inherited from interface org.apache.fulcrum.localization.LocalizationService |
---|
ACCEPT_LANGUAGE, ROLE, SERVICE_NAME |
Constructor Summary | |
---|---|
DefaultLocalizationService()
Creates a new instance. |
Method Summary | |
---|---|
ResourceBundle |
getBundle(javax.servlet.http.HttpServletRequest req)
This method returns a ResourceBundle given the Locale information supplied in the HTTP "Accept-Language" header which is stored in HttpServletRequest. |
ResourceBundle |
getBundle(String bundleName,
javax.servlet.http.HttpServletRequest req)
This method returns a ResourceBundle given the bundle name and the Locale information supplied in the HTTP "Accept-Language" header which is stored in HttpServletRequest. |
ResourceBundle |
getBundle(String bundleName,
String languageHeader)
This method returns a ResourceBundle given the bundle name and the Locale information supplied in the HTTP "Accept-Language" header. |
Locale |
getLocale(javax.servlet.http.HttpServletRequest req)
Attempts to pull the Accept-Language header out of
the HttpServletRequest object and then parse it. |
Locale |
getLocale(String header)
Parses the Accept-Language header and attempts to
create a Locale from it. |
Methods inherited from class org.apache.fulcrum.localization.SimpleLocalizationServiceImpl |
---|
configure, format, format, format, getBundle, getBundle, getBundle, getBundleNames, getDefaultBundleName, getDefaultCountry, getDefaultLanguage, getDefaultLocale, getString, getStringOrNull, initBundleNames, initialize, setBundle |
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled |
---|
enableLogging, getLogger, setupLogger, setupLogger, setupLogger |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.fulcrum.localization.SimpleLocalizationService |
---|
format, format, format, getBundle, getBundle, getBundle, getBundleNames, getDefaultBundleName, getDefaultCountry, getDefaultLanguage, getDefaultLocale, getString, setBundle |
Constructor Detail |
---|
public DefaultLocalizationService()
Method Detail |
---|
public ResourceBundle getBundle(String bundleName, String languageHeader)
getBundle
in interface LocalizationService
bundleName
- Name of bundle.languageHeader
- A String with the language header.
public ResourceBundle getBundle(javax.servlet.http.HttpServletRequest req)
getBundle
in interface LocalizationService
req
- HttpServletRequest.
public ResourceBundle getBundle(String bundleName, javax.servlet.http.HttpServletRequest req)
getBundle
in interface LocalizationService
bundleName
- Name of the bundle to use if the request's
locale cannot be resolved.req
- HttpServletRequest.
public Locale getLocale(javax.servlet.http.HttpServletRequest req)
LocalizationService
Accept-Language
header out of
the HttpServletRequest
object and then parse it.
If the header is not present, it will return a
null
Locale
.
getLocale
in interface LocalizationService
req
- The HTTP request to parse the
Accept-Language
of.
LocalizationService.getLocale(HttpServletRequest)
public Locale getLocale(String header)
LocalizationService
Accept-Language
header and attempts to
create a Locale
from it.
getLocale
in interface LocalizationService
LocalizationService.getLocale(String)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |