com.atlassian.jira.i18n
Class CachingI18nFactory

java.lang.Object
  extended by 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
CachingI18nFactory(JiraLocaleUtils jiraLocaleUtils, com.atlassian.event.api.EventPublisher eventPublisher, BackingI18nFactory i18nBackingFactory, UserLocaleStore userLocaleStore, ComponentLocator locator)
           
 
Method Summary
 void afterInstantiation()
           
 I18nHelper getInstance(ApplicationUser user)
          Returns an I18nHelper instance associated with the provided User's locale preference.
 I18nHelper getInstance(Locale locale)
          Returns an I18nHelper instance associated with the provided Locale.
 I18nHelper getInstance(com.atlassian.crowd.embedded.api.User 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.
 void pluginEnabled(com.atlassian.plugin.event.events.PluginEnabledEvent event)
           
 void pluginModuleDisabled(com.atlassian.plugin.event.events.PluginModuleDisabledEvent event)
           
 void pluginModuleEnabled(com.atlassian.plugin.event.events.PluginModuleEnabledEvent event)
           
 void pluginRefreshed(com.atlassian.plugin.event.events.PluginRefreshedEvent event)
           
 void start()
          This method wil be called after the plugin system is fully initialised and all components added to the dependency injection framework.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachingI18nFactory

public CachingI18nFactory(JiraLocaleUtils jiraLocaleUtils,
                          com.atlassian.event.api.EventPublisher eventPublisher,
                          BackingI18nFactory i18nBackingFactory,
                          UserLocaleStore userLocaleStore,
                          ComponentLocator locator)
Method Detail

start

public void start()
Description copied from interface: Startable
This method wil be called after the plugin system is fully initialised and all components added to the dependency injection framework.

Specified by:
start in interface Startable

afterInstantiation

public void afterInstantiation()
Specified by:
afterInstantiation in interface InitializingComponent

pluginEnabled

@EventListener
public void pluginEnabled(com.atlassian.plugin.event.events.PluginEnabledEvent event)

pluginModuleDisabled

@EventListener
public void pluginModuleDisabled(com.atlassian.plugin.event.events.PluginModuleDisabledEvent event)

pluginModuleEnabled

@EventListener
public void pluginModuleEnabled(com.atlassian.plugin.event.events.PluginModuleEnabledEvent event)

pluginRefreshed

@EventListener
public void pluginRefreshed(com.atlassian.plugin.event.events.PluginRefreshedEvent event)

getInstance

public I18nHelper getInstance(Locale locale)
Description copied from interface: I18nHelper.BeanFactory
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.

Specified by:
getInstance in interface I18nHelper.BeanFactory
Parameters:
locale - the locale in play
Returns:
an I18nHelper instance associated with the provided Locale
See Also:
I18nHelper

getInstance

public I18nHelper getInstance(com.atlassian.crowd.embedded.api.User user)
Description copied from interface: I18nHelper.BeanFactory
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.

Specified by:
getInstance in interface I18nHelper.BeanFactory
Parameters:
user - the user in play
Returns:
an I18nHelper instance associated with the provided User's locale preference
See Also:
I18nHelper

getInstance

public I18nHelper getInstance(ApplicationUser user)
Description copied from interface: I18nHelper.BeanFactory
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.

Specified by:
getInstance in interface I18nHelper.BeanFactory
Parameters:
user - the user in play
Returns:
an I18nHelper instance associated with the provided User's locale preference
See Also:
I18nHelper

getStateHashCode

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



Copyright © 2002-2014 Atlassian. All Rights Reserved.