public final class Messages extends A_CmsMessageBundle
Additionally two utility methods for localization in the context of
TagSupport
implementations of the org.opencms.jsp
package are provided .
The javax.servlet.jsp.tagext.TagSupport
API constraint only allows to throw
certain Exception
types which forbids to use CmsException
which will be localized with the current user's locale at the time the request is evaluated.
At the same time TagSupport
implementations may use their member
pageContext
to get the CmsObject
and therefore the user request's
locale.
These methods provided here factor out the localization of exception messages and return Strings
for the org.opencms.jsp
pacakge.
限定符和类型 | 字段和说明 |
---|---|
static java.lang.String |
GUI_CLICK_TO_ADD_ELEMENT_TO_EMPTY_LIST_0
Message constant for key in the resource bundle.
|
限定符和类型 | 方法和说明 |
---|---|
static I_CmsMessageBundle |
get()
Returns an instance of this localized message accessor.
|
java.lang.String |
getBundleName()
Returns the bundle name for this OpenCms package.
|
static java.lang.String |
getLocalizedMessage(CmsMessageContainer container,
CmsObject cms)
Returns the String for the given CmsMessageContainer localized to the current user's locale
if available or to the default locale else.
|
static java.lang.String |
getLocalizedMessage(CmsMessageContainer container,
javax.servlet.jsp.PageContext context)
Returns the String for the given CmsMessageContainer localized to the current user's locale
if available or to the default locale else.
|
static java.lang.String |
getLocalizedMessage(CmsMessageContainer container,
javax.servlet.ServletRequest request)
Returns the String for the given CmsMessageContainer localized to the current user's locale
if available or to the default locale else.
|
container, container, container, container, container, getBundle, getBundle, getOpenCmsMessageBundles, toString
public static final java.lang.String GUI_CLICK_TO_ADD_ELEMENT_TO_EMPTY_LIST_0
public static I_CmsMessageBundle get()
public static java.lang.String getLocalizedMessage(CmsMessageContainer container, CmsObject cms)
This method is needed for localization of non- CmsException
instances that have to be thrown here due to API constraints (javax.servlet.jsp).
container
- A CmsMessageContainer containing the message to localize.cms
- the CmsObject
belonging to the current user (e.g. obtained with
CmsFlexController.getCmsObject(ServletRequest)
).public static java.lang.String getLocalizedMessage(CmsMessageContainer container, javax.servlet.jsp.PageContext context)
This method is needed for localization of non- CmsException
instances that have to be thrown here due to API constraints (javax.servlet.jsp).
container
- A CmsMessageContainer containing the message to localize.context
- The page context that is known to any calling
TagSupport
instance (member
pageContext
).public static java.lang.String getLocalizedMessage(CmsMessageContainer container, javax.servlet.ServletRequest request)
This method allows a static method (CmsJspTagInfo.infoTagAction(String, javax.servlet.http.HttpServletRequest)
)
that has no pageContext
in scope to lookup the locale at request time.
container
- A CmsMessageContainer containing the message to localize.request
- The current request.getLocalizedMessage(CmsMessageContainer, PageContext)
public java.lang.String getBundleName()