com.atlassian.sal.api.message
Interface LocaleResolver

All Known Implementing Classes:
SystemDefaultLocaleResolver

public interface LocaleResolver

This interface is responsible for resolving the current locale.

Since:
2.0

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.
 

Method Detail

getLocale

Locale getLocale(javax.servlet.http.HttpServletRequest request)
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).

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

getLocale

Locale getLocale()
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).

Returns:
Locale to be used in i18n and l10n. Locale.getDefault() if none found.

getLocale

Locale getLocale(@Nullable
                 UserKey userKey)
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.

Parameters:
userKey - the user. Can be null.
Returns:
Locale to be used in i18n and l10n. Locale.getDefault() if none found.
Since:
2.10

getSupportedLocales

Set<Locale> getSupportedLocales()
Returns a set of all the supported locales by the host application. This is all the language packs that are installed.

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.