Class FixedLocaleResolver
- java.lang.Object
-
- com.aspectran.core.support.i18n.locale.AbstractLocaleResolver
-
- com.aspectran.core.support.i18n.locale.FixedLocaleResolver
-
- All Implemented Interfaces:
LocaleResolver
public class FixedLocaleResolver extends AbstractLocaleResolver
LocaleResolver
implementation that always returns a fixed default locale and optionally time zone. Default is the current JVM's default locale.Note: Does not support
setLocale(Context)
, as the fixed locale and time zone cannot be changed.Created: 2016. 9. 5.
-
-
Constructor Summary
Constructors Constructor Description FixedLocaleResolver()
Create a default FixedLocaleResolver, exposing a configured default locale (or the JVM's default locale as fallback).FixedLocaleResolver(java.util.Locale locale)
Create a FixedLocaleResolver that exposes the given locale.FixedLocaleResolver(java.util.Locale locale, java.util.TimeZone timeZone)
Create a FixedLocaleResolver that exposes the given locale and time zone.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Locale
resolveLocale(Translet translet)
Resolve the current locale via the given translet.java.util.TimeZone
resolveTimeZone(Translet translet)
Resolve the current timezone via the given translet.void
setLocale(Translet translet, java.util.Locale locale)
Set the current locale to the given one.void
setTimeZone(Translet translet, java.util.TimeZone timeZone)
Set the current timezone to the given one.-
Methods inherited from class com.aspectran.core.support.i18n.locale.AbstractLocaleResolver
getDefaultLocale, getDefaultTimeZone, resolveDefaultLocale, resolveDefaultTimeZone, setDefaultLocale, setDefaultLocale, setDefaultTimeZone, setDefaultTimeZone
-
-
-
-
Constructor Detail
-
FixedLocaleResolver
public FixedLocaleResolver()
Create a default FixedLocaleResolver, exposing a configured default locale (or the JVM's default locale as fallback).
-
FixedLocaleResolver
public FixedLocaleResolver(java.util.Locale locale)
Create a FixedLocaleResolver that exposes the given locale.- Parameters:
locale
- the locale to expose
-
FixedLocaleResolver
public FixedLocaleResolver(java.util.Locale locale, java.util.TimeZone timeZone)
Create a FixedLocaleResolver that exposes the given locale and time zone.- Parameters:
locale
- the locale to exposetimeZone
- the time zone to expose
-
-
Method Detail
-
resolveLocale
public java.util.Locale resolveLocale(Translet translet)
Description copied from interface:LocaleResolver
Resolve the current locale via the given translet. Can return a default locale as fallback in any case.- Parameters:
translet
- the translet to resolve the locale for- Returns:
- the current locale (never
null
)
-
resolveTimeZone
public java.util.TimeZone resolveTimeZone(Translet translet)
Description copied from interface:LocaleResolver
Resolve the current timezone via the given translet. Can return a default timezone as fallback in any case.- Parameters:
translet
- the translet to resolve the timezone for- Returns:
- the current timezone (never
null
)
-
setLocale
public void setLocale(Translet translet, java.util.Locale locale)
Description copied from interface:LocaleResolver
Set the current locale to the given one.- Specified by:
setLocale
in interfaceLocaleResolver
- Overrides:
setLocale
in classAbstractLocaleResolver
- Parameters:
translet
- the translet to resolve the locale forlocale
- the new locale, ornull
to clear the locale
-
setTimeZone
public void setTimeZone(Translet translet, java.util.TimeZone timeZone)
Description copied from interface:LocaleResolver
Set the current timezone to the given one.- Specified by:
setTimeZone
in interfaceLocaleResolver
- Overrides:
setTimeZone
in classAbstractLocaleResolver
- Parameters:
translet
- the translet to resolve the locale fortimeZone
- the new timezone, ornull
to clear the timezone
-
-