@PublicApi public interface

LocaleManager

com.atlassian.jira.config.LocaleManager
Known Indirect Subclasses

@PublicApi

This interface is designed for plugins to consume (call its methods).

Clients of @PublicApi can expect that programs compiled against a given version will remain binary compatible with later versions of the @PublicApi as per each product's API policy as long as the client does not implement/extend @PublicApi interfaces or classes (refer to each product's API policy for the exact guarantee---usually binary compatibility is guaranteed at least across minor versions).

Note: since @PublicApi interfaces and classes are not designed to be implemented or extended by clients, we may perform certain types of binary-incompatible changes to these classes and interfaces, but these will not affect well-behaved clients that do not extend/implement these types (in general, only classes and interfaces annotated with @PublicSpi are safe to extend/implement).

Class Overview

Provides Locale information for this JIRA instance.

Summary

Constants
String DEFAULT_LOCALE The default locale id.
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

Constants

public static final String DEFAULT_LOCALE

The default locale id.

Constant Value: "-1"

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