com.atlassian.sal.api.message
Interface I18nResolver


public interface I18nResolver

This interface is responsible for resolving a message or key/argument pairs to their internationalized message.

Since:
2.0

Method Summary
 Message createMessage(java.lang.String key, java.io.Serializable... arguments)
          Creates an instance of Message.
 MessageCollection createMessageCollection()
           
 java.util.Map<java.lang.String,java.lang.String> getAllTranslationsForPrefix(java.lang.String prefix, java.util.Locale locale)
          Given a prefix, this method will return all translations where the key starts with the given prefix as key -> value mappings.
 java.lang.String getText(Message message)
          Given a Message this method returns the i18ned text if it can be resolved.
 java.lang.String getText(java.lang.String key)
          Does the same as getText(String, java.io.Serializable[]) however it is needed for velocity.
 java.lang.String getText(java.lang.String key, java.io.Serializable... arguments)
          Given a key and a list of arguments this method returns the i18ned text if it can be resolved.
 

Method Detail

getText

java.lang.String getText(java.lang.String key,
                         java.io.Serializable... arguments)
Given a key and a list of arguments this method returns the i18ned text if it can be resolved. Arguments may also be of the form Message which means they will be resolved as well before being included as an argument.

Parameters:
key - key for the i18ned message
arguments - Optional list of arguments for the message.
Returns:
I18ned string

getText

java.lang.String getText(java.lang.String key)
Does the same as getText(String, java.io.Serializable[]) however it is needed for velocity.

Parameters:
key - key for the i18ned message
Returns:
I18ned string

getText

java.lang.String getText(Message message)
Given a Message this method returns the i18ned text if it can be resolved.

Parameters:
message - The message to i18n
Returns:
I18ned string

createMessage

Message createMessage(java.lang.String key,
                      java.io.Serializable... arguments)
Creates an instance of Message.

Parameters:
key - The message key
arguments - The arguments to interpolate
Returns:
The message

createMessageCollection

MessageCollection createMessageCollection()
Returns:
an instance of MessageCollection.

getAllTranslationsForPrefix

java.util.Map<java.lang.String,java.lang.String> getAllTranslationsForPrefix(java.lang.String prefix,
                                                                             java.util.Locale locale)
Given a prefix, this method will return all translations where the key starts with the given prefix as key -> value mappings.

Parameters:
prefix - The prefix for a particular key to start with. Empty string will match everything, which may be slow. Throws NullPointerException if null.
locale - The locale for which to lookup translations. Throws NullPointerException if null.
Returns:
A Map of i18nKey -> translation mappings where i18nKey starts with the prefix. Empty map if no matches.
Throws:
java.lang.NullPointerException - if prefix or link are null


Copyright © 2009 Atlassian. All Rights Reserved.