@DefaultKey(value="fmtTool") @ValidScope(value="request") public class FormatTool extends RequestAwareTool
Constructor and Description |
---|
FormatTool() |
Modifier and Type | Method and Description |
---|---|
String |
jsMessagesDeclaration(String category,
String namespace)
Creates a Javascript declaration of an object containing all the key to localized message
mappings for the category.
|
String |
message(String key)
Returns the localized message for the provided key.
|
String |
message(String key,
List<Object> args)
Returns the localized message for the provided key.
|
String |
message(String key,
Locale locale)
Returns the localized message for the provided key.
|
String |
message(String key,
Object... args)
Returns the localized message for the provided key.
|
getRequest, getResponse, getServletContext, setRequest, setResponse, setServletContext
public String jsMessagesDeclaration(String category, String namespace)
category
- the category for which the messages are to be returned. Can be one of the built-in
categories (see constants in
JsMessagesRegistry
) or one provided
by plugin.namespace
- A string defining a namespace object (e.g. communote.i18n) to which the
localizedMessages member should be added.public String message(String key)
key
- the message keypublic String message(String key, List<Object> args)
key
- the message keyargs
- additional arguments to insert in place holderspublic String message(String key, Locale locale)
key
- the message keylocale
- use the provided locale for localization. If null the current locale provided by
the session handler will be used.Copyright © 2019 Communote team. All rights reserved.