| |
|
| java.lang.Object org.jasig.portal.i18n.LocaleManager
LocaleManager | public class LocaleManager implements Serializable(Code) | | Manages locales on behalf of a user.
This class currently keeps track of locales at the following levels:
- User's locale preferences (associated with a user ID)
- Browser's locale preferences (from the Accept-Language request header)
- Session's locale preferences (set via the portal request parameter uP_locales)
- Portal's locale preferences (set in portal.properties)
Eventually, this class will also keep track of locale preferences at
the following levels:
- Layout node's locale preferences
- User profile's locale preferences
author: Shoji Kajita kajita@itc.nagoya-u.ac.jp author: Ken Weiner, kweiner@unicon.net version: $Revision: 35884 $ |
Constructor Summary | |
public | LocaleManager(IPerson person) Constructor that associates a locale manager with a user. | public | LocaleManager(IPerson person, String acceptLanguage) Constructor that sets up locales according to
the Accept-Language request header
from a user's browser. |
DEFAULT_LOCALE_AWARE | final public static boolean DEFAULT_LOCALE_AWARE(Code) | | Default value for localeAware.
This value will be used when the corresponding property cannot be loaded.
|
LocaleManager | public LocaleManager(IPerson person)(Code) | | Constructor that associates a locale manager with a user.
Parameters: person - the user |
LocaleManager | public LocaleManager(IPerson person, String acceptLanguage)(Code) | | Constructor that sets up locales according to
the Accept-Language request header
from a user's browser.
Parameters: person - the user Parameters: acceptLanguage - the Accept-Language request header from a user's browser |
getLocales | public Locale[] getLocales()(Code) | | Produces a sorted list of locales according to locale preferences
obtained from several places. The following priority is given:
session, user, browser, portal, and jvm.
the sorted list of locales |
getPortalLocales | public static Locale[] getPortalLocales()(Code) | | |
isLocaleAware | public static boolean isLocaleAware()(Code) | | |
parseLocale | public static Locale parseLocale(String localeString)(Code) | | Helper method to produce a java.util.Locale object from
a locale string such as en_US or ja_JP.
Parameters: localeString - a locale string such as en_US a java.util.Locale object representing the locale string |
parseLocales | public static Locale[] parseLocales(String localeStringList)(Code) | | Helper method to produce a java.util.Locale array from
a comma-delimited locale string list, e.g. "en_US,ja_JP"
Parameters: localeStringList - the locales to parse an array of locales representing the locale string list |
persistUserLocales | public void persistUserLocales(Locale[] userLocales) throws Exception(Code) | | Stores the user locales persistantly.
Parameters: userLocales - the user locales preference throws: Exception - |
setBrowserLocales | public void setBrowserLocales(Locale[] browserLocales)(Code) | | |
setJvmLocale | public static void setJvmLocale(Locale jvmLocale)(Code) | | |
setPortalLocales | public static void setPortalLocales(Locale[] portalLocales)(Code) | | |
setSessionLocales | public void setSessionLocales(Locale[] sessionLocales)(Code) | | |
setUserLocales | public void setUserLocales(Locale[] userLocales)(Code) | | |
stringValueOf | public static String stringValueOf(Locale[] locales)(Code) | | Constructs a comma-delimited list of locales
that could be parsed back into a Locale
array with parseLocales(String localeStringList).
Parameters: locales - the list of locales a string representing the list of locales |
xmlValueOf | public static Document xmlValueOf(Locale[] locales)(Code) | | Creates an XML representation of a list of locales.
Parameters: locales - the locale list the locale list as XML |
xmlValueOf | public static Document xmlValueOf(Locale[] locales, Locale selectedLocale)(Code) | | Creates an XML representation of a list of locales.
If a selected locale is supplied, the XML element representing
the selected locale will have an attribute of selected with value
of true. This is helpful when constructing user interfaces that
indicate which locale is selected.
Parameters: locales - the locale list Parameters: selectedLocale - a locale that should be selected if it is in the list the locale list as XML |
|
|
|