com.atlassian.jira.i18n
Class JiraI18nResolver

java.lang.Object
  extended by com.atlassian.jira.i18n.AbstractI18nResolver
      extended by com.atlassian.jira.i18n.JiraI18nResolver
All Implemented Interfaces:
com.atlassian.sal.api.message.I18nResolver

public class JiraI18nResolver
extends AbstractI18nResolver

A JIRA I18nResolver. Uses the user's locale if a user is logged in or the default locale if none can be found.

By rights we should implement this in the jira-sal-plugin, but this is the one thing that we need from SAL during Bootstrap. The simple solution is to define JiraI18nResolver in jira-core and include it in BootstrapContainer, but during normal runtime we don't put it in PICO - we define it in jira-sal-plugin as expected.

IMPORTANT! JRA-25571 Do not add dependency on sal-core to jira-core: this causes Bugs due to ClassLoader issues.


Constructor Summary
JiraI18nResolver(JiraAuthenticationContext jiraAuthenticationContext, I18nHelper.BeanFactory beanFactory)
           
 
Method Summary
 Map<String,String> getAllTranslationsForPrefix(String prefix)
           
 Map<String,String> getAllTranslationsForPrefix(String prefix, Locale locale)
           
 String getRawText(String key)
           
 String resolveText(Locale locale, String key, Serializable[] arguments)
          Subclasses should implement this method to dispatch to a matching language in the given locale.
 String resolveText(String key, Serializable[] arguments)
          Subclasses should implement this method to dispatch to a matching language in (in order of preference): the user's locale the application's configured locale, or the system default locale
 
Methods inherited from class com.atlassian.jira.i18n.AbstractI18nResolver
createMessage, createMessageCollection, getText, getText, getText, getText, getText, getText
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JiraI18nResolver

public JiraI18nResolver(JiraAuthenticationContext jiraAuthenticationContext,
                        I18nHelper.BeanFactory beanFactory)
Method Detail

resolveText

public String resolveText(String key,
                          Serializable[] arguments)
Description copied from class: AbstractI18nResolver
Subclasses should implement this method to dispatch to a matching language in (in order of preference):

Specified by:
resolveText in class AbstractI18nResolver
Parameters:
key - the key to translate.
arguments - the arguments to be inserted into the translated string.
Returns:
the translated string.

resolveText

public String resolveText(Locale locale,
                          String key,
                          Serializable[] arguments)
Description copied from class: AbstractI18nResolver
Subclasses should implement this method to dispatch to a matching language in the given locale.

Specified by:
resolveText in class AbstractI18nResolver
Parameters:
locale - the locale to translate into.
key - the key to translate.
arguments - the arguments to be inserted into the translated string.
Returns:
the translated string.

getRawText

public String getRawText(String key)

getAllTranslationsForPrefix

public Map<String,String> getAllTranslationsForPrefix(String prefix)

getAllTranslationsForPrefix

public Map<String,String> getAllTranslationsForPrefix(String prefix,
                                                      Locale locale)


Copyright © 2002-2013 Atlassian. All Rights Reserved.