com.atlassian.jira.util
Class NoopI18nHelper

java.lang.Object
  extended by com.atlassian.jira.util.NoopI18nHelper
All Implemented Interfaces:
I18nHelper

public class NoopI18nHelper
extends Object
implements I18nHelper

An I18nHelper that returns the i18n key concatenated with its arguments. This can be used in tests to ensure correct i18n messages are returned. The makeTranslation(String, java.util.List) method can be used to create an expected value of a test.

Since:
v4.0

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.atlassian.jira.util.I18nHelper
I18nHelper.BeanFactory
 
Constructor Summary
NoopI18nHelper()
           
 
Method Summary
 ResourceBundle getDefaultResourceBundle()
           
 Set<String> getKeysForPrefix(String prefix)
          Given a prefix for an i18n key, this method will return all keys that start with the prefix specified.
 Locale getLocale()
           
 String getText(String key)
          Called to return the formatted text of the specified i18n key or the key itself if no message can be found
 String getText(String key, Object params)
          Called to return the formatted text of the specified i18n key or the key itself if no message can be found.
 String getText(String key, Object value1, Object value2, Object value3)
          Called to return the formatted text of the specified i18n key or the key itself if no message can be found
 String getText(String key, Object value1, Object value2, Object value3, Object value4)
          Called to return the formatted text of the specified i18n key or the key itself if no message can be found
 String getText(String key, Object value1, Object value2, Object value3, Object value4, Object value5)
          Called to return the formatted text of the specified i18n key or the key itself if no message can be found
 String getText(String key, Object value1, Object value2, Object value3, Object value4, Object value5, Object value6)
          Called to return the formatted text of the specified i18n key or the key itself if no message can be found
 String getText(String key, Object value1, Object value2, Object value3, Object value4, Object value5, Object value6, Object value7)
          Called to return the formatted text of the specified i18n key or the key itself if no message can be found
 String getText(String key, Object value1, Object value2, Object value3, Object value4, Object value5, Object value6, Object value7, Object value8)
          Called to return the formatted text of the specified i18n key or the key itself if no message can be found
 String getText(String key, String value1)
          Called to return the formatted text of the specified i18n key or the key itself if no message can be found
 String getText(String key, String value1, String value2)
          Called to return the formatted text of the specified i18n key or the key itself if no message can be found
 String getText(String key, String value1, String value2, String value3)
          Called to return the formatted text of the specified i18n key or the key itself if no message can be found
 String getText(String key, String value1, String value2, String value3, String value4)
          Called to return the formatted text of the specified i18n key or the key itself if no message can be found
 String getText(String key, String value1, String value2, String value3, String value4, String value5, String value6, String value7)
          Called to return the formatted text of the specified i18n key
 String getText(String key, String value1, String value2, String value3, String value4, String value5, String value6, String value7, String value8, String value9)
          Called to return the formatted text of the specified i18n key or the key itself if no message can be found
 String getUnescapedText(String key)
          Called to return the un-formatted text of the specified i18n key or the key itself if no message can be found
static String makeTranslation(String key, List<?> arguments)
           
static String makeTranslation(String key, Object... arguments)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NoopI18nHelper

public NoopI18nHelper()
Method Detail

getText

public String getText(String key)
Description copied from interface: I18nHelper
Called to return the formatted text of the specified i18n key or the key itself if no message can be found

Specified by:
getText in interface I18nHelper
Parameters:
key - the key of the i18n message
Returns:
the formatted text or the key itself if no i18n message can be found

getLocale

public Locale getLocale()
Specified by:
getLocale in interface I18nHelper
Returns:
the Locale that is associated with this I18nHelper

getUnescapedText

public String getUnescapedText(String key)
Description copied from interface: I18nHelper
Called to return the un-formatted text of the specified i18n key or the key itself if no message can be found

Specified by:
getUnescapedText in interface I18nHelper
Parameters:
key - the key of the i18n message
Returns:
the un-formatted text or the key itself if no i18n message can be found

getText

public String getText(String key,
                      String value1)
