com.atlassian.jira.config
Class DefaultLocaleManager

java.lang.Object
  extended by com.atlassian.jira.config.DefaultLocaleManager
All Implemented Interfaces:
LocaleManager

public class DefaultLocaleManager
extends Object
implements LocaleManager


Field Summary
 
Fields inherited from interface com.atlassian.jira.config.LocaleManager
DEFAULT_LOCALE
 
Constructor Summary
DefaultLocaleManager(JiraLocaleUtils jiraLocaleUtils, I18nHelper.BeanFactory beanFactory)
           
 
Method Summary
 Set<Locale> getInstalledLocales()
          Returns a set of locales supported by this JIRA instance.
 Map<String,String> getInstalledLocalesWithDefault(Locale defaultLocale, I18nHelper i18nHelper)
          Returns a mapping of localeString to its displayname.
 Locale getLocale(String locale)
          Given a string, return the corresponding Locale.
 Locale getLocaleFor(ApplicationUser user)
          Returns the locale for the given user.
 void validateUserLocale(com.atlassian.crowd.embedded.api.User loggedInUser, String locale, ErrorCollection errorCollection)
          Given a user entered locale string this method ensures that it is in fact a locale that exists in this instance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultLocaleManager

public DefaultLocaleManager(JiraLocaleUtils jiraLocaleUtils,
                            I18nHelper.BeanFactory beanFactory)
Method Detail

getInstalledLocales

public Set<Locale> getInstalledLocales()
Description copied from interface: LocaleManager
Returns a set of locales supported by this JIRA instance. This is typically the language packs installed.

Specified by:
getInstalledLocales in interface LocaleManager
Returns:
a set of locales supported

getInstalledLocalesWithDefault

public Map<String,String> getInstalledLocalesWithDefault(Locale defaultLocale,
                                                         I18nHelper i18nHelper)
Description copied from interface: LocaleManager
Returns a mapping of localeString to its displayname. Also includes a 'Default' locale.

Specified by:
getInstalledLocalesWithDefault in interface LocaleManager
Parameters:
defaultLocale - The locale to use as the default
i18nHelper - Required to internationalize the 'Default'
Returns:
A mapping from localeString to its displayname.

getLocale

public Locale getLocale(String locale)
Description copied from interface: LocaleManager
Given a string, return the corresponding Locale.

Specified by:
getLocale in interface LocaleManager
Parameters:
locale - Locale in string form
Returns:
The Locale object

getLocaleFor

public Locale getLocaleFor(ApplicationUser user)
Description copied from interface: LocaleManager
Returns the locale for the given user.

Specified by:
getLocaleFor in interface LocaleManager
Parameters:
user - The user
Returns:
the locale for the given user.

validateUserLocale

public void validateUserLocale(com.atlassian.crowd.embedded.api.User loggedInUser,
                               String locale,
                               ErrorCollection errorCollection)
Description copied from interface: LocaleManager
Given a user entered locale string this method ensures that it is in fact a locale that exists in this instance

Specified by:
validateUserLocale in interface LocaleManager
Parameters:
loggedInUser - The user performing the operation
locale - the locale String to validate (e.g. en_UK)
errorCollection - Error collection to record errors in


Copyright © 2002-2013 Atlassian. All Rights Reserved.