Package com.atlassian.jira.i18n
Class CachingI18nFactory
java.lang.Object
com.atlassian.jira.i18n.CachingI18nFactory
- All Implemented Interfaces:
Startable,InitializingComponent,I18nHelper.BeanFactory
public class CachingI18nFactory
extends Object
implements I18nHelper.BeanFactory, InitializingComponent, Startable
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.
-
Constructor Summary
ConstructorsConstructorDescriptionCachingI18nFactory(JiraLocaleUtils jiraLocaleUtils, com.atlassian.event.api.EventPublisher eventPublisher, BackingI18nFactory i18nBackingFactory, UserLocaleStore userLocaleStore, ComponentLocator locator, ResourceBundleCacheCleaner resourceBundleCacheCleaner) Constructs factory in setup modeSetupConfiguration, that does not applyTerminologyVersionTracker.getVersionHashCode()togetStateHashCode()CachingI18nFactory(JiraLocaleUtils jiraLocaleUtils, com.atlassian.event.api.EventPublisher eventPublisher, BackingI18nFactory i18nBackingFactory, UserLocaleStore userLocaleStore, ComponentLocator locator, ResourceBundleCacheCleaner resourceBundleCacheCleaner, TerminologyVersionTracker terminologyVersionTracker) Constructs factory that does applyTerminologyVersionTracker.getVersionHashCode()togetStateHashCode() -
Method Summary
Modifier and TypeMethodDescriptionvoidCalled after all the beans are constructed and the ApplicationContext is fully populated.getInstance(ApplicationUser user) Returns anI18nHelperinstance associated with the providedUser's locale preference.getInstance(Locale locale) Returns anI18nHelperinstance associated with the providedLocale.An opaque string that changes whenever the underlying i18n bundles change (e.g.voidvoidvoidstart()This method will be called after the plugin system is fully initialised and all components added to the dependency injection framework.
-
Constructor Details
-
CachingI18nFactory
public CachingI18nFactory(JiraLocaleUtils jiraLocaleUtils, com.atlassian.event.api.EventPublisher eventPublisher, BackingI18nFactory i18nBackingFactory, UserLocaleStore userLocaleStore, ComponentLocator locator, ResourceBundleCacheCleaner resourceBundleCacheCleaner) Constructs factory in setup modeSetupConfiguration, that does not applyTerminologyVersionTracker.getVersionHashCode()togetStateHashCode() -
CachingI18nFactory
public CachingI18nFactory(JiraLocaleUtils jiraLocaleUtils, com.atlassian.event.api.EventPublisher eventPublisher, BackingI18nFactory i18nBackingFactory, UserLocaleStore userLocaleStore, ComponentLocator locator, ResourceBundleCacheCleaner resourceBundleCacheCleaner, TerminologyVersionTracker terminologyVersionTracker) Constructs factory that does applyTerminologyVersionTracker.getVersionHashCode()togetStateHashCode()
-
-
Method Details
-
start
public void start()Description copied from interface:StartableThis method will be called after the plugin system is fully initialised and all components added to the dependency injection framework. -
afterInstantiation
public void afterInstantiation()Description copied from interface:InitializingComponentCalled after all the beans are constructed and the ApplicationContext is fully populated. Order of execution is order of bean creation, driven by InitializingComponentProcessor.- Specified by:
afterInstantiationin interfaceInitializingComponent
-
onJiraPluginCacheResetEvent
-
onTerminologyChangeEvent
-
getInstance
Description copied from interface:I18nHelper.BeanFactoryReturns anI18nHelperinstance associated with the providedLocale. Note that since JIRA 6.0 you can have anI18nHelperinjected directly into your class, and it will be specific to the currently logged in user.- Specified by:
getInstancein interfaceI18nHelper.BeanFactory- Parameters:
locale- the locale in play- Returns:
- an
I18nHelperinstance associated with the providedLocale
-
getInstance
Description copied from interface:I18nHelper.BeanFactoryReturns anI18nHelperinstance associated with the providedUser's locale preference. Note that since JIRA 6.0 you can have anI18nHelperinjected directly into your class, and it will be specific to the currently logged in user.- Specified by:
getInstancein interfaceI18nHelper.BeanFactory- Parameters:
user- the user in play- Returns:
- an
I18nHelperinstance associated with the providedUser's locale preference
-
getStateHashCode
An opaque string that changes whenever the underlying i18n bundles change (e.g. when a new translation pack is installed)
-