@Service(value=LocaleProvider.class) public class LocaleProvider extends Object
| Constructor and Description |
|---|
LocaleProvider() |
| Modifier and Type | Method and Description |
|---|---|
void |
assertCurrentLocaleValid()
Asserts that a thread local Locale is set.
|
Locale |
getCurrentLocale()
Gets the locale used by the current thread.
|
Locale |
getEffectiveLocale()
Gets the effective locale for the current locale.
|
Locale |
getEffectiveLocale(Locale locale)
Gets the effective locale.
This is application-specific and allows narrowing the locales to the effectively supported locales. |
static LocaleProvider |
getInstance()
The singleton.
|
Locale |
getLocale()
Gets the locale.
|
void |
setCurrentLocale(Locale locale)
Sets the session used by the current thread.
The session is stored as ThreadLocal. |
public static LocaleProvider getInstance()
public Locale getCurrentLocale()
public Locale getLocale()
If there is no thread-local Locale, the default Locale is returned.
public void setCurrentLocale(Locale locale)
ThreadLocal.locale - the localepublic void assertCurrentLocaleValid()
TentackleRuntimeException - if thread-local locale is nullpublic Locale getEffectiveLocale(Locale locale)
locale - the requested localepublic Locale getEffectiveLocale()
Tentackle - a domain driven enterprise framework