public class

CachingI18nFactory

extends Object
implements InitializingComponent Startable I18nHelper.BeanFactory
java.lang.Object
   ↳ com.atlassian.jira.i18n.CachingI18nFactory

Class Overview

As the name implies: a factory that caches for different locales I18nHelper.

With the advent of Plugins-2 we need to iterate through all enabled plugins and get their i18n resources when an I18nHelper is required.

Summary

Public Constructors
CachingI18nFactory(JiraLocaleUtils jiraLocaleUtils, EventPublisher eventPublisher, BackingI18nFactory i18nBackingFactory, UserLocaleStore userLocaleStore, ComponentLocator locator, ResourceBundleCacheCleaner resourceBundleCacheCleaner)
Public Methods
void afterInstantiation()
I18nHelper getInstance(Locale locale)
Returns an I18nHelper instance associated with the provided Locale.
I18nHelper getInstance(ApplicationUser user)
Returns an I18nHelper instance associated with the provided User's locale preference.
String getStateHashCode()
An opaque string that changes whenever the underlying i18n bundles change (e.g.
@EventListener void pluginEnabled(PluginEnabledEvent event)
@EventListener void pluginModuleDisabled(PluginModuleDisabledEvent event)
@EventListener void pluginModuleEnabled(PluginModuleEnabledEvent event)
@EventListener void pluginRefreshed(PluginRefreshedEvent event)
void start()
This method will be called after the plugin system is fully initialised and all components added to the dependency injection framework.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.InitializingComponent
From interface com.atlassian.jira.extension.Startable
From interface com.atlassian.jira.util.I18nHelper.BeanFactory

Public Constructors

public CachingI18nFactory (JiraLocaleUtils jiraLocaleUtils, EventPublisher eventPublisher, BackingI18nFactory i18nBackingFactory, UserLocaleStore userLocaleStore, ComponentLocator locator, ResourceBundleCacheCleaner resourceBundleCacheCleaner)

Public Methods

public void afterInstantiation ()

public I18nHelper getInstance (Locale locale)

Returns an I18nHelper instance associated with the provided Locale. Note that since JIRA 6.0 you can have an I18nHelper injected directly into your class, and it will be specific to the currently logged in user.

Parameters
locale the locale in play
Returns

public I18nHelper getInstance (ApplicationUser user)

Returns an I18nHelper instance associated with the provided User's locale preference. Note that since JIRA 6.0 you can have an I18nHelper injected directly into your class, and it will be specific to the currently logged in user.

Parameters
user the user in play
Returns
  • an I18nHelper instance associated with the provided User's locale preference

public String getStateHashCode ()

An opaque string that changes whenever the underlying i18n bundles change (e.g. when a new translation pack is installed)

@EventListener public void pluginEnabled (PluginEnabledEvent event)

@EventListener public void pluginModuleDisabled (PluginModuleDisabledEvent event)

@EventListener public void pluginModuleEnabled (PluginModuleEnabledEvent event)

@EventListener public void pluginRefreshed (PluginRefreshedEvent event)

public void start ()

This method will be called after the plugin system is fully initialised and all components added to the dependency injection framework.