Class DefaultLocaleManager
java.lang.Object
com.atlassian.confluence.impl.locale.DefaultLocaleManager
- All Implemented Interfaces:
LocaleManager
- Since:
- 7.20
-
Field Summary
Fields inherited from interface com.atlassian.confluence.languages.LocaleManager
DEFAULT_LOCALE -
Constructor Summary
ConstructorsConstructorDescriptionDefaultLocaleManager(GlobalSettingsManager settingsManager, UserPreferencesAccessor userPreferencesAccessor, UserExistenceChecker userExistenceChecker, LanguageManager languageManager, com.atlassian.cache.CacheFactory cacheFactory, com.atlassian.config.ApplicationConfiguration applicationConfig) -
Method Summary
Modifier and TypeMethodDescriptiongetLocale(com.atlassian.user.User user) Returns the user's locale if they have one set in their preferences, otherwise returns the site default locale.final @NonNull LocaleInfogetLocaleInfo(@Nullable com.atlassian.user.User user) final voidinvalidateLocaleInfoCache(@Nullable com.atlassian.user.User user) voidsetLanguage(String language) Should set the language string as given by Locale (en-gb for example) in a THREAD LOCAL cache.voidsetRequestLanguages(String languageString) Should set the language string from the request in a THREAD LOCAL cache.
-
Constructor Details
-
DefaultLocaleManager
public DefaultLocaleManager(GlobalSettingsManager settingsManager, UserPreferencesAccessor userPreferencesAccessor, UserExistenceChecker userExistenceChecker, LanguageManager languageManager, com.atlassian.cache.CacheFactory cacheFactory, com.atlassian.config.ApplicationConfiguration applicationConfig)
-
-
Method Details
-
invalidateLocaleInfoCache
public final void invalidateLocaleInfoCache(@Nullable com.atlassian.user.User user) - Specified by:
invalidateLocaleInfoCachein interfaceLocaleManager
-
getLocaleInfo
- Specified by:
getLocaleInfoin interfaceLocaleManager- Parameters:
user-- Returns:
- a locale info with requested , selected and selection reason
-
getLocale
Returns the user's locale if they have one set in their preferences, otherwise returns the site default locale. Caches the result in the thread-local cache so we only check the preference or settings once per request.- Specified by:
getLocalein interfaceLocaleManager
-
getSiteDefaultLocale
- Specified by:
getSiteDefaultLocalein interfaceLocaleManager- Returns:
- The default site locale, or
LocaleManager.DEFAULT_LOCALEif none is set.
-
setRequestLanguages
Description copied from interface:LocaleManagerShould set the language string from the request in a THREAD LOCAL cache.- Specified by:
setRequestLanguagesin interfaceLocaleManager- Parameters:
languageString- comma- or semicolon-separated languages
-
setLanguage
Description copied from interface:LocaleManagerShould set the language string as given by Locale (en-gb for example) in a THREAD LOCAL cache. Does nothing if the language string is invalid.- Specified by:
setLanguagein interfaceLocaleManager- Parameters:
language- target language
-