info.magnolia.cms.i18n
Class MessagesManager

java.lang.Object
  extended by info.magnolia.cms.i18n.MessagesManager
Direct Known Subclasses:
DefaultMessagesManager

public abstract class MessagesManager
extends java.lang.Object

From this class you get the i18n messages. You should pass a a request, but if you can't the getMessages method will handle it properly. The get() methods are easy to use.

Author:
philipp, molaschi

Field Summary
static java.lang.String DEFAULT_BASENAME
          Use this basename if no other is provided.
static java.lang.String FALLBACK_LOCALE
          Use this locale if no other provided.
static java.lang.String FALLBACK_NODEDATA
          The name of the property to store the current system language.
static java.lang.String I18N_CONFIG_PATH
          The node name where the configuration for i18n is stored.
static java.lang.String LANGUAGES_NODE_NAME
          Under this node all the available languages are stored.
 
Constructor Summary
MessagesManager()
           
 
Method Summary
static java.lang.String get(java.lang.String key)
           
static java.lang.String get(java.lang.String key, java.lang.Object[] args)
          Get a message with parameters inside: the value {0} must be a number.
abstract  java.util.Collection getAvailableLocales()
           
abstract  java.util.Locale getDefaultLocale()
           
static MessagesManager getInstance()
           
static Messages getMessages()
           
static Messages getMessages(java.util.Locale locale)
           
static Messages getMessages(java.lang.String basename)
           
static Messages getMessages(java.lang.String basename, java.util.Locale locale)
           
protected abstract  Messages getMessagesInternal(java.lang.String basename, java.util.Locale locale)
           
static java.lang.String getWithDefault(java.lang.String key, java.lang.Object[] args, java.lang.String defaultMsg)
          Get a message with parameters inside: the value {0} must be a number.
static java.lang.String getWithDefault(java.lang.String key, java.lang.String defaultMsg)
          Use a default string.
abstract  void init()
           
abstract  void reload()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FALLBACK_LOCALE

public static final java.lang.String FALLBACK_LOCALE
Use this locale if no other provided.

See Also:
Constant Field Values

DEFAULT_BASENAME

public static final java.lang.String DEFAULT_BASENAME
Use this basename if no other is provided.

See Also:
Constant Field Values

I18N_CONFIG_PATH

public static final java.lang.String I18N_CONFIG_PATH
The node name where the configuration for i18n is stored.

See Also:
Constant Field Values

FALLBACK_NODEDATA

public static final java.lang.String FALLBACK_NODEDATA
The name of the property to store the current system language.

See Also:
Constant Field Values

LANGUAGES_NODE_NAME

public static final java.lang.String LANGUAGES_NODE_NAME
Under this node all the available languages are stored. They are showed in the user dialog.

See Also:
Constant Field Values
Constructor Detail

MessagesManager

public MessagesManager()
Method Detail

getInstance

public static MessagesManager getInstance()

getMessages

public static Messages getMessages()

getMessages

public static Messages getMessages(java.lang.String basename)

getMessages

public static Messages getMessages(java.util.Locale locale)

getMessages

public static Messages getMessages(java.lang.String basename,
                                   java.util.Locale locale)

get

public static java.lang.String get(java.lang.String key)

get

public static java.lang.String get(java.lang.String key,
                                   java.lang.Object[] args)
Get a message with parameters inside: the value {0} must be a number.

Parameters:
key - key to find
args - replacement strings
Returns:
message

getWithDefault

public static java.lang.String getWithDefault(java.lang.String key,
                                              java.lang.String defaultMsg)
Use a default string.

Parameters:
key - key to find
defaultMsg - default message
Returns:
message

getWithDefault

public static java.lang.String getWithDefault(java.lang.String key,
                                              java.lang.Object[] args,
                                              java.lang.String defaultMsg)
Get a message with parameters inside: the value {0} must be a number. Use a default message.

Parameters:
key - key to find
args - replacement strings
defaultMsg - default message
Returns:
message

init

public abstract void init()

getAvailableLocales

public abstract java.util.Collection getAvailableLocales()

getDefaultLocale

public abstract java.util.Locale getDefaultLocale()

getMessagesInternal

protected abstract Messages getMessagesInternal(java.lang.String basename,
                                                java.util.Locale locale)

reload

public abstract void reload()


Copyright © 2003-2011 Magnolia International Ltd.. All Rights Reserved.