com.atlassian.sal.core.message
Class AbstractI18nResolver

java.lang.Object
  extended by com.atlassian.sal.core.message.AbstractI18nResolver
All Implemented Interfaces:
I18nResolver
Direct Known Subclasses:
BambooI18nResolver

public abstract class AbstractI18nResolver
extends Object
implements I18nResolver


Constructor Summary
AbstractI18nResolver()
           
 
Method Summary
 Message createMessage(String key, Serializable... arguments)
          Creates an instance of Message.
 MessageCollection createMessageCollection()
           
 String getText(Message message)
          Given a Message this method:- 1) returns the i18ned text formatted with the message arguments if the message key can be resolved.
 String getText(String key)
          Does the same as I18nResolver.getText(String, java.io.Serializable...) however it is needed for velocity.
 String getText(String key, Serializable... arguments)
          Given a key and a list of arguments:- 1) this method returns the i18ned text formatted with the arguments if the key can be resolved.
abstract  String resolveText(String key, Serializable[] arguments)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.atlassian.sal.api.message.I18nResolver
getAllTranslationsForPrefix, getAllTranslationsForPrefix
 

Constructor Detail

AbstractI18nResolver

public AbstractI18nResolver()
Method Detail

getText

public String getText(String key,
                      Serializable... arguments)
Description copied from interface: I18nResolver
Given a key and a list of arguments:- 1) this method returns the i18ned text formatted with the arguments if the key can be resolved. 2) otherwise, the key itself will be returned (after formatting). Arguments may also be of the form Message which means they will be resolved as well before being included as an argument.

Specified by:
getText in interface I18nResolver
Parameters:
key - key for the i18ned message
arguments - Optional list of arguments for the message.
Returns:
I18ned string

getText

public String getText(String key)
Description copied from interface: I18nResolver
Does the same as I18nResolver.getText(String, java.io.Serializable...) however it is needed for velocity.

Specified by:
getText in interface I18nResolver
Parameters:
key - key for the i18ned message
Returns:
I18ned string

getText

public String getText(Message message)
Description copied from interface: I18nResolver
Given a Message this method:- 1) returns the i18ned text formatted with the message arguments if the message key can be resolved. 2) Otherwise, returns the message key (formatted with the message arguments).

Specified by:
getText in interface I18nResolver
Parameters:
message - The message to i18n
Returns:
I18ned string

resolveText

public abstract String resolveText(String key,
                                   Serializable[] arguments)

createMessage

public Message createMessage(String key,
                             Serializable... arguments)
Description copied from interface: I18nResolver
Creates an instance of Message.

Specified by:
createMessage in interface I18nResolver
Parameters:
key - The message key
arguments - The arguments to interpolate
Returns:
The message

createMessageCollection

public MessageCollection createMessageCollection()
Specified by:
createMessageCollection in interface I18nResolver
Returns:
an instance of MessageCollection.


Copyright © 2010 Atlassian. All Rights Reserved.