com.atlassian.confluence.languages
Class DefaultLocaleManager

java.lang.Object
  extended by com.atlassian.confluence.languages.DefaultLocaleManager
All Implemented Interfaces:
LocaleManager, org.springframework.beans.factory.InitializingBean
Direct Known Subclasses:
TestingLocaleManager

public class DefaultLocaleManager
extends Object
implements LocaleManager, org.springframework.beans.factory.InitializingBean


Field Summary
 
Fields inherited from interface com.atlassian.confluence.languages.LocaleManager
DEFAULT_LOCALE
 
Constructor Summary
DefaultLocaleManager()
           
 
Method Summary
 void afterPropertiesSet()
           
 Locale getLocale(com.atlassian.user.User user)
          Returns the user's locale if they have one set in their preferences, otherwise returns the site default locale.
 Locale getSiteDefaultLocale()
           
 UserAccessor getUserAccessor()
           
 void setCacheManager(com.atlassian.cache.CacheManager cacheManager)
           
 void setLanguage(String language)
          Should set the language string as given by Locale (en-gb for example) in a THREAD LOCAL cache.
 void setLanguageManager(LanguageManager languageManager)
           
 void setRequestLanguages(String languageString)
          Should set the language string from the request in a THREAD LOCAL cache.
 void setSettingsManager(SettingsManager settingsManager)
           
 void setUserAccessorSupplier(com.atlassian.util.concurrent.Supplier<UserAccessor> userAccessorSupplier)
           
 Locale toLocale(String userLocaleString)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultLocaleManager

public DefaultLocaleManager()
Method Detail

setUserAccessorSupplier

public void setUserAccessorSupplier(com.atlassian.util.concurrent.Supplier<UserAccessor> userAccessorSupplier)

setCacheManager

public void setCacheManager(com.atlassian.cache.CacheManager cacheManager)

setLanguageManager

public void setLanguageManager(LanguageManager languageManager)

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
Exception

getLocale

public Locale getLocale(com.atlassian.user.User user)
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:
getLocale in interface LocaleManager

getSiteDefaultLocale

public Locale getSiteDefaultLocale()
Specified by:
getSiteDefaultLocale in interface LocaleManager
Returns:
The default site locale, or LocaleManager.DEFAULT_LOCALE if none is set.

toLocale

public Locale toLocale(String userLocaleString)
Specified by:
toLocale in interface LocaleManager

setSettingsManager

public void setSettingsManager(SettingsManager settingsManager)

getUserAccessor

public UserAccessor getUserAccessor()

setRequestLanguages

public void setRequestLanguages(String languageString)
Description copied from interface: LocaleManager
Should set the language string from the request in a THREAD LOCAL cache.

Specified by:
setRequestLanguages in interface LocaleManager

setLanguage

public void setLanguage(String language)
Description copied from interface: LocaleManager
Should 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:
setLanguage in interface LocaleManager


Copyright © 2003-2013 Atlassian. All Rights Reserved.