com.atlassian.confluence.util.i18n
Class DefaultI18NBean

java.lang.Object
  extended by com.atlassian.confluence.util.i18n.DefaultI18NBean
All Implemented Interfaces:
I18NBean

public class DefaultI18NBean
extends Object
implements I18NBean

Responsible for fetching internationalised text given a key. By default, this will only search the default resource bundle for ConfluenceActionSupport.class

To access i18n keys in resource bundles for other classes: specify these classes in a list (use fully qualified class names)


Field Summary
 
Fields inherited from interface com.atlassian.confluence.util.i18n.I18NBean
DEFAULT_RESOURCE_BUNDLE
 
Constructor Summary
DefaultI18NBean(Locale locale, com.atlassian.plugin.PluginAccessor pluginManager)
           
 
Method Summary
 ResourceBundle getResourceBundle()
           
 String getText(Message message)
          Gets the i18n text for the specified message, formatting the message's value and arguments with MessageFormat.
 String getText(String key)
          Get the i18n text for a particular key.
 String getText(String key, List list)
           
 String getText(String key, Object[] args)
          Get the i18n text for a particular key, formatted through MessageFormat with the given arguments.
 String getTextStrict(String i18nKey)
          Needed for text that should not be marked up (for example, values for the 'accessKey' attribute in an input element)
 boolean isI18nHighlightMode()
           
 boolean isShowKeyMode()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultI18NBean

public DefaultI18NBean(Locale locale,
                       com.atlassian.plugin.PluginAccessor pluginManager)
Method Detail

getText

public String getText(String key)
Get the i18n text for a particular key.

Specified by:
getText in interface I18NBean

getText

public String getText(String key,
                      Object[] args)
Get the i18n text for a particular key, formatted through MessageFormat with the given arguments. Works similarly to ActionSupport.getText(String, java.util.List), but the array form is necessary to work well with Velocity.

Specified by:
getText in interface I18NBean
Parameters:
key - the key to retrieve the i18n text for
args - an array of arguments to be passed in to the MessageFormat#format for this text
Returns:
the appropriate i18n text, formatted with the supplied arguments
See Also:
ActionSupport.getText(String, java.util.List), MessageFormat

getText

public String getText(String key,
                      List list)
Specified by:
getText in interface I18NBean

getText

public String getText(Message message)
Description copied from interface: I18NBean
Gets the i18n text for the specified message, formatting the message's value and arguments with MessageFormat.

Specified by:
getText in interface I18NBean
Parameters:
message - the message to format, containing an i18n key and arguments
Returns:
the formatted message

getTextStrict

public String getTextStrict(String i18nKey)
Needed for text that should not be marked up (for example, values for the 'accessKey' attribute in an input element)

Specified by:
getTextStrict in interface I18NBean
Parameters:
i18nKey -
Returns:
text for i18nKey (and excludes markup regardless of settings)

getResourceBundle

public ResourceBundle getResourceBundle()
Specified by:
getResourceBundle in interface I18NBean

isI18nHighlightMode

public boolean isI18nHighlightMode()
Specified by:
isI18nHighlightMode in interface I18NBean

isShowKeyMode

public boolean isShowKeyMode()
Specified by:
isShowKeyMode in interface I18NBean


Copyright © 2003-2011 Atlassian. All Rights Reserved.