public class

DefaultLocaleManager

extends Object
implements LocaleManager
java.lang.Object
   ↳ com.atlassian.jira.config.DefaultLocaleManager

Summary

[Expand]
Inherited Constants
From interface com.atlassian.jira.config.LocaleManager
Public Constructors
DefaultLocaleManager(JiraLocaleUtils jiraLocaleUtils, I18nHelper.BeanFactory beanFactory)
Public Methods
Set<Locale> getInstalledLocales()
Returns a set of locales supported by this JIRA instance.
Map<StringString> 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(ApplicationUser 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
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.config.LocaleManager

Public Constructors

public DefaultLocaleManager (JiraLocaleUtils jiraLocaleUtils, I18nHelper.BeanFactory beanFactory)

Public Methods

public Set<Locale> getInstalledLocales ()

Returns a set of locales supported by this JIRA instance. This is typically the language packs installed.

Returns
  • a set of locales supported

public Map<StringString> getInstalledLocalesWithDefault (Locale defaultLocale, I18nHelper i18nHelper)

Returns a mapping of localeString to its displayname. Also includes a 'Default' locale.

Parameters
defaultLocale The locale to use as the default
i18nHelper Required to internationalize the 'Default'
Returns
  • A mapping from localeString to its displayname.

public Locale getLocale (String locale)

Given a string, return the corresponding Locale.

Parameters
locale Locale in string form
Returns

public Locale getLocaleFor (ApplicationUser user)

Returns the locale for the given user.

Parameters
user The user
Returns
  • the locale for the given user.

public void validateUserLocale (ApplicationUser 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

Parameters
loggedInUser The user performing the operation
locale the locale String to validate (e.g. en_UK)
errorCollection Error collection to record errors in