Description copied from interface: I18nHelper
Called to return the formatted text of the specified i18n key or the key itself if no message can be found

Specified by:
getText in interface I18nHelper
Parameters:
key - the key of the i18n message
value1 - a value to be substituted into the message
Returns:
the formatted text or the key itself if no i18n message can be found

getText

public String getText(String key,
                      Object value1,
                      Object value2,
                      Object value3)
Description copied from interface: I18nHelper
Called to return the formatted text of the specified i18n key or the key itself if no message can be found

Specified by:
getText in interface I18nHelper
Parameters:
key - the key of the i18n message
value1 - a value to be substituted into the message
value2 - a value to be substituted into the message
value3 - a value to be substituted into the message
Returns:
the formatted text or the key itself if no i18n message can be found

getText

public String getText(String key,
                      Object value1,
                      Object value2,
                      Object value3,
                      Object value4)
Description copied from interface: I18nHelper
Called to return the formatted text of the specified i18n key or the key itself if no message can be found

Specified by:
getText in interface I18nHelper
Parameters:
key - the key of the i18n message
value1 - a value to be substituted into the message
value2 - a value to be substituted into the message
value3 - a value to be substituted into the message
value4 - a value to be substituted into the message
Returns:
the formatted text or the key itself if no i18n message can be found

getText

public String getText(String key,
                      Object value1,
                      Object value2,
                      Object value3,
                      Object value4,
                      Object value5)
Description copied from interface: I18nHelper
Called to return the formatted text of the specified i18n key or the key itself if no message can be found

Specified by:
getText in interface I18nHelper
Parameters:
key - the key of the i18n message
value1 - a value to be substituted into the message
value2 - a value to be substituted into the message
value3 - a value to be substituted into the message
value4 - a value to be substituted into the message
value5 - a value to be substituted into the message
Returns:
the formatted text or the key itself if no i18n message can be found

getText

public String getText(String key,
                      Object value1,
                      Object value2,
                      Object value3,
                      Object value4,
                      Object value5,
                      Object value6,
                      Object value7)
Description copied from interface: I18nHelper
Called to return the formatted text of the specified i18n key or the key itself if no message can be found

Specified by:
getText in interface I18nHelper
Parameters:
key - the key of the i18n message
value1 - a value to be substituted into the message
value2 - a value to be substituted into the message
value3 - a value to be substituted into the message
value4 - a value to be substituted into the message
value5 - a value to be substituted into the message
value6 - a value to be substituted into the message
value7 - a value to be substituted into the message
Returns:
the formatted text or the key itself if no i18n message can be found

getText

public String getText(String key,
                      Object value1,
                      Object value2,
                      Object value3,
                      Object value4,
                      Object value5,
                      Object value6,
                      Object value7,
                      Object value8)
Description copied from interface: I18nHelper
Called to return the formatted text of the specified i18n key or the key itself if no message can be found

Specified by:
getText in interface I18nHelper
Parameters:
key - the key of the i18n message
value1 - a value to be substituted into the message
value2 - a value to be substituted into the message
value3 - a value to be substituted into the message
value4 - a value to be substituted into the message
value5 - a value to be substituted into the message
value6 - a value to be substituted into the message
value7 - a value to be substituted into the message
value8 - a value to be substituted into the message
Returns:
the formatted text or the key itself if no i18n message can be found

getText

public String getText(String key,
                      String value1,
                      String value2)
Description copied from interface: I18nHelper
Called to return the formatted text of the specified i18n key or the key itself if no message can be found

Specified by:
getText in interface I18nHelper
Parameters:
key - the key of the i18n message
value1 - a value to be substituted into the message
value2 - a value to be substituted into the message
Returns:
the formatted text or the key itself if no i18n message can be found

getText

public String getText(String key,
                      String value1,
                      String value2,
                      String value3)
Description copied from interface: I18nHelper
Called to return the formatted text of the specified i18n key or the key itself if no message can be found

