|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object velosurf.web.l10n.HTTPLocalizerTool
public abstract class HTTPLocalizerTool
This class rely on the "Accepted-Language" HTTP header to detect the appropriate locale to be used.
This tool accepts a "default-locale" configuration parameter in toolbox.xml.
It is meant for the session scope.
Field Summary | |
---|---|
protected java.util.Locale |
locale
current locale |
private java.lang.ref.WeakReference<javax.servlet.http.HttpSession> |
session
keep a reference on the session |
Constructor Summary | |
---|---|
HTTPLocalizerTool()
|
Method Summary | |
---|---|
void |
checkLocaleChange()
Check that the locale has not changed in the session. |
abstract java.lang.String |
get(java.lang.Object id)
Get the localized message for this key. |
java.lang.String |
get(java.lang.Object id,
java.lang.Object... params)
Get the localized parameterized message for this key. |
java.util.Locale |
getBestLocale(java.util.List<java.util.Locale> locales)
Get the locale best matching available localized data among a list. |
java.util.Locale |
getLocale()
Current lcoale getter. |
abstract boolean |
hasLocale(java.util.Locale locale)
Check for the presence of a locale. |
void |
init(java.lang.Object initData)
Initialize this tool. |
private static java.util.List<java.util.Locale> |
listFromEnum(java.util.Enumeration e)
Transform an enumeration into a list of locales. |
void |
setLocale(java.util.Locale locale)
Current locale setter. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.lang.ref.WeakReference<javax.servlet.http.HttpSession> session
protected java.util.Locale locale
Constructor Detail |
---|
public HTTPLocalizerTool()
Method Detail |
---|
public void init(java.lang.Object initData)
initData
- a view contextprivate static java.util.List<java.util.Locale> listFromEnum(java.util.Enumeration e)
e
- enumeration
public java.util.Locale getBestLocale(java.util.List<java.util.Locale> locales)
locales
- list of input locales
public abstract boolean hasLocale(java.util.Locale locale)
locale
- locale to check
public void setLocale(java.util.Locale locale)
setLocale
in interface Localizer
locale
- localepublic java.util.Locale getLocale()
getLocale
in interface Localizer
public void checkLocaleChange()
public abstract java.lang.String get(java.lang.Object id)
get
in interface Localizer
id
- message key
public java.lang.String get(java.lang.Object id, java.lang.Object... params)
get
in interface Localizer
id
- message keyparams
- message parameters
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |