Package org.jvnet.localizer
Class LocaleProvider
- java.lang.Object
-
- org.jvnet.localizer.LocaleProvider
-
public abstract class LocaleProvider extends java.lang.Object
Determines the locale, normally from the context.For example, in webapps, you might use the current request's Accept-Language header, or maybe it's just an invocation to
Locale.getDefault()
.A single instance of
LocaleProvider
is maintained in this class for the use byResourceBundleHolder
.- Author:
- Kohsuke Kawaguchi
-
-
Field Summary
Fields Modifier and Type Field Description static LocaleProvider
DEFAULT
LocaleProvider
that usesLocale.getDefault()
.
-
Constructor Summary
Constructors Constructor Description LocaleProvider()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract java.util.Locale
get()
Determines the locale to be used.static java.util.Locale
getLocale()
Short forgetProvider().get()
static LocaleProvider
getProvider()
Gets the currently installed system-wideLocaleProvider
.static void
setProvider(LocaleProvider p)
-
-
-
Field Detail
-
DEFAULT
public static final LocaleProvider DEFAULT
LocaleProvider
that usesLocale.getDefault()
.
-
-
Method Detail
-
get
public abstract java.util.Locale get()
Determines the locale to be used.- Returns:
- must not be null.
-
setProvider
public static void setProvider(LocaleProvider p)
-
getProvider
public static LocaleProvider getProvider()
Gets the currently installed system-wideLocaleProvider
.- Returns:
- always non-null.
-
getLocale
public static java.util.Locale getLocale()
Short forgetProvider().get()
-
-