com.atlassian.sal.core.message
Class SystemDefaultLocaleResolver

java.lang.Object
  extended by com.atlassian.sal.core.message.SystemDefaultLocaleResolver
All Implemented Interfaces:
LocaleResolver

public class SystemDefaultLocaleResolver
extends Object
implements LocaleResolver

Simple resolver that only supports the system default locale.

Since:
2.2.0

Constructor Summary
SystemDefaultLocaleResolver()
           
 
Method Summary
 Locale getLocale()
          Resolve the Locale that should be used in internationalization and localization.
 Locale getLocale(javax.servlet.http.HttpServletRequest request)
          Given a request, resolve the Locale that should be used in internationalization and localization.
 Locale getLocale(UserKey userKey)
          Resolve the Locale that should be used in internationalization and localization.
 Set<Locale> getSupportedLocales()
          Returns a set of all the supported locales by the host application.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SystemDefaultLocaleResolver

public SystemDefaultLocaleResolver()
Method Detail

getLocale

public Locale getLocale(javax.servlet.http.HttpServletRequest request)
Description copied from interface: LocaleResolver
Given a request, resolve the Locale that should be used in internationalization and localization. The locale should be determined by first checking the remote users preferences, then defaulting to the application default locale if no preferred locale is set. May consult the given request for the preferred browser locales (if supported by the product).

Specified by:
getLocale in interface LocaleResolver
Parameters:
request - Request to check
Returns:
Locale to be used in i18n and l10n. Locale.getDefault() if none found.

getLocale

public Locale getLocale()
Description copied from interface: LocaleResolver
Resolve the Locale that should be used in internationalization and localization. The locale should be determined by checking the preferences of the user in the current authentication context if available, then default to the application default locale if no preferred locale is set. May consult the current request for the preferred browser locales (if supported by the product).

Specified by:
getLocale in interface LocaleResolver
Returns:
Locale to be used in i18n and l10n. Locale.getDefault() if none found.

getLocale

public Locale getLocale(UserKey userKey)
Description copied from interface: LocaleResolver
Resolve the Locale that should be used in internationalization and localization. The locale should be determined by checking the preferences of the given user. If no user is given, or the user cannot be found, or the user does not have any preferred locale, then default to the application default locale. Must not consult the current request for any preferred browser locales.

Specified by:
getLocale in interface LocaleResolver
Parameters:
userKey - the user. Can be null.
Returns:
Locale to be used in i18n and l10n. Locale.getDefault() if none found.

getSupportedLocales

public Set<Locale> getSupportedLocales()
Description copied from interface: LocaleResolver
Returns a set of all the supported locales by the host application. This is all the language packs that are installed.

Specified by:
getSupportedLocales in interface LocaleResolver
Returns:
an unmodifiable set of all the supported locales by the host application. Must contain at least one locale.


Copyright © 2015 Atlassian. All rights reserved.