com.atlassian.jira.util.resourcebundle
Interface ResourceBundleLoader

All Known Implementing Classes:
InitialResourceBundleLoader, MockResourceBundleLoader

@Immutable
public interface ResourceBundleLoader

Searches JIRA and its associated plugins for ResourceBundles of the correct type and locale and loads them into a map for consumption in JIRA. This search will iterate through language packs (which are plugins), general plugins and JIRA's own static resources to find all the ResourceBundles and merge them into one.

The search must be limited to a particular Locale and resource type. JIRA currently supports the following resource types:

Language
JIRA languages
Help Paths
Sources for JIRA's internal Help

The only safe way to obtain ResourceBundleLoader is to inject it. Initially, this instance will be configured to search for language resources using JIRA's default Locale. These settings cannot be changed once the object is created, however, it is easy to create new instances with the correct settings using the locale(java.util.Locale), helpText() and i18n(). For example:

 @Inject
  private ResourceBundleLoader initial;

  public void doSomething() {
      //Search for the HelpPath resources associated with the US locale.
      LoadResult result = initial.locale(Locale.US).helpPath().load();
  }
 
 

This object is immutable and may safely be cached and/or shared between threads.

Since:
v6.2.3

Nested Class Summary
static class ResourceBundleLoader.LoadResult
          Result of the load operation.
 
Method Summary
 ResourceBundleLoader helpText()
          Returns a loader that will search for resources associated with HelpUrls.
 ResourceBundleLoader i18n()
          Returns a loader that will search for resources associated with a I18nHelper.
 ResourceBundleLoader.LoadResult load()
          Perform a search and load all the configured resources.
 ResourceBundleLoader locale(Locale locale)
          Returns a loader that will search for resources associated with the passed Locale.
 

Method Detail

locale

ResourceBundleLoader locale(Locale locale)
Returns a loader that will search for resources associated with the passed Locale. This method will not mutate this and as such the caller must use the returned loader to search against the passed Locale.

Parameters:
locale - the locale.
Returns:
a loader that will search for resources associated with the passed Locale. The type of search remains unchanged.

helpText

ResourceBundleLoader helpText()
Returns a loader that will search for resources associated with HelpUrls. The Locale used by the search remains unchanged. This method will not mutate this and as such the caller must use the returned loader to find the right type of resources.

Returns:
a loader that will search for resources associated with HelpUrls. The Locale used by the search remains unchanged.

i18n

ResourceBundleLoader i18n()
Returns a loader that will search for resources associated with a I18nHelper. The Locale used by the search remains unchanged. This method will not mutate this and as such the caller must use the returned loader to find the right type of resources.

Returns:
a loader that will search for resources associated with a I18nHelper. The Locale used by the search remains unchanged.

load

ResourceBundleLoader.LoadResult load()
Perform a search and load all the configured resources.

Returns:
the loaded resources with the plugins that provided them.


Copyright © 2002-2014 Atlassian. All Rights Reserved.