public class CmsXmlMessages extends CmsMessages
As fallback if no file was specified or no value was found for the desired key, a common CmsMessages object is used to get the localized value.
KEY_SHORT_SUFFIX, UNKNOWN_KEY_EXTENSION
Constructor and Description |
---|
CmsXmlMessages(CmsMessages messages,
java.lang.String configurationFileName,
java.lang.String pathPrefix,
java.util.Locale locale)
Constructor, with parameters.
|
CmsXmlMessages(java.lang.String bundleName,
java.lang.String configurationFileName,
java.lang.String pathPrefix,
java.util.Locale locale)
Constructor, with parameters.
|
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
getConfigValue(java.lang.String key)
Returns the value for the given key from the configuration file.
|
protected java.lang.String |
getConfigValue(java.lang.String key,
java.lang.Object[] args)
Returns the substituted value for the given key and arguments from the configuration file.
|
CmsMessages |
getMessages()
Returns the messages.
|
protected boolean |
hasConfigValue(java.lang.String key)
Checks if the given key is provided in the configuration file.
|
protected void |
initLocalizationContent(java.lang.String configurationFileName)
Initializes the content used for localizing the output.
|
protected void |
initPathPrefix(java.lang.String pathPrefix)
Initializes the (optional) xPath prefix to the element nodes.
|
java.lang.String |
key(java.lang.String keyName)
Returns the localized resource String from the configuration file, if not found or set from the resource bundle.
|
java.lang.String |
key(java.lang.String key,
java.lang.Object arg0)
Returns the localized resource String from the configuration file, if not found or set from the resource bundle.
|
java.lang.String |
key(java.lang.String key,
java.lang.Object[] args)
Returns the localized resource String from the configuration file, if not found or set from the resource bundle.
|
java.lang.String |
key(java.lang.String key,
java.lang.Object arg0,
java.lang.Object arg1)
Returns the localized resource String from the configuration file, if not found or set from the resource bundle.
|
java.lang.String |
key(java.lang.String key,
java.lang.Object arg0,
java.lang.Object arg1,
java.lang.Object arg2)
Returns the localized resource String from the configuration file, if not found or set from the resource bundle.
|
java.lang.String |
keyDefault(java.lang.String keyName,
java.lang.String defaultValue)
Returns the localized resource String from the configuration file, if not found or set from the resource bundle.
|
void |
setMessages(CmsMessages messages)
Sets the messages.
|
equals, formatUnknownKey, getBundleName, getDate, getDate, getDate, getDateTime, getDateTime, getDateTime, getLocale, getResourceBundle, getString, hashCode, isInitialized, isUncacheable, isUnknownKey, key, keyWithParams, setBundleName, setLocale, setResourceBundle, toString
public CmsXmlMessages(CmsMessages messages, java.lang.String configurationFileName, java.lang.String pathPrefix, java.util.Locale locale)
Creates the necessary member objects using the passed arguments.
messages
- the messages object to use as fallbackconfigurationFileName
- the absolute path (including site root!) to the configuration file containing localized keyspathPrefix
- the (optional) xPath prefix to the element nodeslocale
- the locale to use for localizationpublic CmsXmlMessages(java.lang.String bundleName, java.lang.String configurationFileName, java.lang.String pathPrefix, java.util.Locale locale)
Creates the necessary member objects using the passed arguments.
bundleName
- the name of the ResourceBundle to useconfigurationFileName
- the absolute path (including site root!) to the configuration file containing localized keyspathPrefix
- the (optional) xPath prefix to the element nodeslocale
- the locale to use for localizationpublic CmsMessages getMessages()
public java.lang.String key(java.lang.String keyName)
key
in class CmsMessages
keyName
- the key for the desired stringCmsMessages.key(java.lang.String)
public java.lang.String key(java.lang.String key, java.lang.Object arg0)
key
in class CmsMessages
key
- the message keyarg0
- the message argumentCmsMessages.key(java.lang.String, java.lang.Object)
public java.lang.String key(java.lang.String key, java.lang.Object arg0, java.lang.Object arg1)
key
in class CmsMessages
key
- the message keyarg0
- the first message argumentarg1
- the second message argumentCmsMessages.key(java.lang.String, java.lang.Object, java.lang.Object)
public java.lang.String key(java.lang.String key, java.lang.Object arg0, java.lang.Object arg1, java.lang.Object arg2)
key
in class CmsMessages
key
- the message keyarg0
- the first message argumentarg1
- the second message argumentarg2
- the third message argumentCmsMessages.key(java.lang.String, java.lang.Object, java.lang.Object, java.lang.Object)
public java.lang.String key(java.lang.String key, java.lang.Object[] args)
key
in class CmsMessages
key
- the message keyargs
- the message argumentsCmsMessages.key(java.lang.String, java.lang.Object[])
public java.lang.String keyDefault(java.lang.String keyName, java.lang.String defaultValue)
keyDefault
in class CmsMessages
keyName
- the key for the desired stringdefaultValue
- the default value in case the key does not exist in the bundleCmsMessages.keyDefault(java.lang.String, java.lang.String)
public void setMessages(CmsMessages messages)
messages
- the messagesprotected java.lang.String getConfigValue(java.lang.String key)
key
- the key to get the value forprotected java.lang.String getConfigValue(java.lang.String key, java.lang.Object[] args)
key
- the key to get the value forargs
- the arguments that should be substitutedprotected boolean hasConfigValue(java.lang.String key)
key
- the key to checkprotected void initLocalizationContent(java.lang.String configurationFileName)
configurationFileName
- the absolute path including site root to the configuration file containing localized keysprotected void initPathPrefix(java.lang.String pathPrefix)
pathPrefix
- the (optional) xPath prefix to the element nodes