Package org.apache.fulcrum.localization
Interface LocalizationService
- All Superinterfaces:
SimpleLocalizationService
- All Known Implementing Classes:
DefaultLocalizationService
Provides localization functionality using the interface provided
by ResourceBundle, plus leverages a "search path"
style traversal of the ResourceBundle objects named by
the locale.default.bundles to discover a value for a
given key.
It is suggested that one handle
dealing with concatenated messages
using MessageFormat and properties files.
- Version:
- $Id$
- Author:
- Jon S. Stevens, Daniel Rall, Leonard Richardson, Stephen McConnell, Thomas Vandahl
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiongetBundle(jakarta.servlet.http.HttpServletRequest req) Convenience method to get a ResourceBundle based on HTTP Accept-Language header in HttpServletRequest.Convenience method to get aResourceBundlebased on name and HTTPAccept-Languageheader from aHttpServletRequest.Convenience method to get a ResourceBundle based on name and HTTPAccept-Languageheader.getLocale(jakarta.servlet.http.HttpServletRequest req) Attempts to pull theAccept-Languageheader out of theHttpServletRequestobject and then parse it.Parses theAccept-Languageheader and attempts to create aLocalefrom it.Methods inherited from interface org.apache.fulcrum.localization.SimpleLocalizationService
format, format, format, getBundle, getBundle, getBundle, getBundleNames, getDefaultBundleName, getDefaultCountry, getDefaultLanguage, getDefaultLocale, getString, getString, setBundle
-
Field Details
-
ROLE
-
SERVICE_NAME
-
ACCEPT_LANGUAGE
A constant for the HTTPAccept-Languageheader.- See Also:
-
-
Method Details
-
getBundle
Convenience method to get a ResourceBundle based on name and HTTPAccept-Languageheader.- Parameters:
bundleName- Name of bundle.languageHeader- A String with the language header.- Returns:
- A localized ResourceBundle.
-
getBundle
Convenience method to get a ResourceBundle based on HTTP Accept-Language header in HttpServletRequest.- Parameters:
req- The HTTP request to parse theAccept-Languageof.- Returns:
- A localized ResourceBundle.
-
getBundle
Convenience method to get aResourceBundlebased on name and HTTPAccept-Languageheader from aHttpServletRequest.- Parameters:
bundleName- Name of bundle.req- The HTTP request to parse theAccept-Languageof.- Returns:
- A localized ResourceBundle.
-
getLocale
Attempts to pull theAccept-Languageheader out of theHttpServletRequestobject and then parse it. If the header is not present, it will return anullLocale.- Parameters:
req- The HTTP request to parse theAccept-Languageof.- Returns:
- The parsed locale.
-
getLocale
Parses theAccept-Languageheader and attempts to create aLocalefrom it.- Parameters:
languageHeader- The language header (i.e.en, es;q=0.8, zh-TW;q=0.1), ornullfor the locale corresponding to the default language and country.- Returns:
- The parsed locale, or a locale corresponding to the language and country defaults.
-