org.trails.i18n
Interface TrailsMessageSource

All Known Implementing Classes:
AbstractMessageSource, HiveMindMessageSource

public interface TrailsMessageSource

Interface used to imlement i18n in Trails pages and components.


Field Summary
static java.lang.Object[] EMPTY_ARGUMENTS
           
 
Method Summary
 java.lang.String getDisplayName(IDescriptor clazz, java.lang.String defaultDisplayName)
          Given a IDescriptor, this method select an i18n message for the descriptor.
 java.lang.String getMessage(java.lang.String key)
          Return a internationalized message.
 java.lang.String getMessage(java.lang.String key, java.util.Locale locale)
          Return a internationalized message.
 java.lang.String getMessage(java.lang.String key, java.lang.Object[] args)
          Return a internationalized message specifing arguments to format this message.
 java.lang.String getMessage(java.lang.String key, java.lang.Object[] args, java.util.Locale locale)
          Return a internationalized message specifing arguments to format this message.
 java.lang.String getMessageWithDefaultValue(java.lang.String key, java.util.Locale locale, java.lang.String defaultMessage)
           
 java.lang.String getMessageWithDefaultValue(java.lang.String key, java.lang.Object[] args, java.util.Locale locale, java.lang.String defaultMessage)
           
 java.lang.String getMessageWithDefaultValue(java.lang.String key, java.lang.Object[] args, java.lang.String defaultMessage)
          Same as getMessage(String key, Object[] args), but will return a default value instead of null if message not found.
 java.lang.String getMessageWithDefaultValue(java.lang.String key, java.lang.String defaultMessage)
          Same as getMessage(String key), but it will return a default value instead of null if message not found.
 java.lang.String getPluralDislayName(IClassDescriptor clazz, java.lang.String defaultDisplayName)
          Given a IClassDescriptor and a Locale, this method select an i18n message for the class in the plural name
 

Field Detail

EMPTY_ARGUMENTS

static final java.lang.Object[] EMPTY_ARGUMENTS
Method Detail

getMessage

java.lang.String getMessage(java.lang.String key)
Return a internationalized message.

Parameters:
key - Key used to locate the message.
Returns:
Localized message. Return null if message not found.

getMessage

java.lang.String getMessage(java.lang.String key,
                            java.lang.Object[] args)
Return a internationalized message specifing arguments to format this message.

Parameters:
key - Key used to locate the message.
args - Arguments to format the message.
Returns:
Localized message. Return null of message not found.

getMessageWithDefaultValue

java.lang.String getMessageWithDefaultValue(java.lang.String key,
                                            java.lang.String defaultMessage)
Same as getMessage(String key), but it will return a default value instead of null if message not found.

Parameters:
defaultMessage - Default message to return if message not found.

getMessageWithDefaultValue

java.lang.String getMessageWithDefaultValue(java.lang.String key,
                                            java.lang.Object[] args,
                                            java.lang.String defaultMessage)
Same as getMessage(String key, Object[] args), but will return a default value instead of null if message not found.

Parameters:
defaultMessage - Default message to return if message not found.

getDisplayName

java.lang.String getDisplayName(IDescriptor clazz,
                                java.lang.String defaultDisplayName)
Given a IDescriptor, this method select an i18n message for the descriptor. If no i18n message is found, a defaultMessage is used instead.

Parameters:
clazz - Class description.
defaultDisplayName - default displayName to return if no i18n message is found.
Returns:

getPluralDislayName

java.lang.String getPluralDislayName(IClassDescriptor clazz,
                                     java.lang.String defaultDisplayName)
Given a IClassDescriptor and a Locale, this method select an i18n message for the class in the plural name

Parameters:
clazz - Class description
defaultDisplayName - default displayName to return if no i18n message is found.
Returns:

getMessage

java.lang.String getMessage(java.lang.String key,
                            java.util.Locale locale)
Return a internationalized message.

Sometimes it makes sense to force a Locale, but don't overuse this method.

Parameters:
key - Key used to locate the message.
locale - Locale used to locate message.
Returns:
Localized message. Return null if message not found.

getMessage

java.lang.String getMessage(java.lang.String key,
                            java.lang.Object[] args,
                            java.util.Locale locale)
Return a internationalized message specifing arguments to format this message.

Sometimes it makes sense to force a Locale, but don't overuse this method.

Parameters:
key - Key used to locate the message.
args - Arguments to format the message.
locale - Locale used to locate message.
Returns:
Localized message. Return null of message not found.

getMessageWithDefaultValue

java.lang.String getMessageWithDefaultValue(java.lang.String key,
                                            java.util.Locale locale,
                                            java.lang.String defaultMessage)

getMessageWithDefaultValue

java.lang.String getMessageWithDefaultValue(java.lang.String key,
                                            java.lang.Object[] args,
                                            java.util.Locale locale,
                                            java.lang.String defaultMessage)


Copyright © 2004-2008. All Rights Reserved.