Specified by:
getText in interface I18nHelper
Parameters:
key - the key of the i18n message
value1 - a value to be substituted into the message
value2 - a value to be substituted into the message
value3 - a value to be substituted into the message
Returns:
the formatted text or the key itself if no i18n message can be found

getText

public String getText(String key,
                      String value1,
                      String value2,
                      String value3,
                      String value4)
Description copied from interface: I18nHelper
Called to return the formatted text of the specified i18n key or the key itself if no message can be found

Specified by:
getText in interface I18nHelper
Parameters:
key - the key of the i18n message
value1 - a value to be substituted into the message
value2 - a value to be substituted into the message
value3 - a value to be substituted into the message
value4 - a value to be substituted into the message
Returns:
the formatted text or the key itself if no i18n message can be found

getText

public String getText(String key,
                      Object value1,
                      Object value2,
                      Object value3,
                      Object value4,
                      Object value5,
                      Object value6)
Description copied from interface: I18nHelper
Called to return the formatted text of the specified i18n key or the key itself if no message can be found

Specified by:
getText in interface I18nHelper
Parameters:
key - the key of the i18n message
value1 - a value to be substituted into the message
value2 - a value to be substituted into the message
value3 - a value to be substituted into the message
value4 - a value to be substituted into the message
value5 - a value to be substituted into the message
value6 - a value to be substituted into the message
Returns:
the formatted text or the key itself if no i18n message can be found

getText

public String getText(String key,
                      String value1,
                      String value2,
                      String value3,
                      String value4,
                      String value5,
                      String value6,
                      String value7)
Description copied from interface: I18nHelper
Called to return the formatted text of the specified i18n key

Specified by:
getText in interface I18nHelper
Parameters:
key - the key of the i18n message
value1 - a value to be substituted into the message
value2 - a value to be substituted into the message
value3 - a value to be substituted into the message
value4 - a value to be substituted into the message
value5 - a value to be substituted into the message
value6 - a value to be substituted into the message
value7 - a value to be substituted into the message
Returns:
the formatted text or the key itself if no i18n message can be found

getText

public String getText(String key,
                      String value1,
                      String value2,
                      String value3,
                      String value4,
                      String value5,
                      String value6,
                      String value7,
                      String value8,
                      String value9)
Description copied from interface: I18nHelper
Called to return the formatted text of the specified i18n key or the key itself if no message can be found

Specified by:
getText in interface I18nHelper
Parameters:
key - the key of the i18n message
value1 - a value to be substituted into the message
value2 - a value to be substituted into the message
value3 - a value to be substituted into the message
value4 - a value to be substituted into the message
value5 - a value to be substituted into the message
value6 - a value to be substituted into the message
value7 - a value to be substituted into the message
value8 - a value to be substituted into the message
value9 - a value to be substituted into the message
Returns:
the formatted text or the key itself if no i18n message can be found

getDefaultResourceBundle

public ResourceBundle getDefaultResourceBundle()
Specified by:
getDefaultResourceBundle in interface I18nHelper
Returns:
the default ResourceBundle within JIRA

getText

public String getText(String key,
                      Object params)
Description copied from interface: I18nHelper
Called to return the formatted text of the specified i18n key or the key itself if no message can be found.

The object passed in can be an array, a List} or a single parameter object. It will be then used as substitution parameters within the message.

Specified by:
getText in interface I18nHelper
Parameters:
key - the key of the i18n message
params - This can be an Array, a List and Array or a single object parameter
Returns:
the formatted text or the key itself if no i18n message can be found

getKeysForPrefix

public Set<String> getKeysForPrefix(String prefix)
Description copied from interface: I18nHelper
Given a prefix for an i18n key, this method will return all keys that start with the prefix specified.

Specified by:
getKeysForPrefix in interface I18nHelper
Parameters:
prefix - The prefix for i18n keys. May not be null
Returns:
An immutable set of translation keys that start with the prefix specified.

makeTranslation

public static String makeTranslation(String key,
                                     Object... arguments)

makeTranslation

public static String makeTranslation(String key,
                                     List<?> arguments)


Copyright © 2002-2011 Atlassian. All Rights Reserved.