Class DefaultLocaleProvider
- java.lang.Object
-
- org.nuxeo.ecm.platform.web.common.locale.DefaultLocaleProvider
-
- All Implemented Interfaces:
LocaleProvider
- Direct Known Subclasses:
UserLocaleProvider
public class DefaultLocaleProvider extends Object implements LocaleProvider
Provides the default locale and timezone from the server.- Since:
- 5.6
-
-
Constructor Summary
Constructors Constructor Description DefaultLocaleProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Locale
getDefaultLocale()
protected TimeZone
getDefaultTimezone()
Locale
getLocale(CoreSession repo)
Locale
getLocale(DocumentModel userProfileDoc)
Gets the locale stored in the given user profile.Locale
getLocaleWithDefault(String requestedLocale)
Returns the default locale for given requested locale.Locale
getLocaleWithDefault(CoreSession session)
Locale
getLocaleWithDefault(DocumentModel userProfileDoc)
TimeZone
getTimeZone(CoreSession repo)
-
-
-
Constructor Detail
-
DefaultLocaleProvider
public DefaultLocaleProvider()
-
-
Method Detail
-
getLocale
public Locale getLocale(CoreSession repo)
- Specified by:
getLocale
in interfaceLocaleProvider
- Returns:
- the Locale to be used or null to let the caller decides.
-
getLocale
public Locale getLocale(DocumentModel userProfileDoc)
Description copied from interface:LocaleProvider
Gets the locale stored in the given user profile.- Specified by:
getLocale
in interfaceLocaleProvider
- Returns:
- the Locale to be used or null to let the caller decide
-
getTimeZone
public TimeZone getTimeZone(CoreSession repo)
- Specified by:
getTimeZone
in interfaceLocaleProvider
- Returns:
- the Timezone to be used or null to let the caller decides.
-
getLocaleWithDefault
public Locale getLocaleWithDefault(CoreSession session)
- Specified by:
getLocaleWithDefault
in interfaceLocaleProvider
- Returns:
- the Locale to be used or a default Locale
-
getLocaleWithDefault
public Locale getLocaleWithDefault(DocumentModel userProfileDoc)
- Specified by:
getLocaleWithDefault
in interfaceLocaleProvider
- Returns:
- the Locale stored in userProfile or a default Locale
-
getLocaleWithDefault
public Locale getLocaleWithDefault(String requestedLocale)
Description copied from interface:LocaleProvider
Returns the default locale for given requested locale.Checks if requested locale is part of supported locales, and fall-backs on a default locale if not (or if requested locale is empty).
- Specified by:
getLocaleWithDefault
in interfaceLocaleProvider
-
getDefaultLocale
protected Locale getDefaultLocale()
-
getDefaultTimezone
protected TimeZone getDefaultTimezone()
-
-