org.opencms.i18n
Interface I_CmsMessageBundle

All Known Implementing Classes:
A_CmsMessageBundle

public interface I_CmsMessageBundle

Utility interface for generating localized messages for internal OpenCms operations.

Every OpenCms core packages should provide one class implementing this interface. This class should be called Messages and be a subclass of A_CmsMessageBundle. Moreover, the implementation should contain a public static CmsMessageBundle#get() method, that returns an instance of the class. Also the implementation should contain public static members for all available localized keys.

How to use localization in the OpenCms core:

There are 3 main ulitiliy classes that deal with localization. These are

Since:
6.0.0
Version:
$Revision: 1.11 $
Author:
Alexander Kandzior

Method Summary
 CmsMessageContainer container(java.lang.String key)
          Creates a message container for this package with the given arguments.
 CmsMessageContainer container(java.lang.String key, java.lang.Object arg0)
          Creates a message container for this package with the given arguments.
 CmsMessageContainer container(java.lang.String key, java.lang.Object[] args)
          Creates a message container for this package with the given arguments.
 CmsMessageContainer container(java.lang.String key, java.lang.Object arg0, java.lang.Object arg1)
          Creates a message container for this package with the given arguments.
 CmsMessageContainer container(java.lang.String key, java.lang.Object arg0, java.lang.Object arg1, java.lang.Object arg2)
          Creates a message container for this package with the given arguments.
 CmsMessages getBundle()
          Returns the localized message bundle wrapped in this instance initialized with the OpenCms default locale.
 CmsMessages getBundle(java.util.Locale locale)
          Returns the localized message bundle wrapped in this instance initialized with the provided locale.
 java.lang.String getBundleName()
          Returns the bundle name for this OpenCms package.
 

Method Detail

container

CmsMessageContainer container(java.lang.String key)
Creates a message container for this package with the given arguments.

Convenience method for a message with no arguments.

Parameters:
key - the message key to use
Returns:
a message container for this package with the given arguments

container

CmsMessageContainer container(java.lang.String key,
                              java.lang.Object arg0)
Creates a message container for this package with the given arguments.

Convenience method for a message with one argument.

Parameters:
key - the message key to use
arg0 - the message argument
Returns:
a message container for this package with the given arguments

container

CmsMessageContainer container(java.lang.String key,
                              java.lang.Object arg0,
                              java.lang.Object arg1)
Creates a message container for this package with the given arguments.

Convenience method for a message with two arguments.

Parameters:
key - the message key to use
arg0 - the first message argument
arg1 - the second message argument
Returns:
a message container for this package with the given arguments

container

CmsMessageContainer container(java.lang.String key,
                              java.lang.Object arg0,
                              java.lang.Object arg1,
                              java.lang.Object arg2)
Creates a message container for this package with the given arguments.

Convenience method for a message with three arguments.

Parameters:
key - the message key to use
arg0 - the first message argument
arg1 - the second message argument
arg2 - the third message argument
Returns:
a message container for this package with the given arguments

container

CmsMessageContainer container(java.lang.String key,
                              java.lang.Object[] args)
Creates a message container for this package with the given arguments.

Parameters:
key - the message key to use
args - the message arguments to use
Returns:
a message container for this package with the given arguments

getBundle

CmsMessages getBundle()
Returns the localized message bundle wrapped in this instance initialized with the OpenCms default locale.

This should be used only for logging and system output, not for generating GUI messages that the user can see. In this case, use getBundle(Locale).

Returns:
the localized message bundle wrapped in this instance initialized with the OpenCms default locale

getBundle

CmsMessages getBundle(java.util.Locale locale)
Returns the localized message bundle wrapped in this instance initialized with the provided locale.

Parameters:
locale - the locale to use
Returns:
the localized message bundle wrapped in this instance initialized with the provided locale

getBundleName

java.lang.String getBundleName()
Returns the bundle name for this OpenCms package.

Returns:
the bundle name for this OpenCms package