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 modeSetupContainerRegistrar
, 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 TypeMethodDescriptionvoid
getInstance
(ApplicationUser user) Returns anI18nHelper
instance associated with the providedUser
's locale preference.getInstance
(Locale locale) Returns anI18nHelper
instance associated with the providedLocale
.An opaque string that changes whenever the underlying i18n bundles change (e.g.void
void
void
start()
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 modeSetupContainerRegistrar
, 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:Startable
This method will be called after the plugin system is fully initialised and all components added to the dependency injection framework. -
afterInstantiation
public void afterInstantiation()- Specified by:
afterInstantiation
in interfaceInitializingComponent
-
onJiraPluginCacheResetEvent
-
onTerminologyChangeEvent
-
getInstance
Description copied from interface:I18nHelper.BeanFactory
Returns anI18nHelper
instance associated with the providedLocale
. Note that since JIRA 6.0 you can have anI18nHelper
injected directly into your class, and it will be specific to the currently logged in user.- Specified by:
getInstance
in interfaceI18nHelper.BeanFactory
- Parameters:
locale
- the locale in play- Returns:
- an
I18nHelper
instance associated with the providedLocale
-
getInstance
Description copied from interface:I18nHelper.BeanFactory
Returns anI18nHelper
instance associated with the providedUser
's locale preference. Note that since JIRA 6.0 you can have anI18nHelper
injected directly into your class, and it will be specific to the currently logged in user.- Specified by:
getInstance
in interfaceI18nHelper.BeanFactory
- Parameters:
user
- the user in play- Returns:
- an
I18nHelper
instance 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)
-