|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jasig.portal.i18n.LocaleManager
public class LocaleManager
Manages locales on behalf of a user.
This class currently keeps track of locales at the following levels:
| Field Summary | |
|---|---|
static boolean |
DEFAULT_LOCALE_AWARE
Default value for localeAware. |
| Constructor Summary | |
|---|---|
LocaleManager(IPerson person)
Constructor that associates a locale manager with a user. |
|
LocaleManager(IPerson person,
String acceptLanguage)
Constructor that sets up locales according to the Accept-Language request header
from a user's browser. |
|
| Method Summary | |
|---|---|
Locale[] |
getBrowserLocales()
|
static Locale |
getJvmLocale()
|
Locale[] |
getLocales()
Produces a sorted list of locales according to locale preferences obtained from several places. |
static Locale[] |
getPortalLocales()
|
Locale[] |
getSessionLocales()
|
Locale[] |
getUserLocales()
|
static boolean |
isLocaleAware()
|
static Locale |
parseLocale(String localeString)
Helper method to produce a java.util.Locale object from
a locale string such as en_US or ja_JP. |
static Locale[] |
parseLocales(String localeStringList)
Helper method to produce a java.util.Locale array from
a comma-delimited locale string list, e.g. |
void |
persistUserLocales(Locale[] userLocales)
Stores the user locales persistantly. |
void |
setBrowserLocales(Locale[] browserLocales)
|
static void |
setJvmLocale(Locale jvmLocale)
|
static void |
setPortalLocales(Locale[] portalLocales)
|
void |
setSessionLocales(Locale[] sessionLocales)
|
void |
setUserLocales(Locale[] userLocales)
|
static String |
stringValueOf(Locale[] locales)
Constructs a comma-delimited list of locales that could be parsed back into a Locale array with parseLocales(String localeStringList). |
String |
toString()
|
static Document |
xmlValueOf(Locale[] locales)
Creates an XML representation of a list of locales. |
static Document |
xmlValueOf(Locale[] locales,
Locale selectedLocale)
Creates an XML representation of a list of locales. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final boolean DEFAULT_LOCALE_AWARE
| Constructor Detail |
|---|
public LocaleManager(IPerson person)
person - the user
public LocaleManager(IPerson person,
String acceptLanguage)
Accept-Language request header
from a user's browser.
person - the useracceptLanguage - the Accept-Language request header from a user's browser| Method Detail |
|---|
public static boolean isLocaleAware()
public static Locale getJvmLocale()
public static Locale[] getPortalLocales()
public Locale[] getBrowserLocales()
public Locale[] getUserLocales()
public Locale[] getSessionLocales()
public static void setJvmLocale(Locale jvmLocale)
public static void setPortalLocales(Locale[] portalLocales)
public void setBrowserLocales(Locale[] browserLocales)
public void setUserLocales(Locale[] userLocales)
public void setSessionLocales(Locale[] sessionLocales)
public Locale[] getLocales()
public static Locale[] parseLocales(String localeStringList)
java.util.Locale array from
a comma-delimited locale string list, e.g. "en_US,ja_JP"
localeStringList - the locales to parse
public static Locale parseLocale(String localeString)
java.util.Locale object from
a locale string such as en_US or ja_JP.
localeString - a locale string such as en_US
public static String stringValueOf(Locale[] locales)
locales - the list of locales
public void persistUserLocales(Locale[] userLocales)
throws Exception
userLocales - the user locales preference
Exceptionpublic static Document xmlValueOf(Locale[] locales)
locales - the locale list
public static Document xmlValueOf(Locale[] locales,
Locale selectedLocale)
locales - the locale listselectedLocale - a locale that should be selected if it is in the list
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||