类 MessageTool
java.lang.Object
org.apache.velocity.tools.struts.MessageResourcesTool
org.apache.velocity.tools.struts.MessageTool
The MessageTool is used to render internationalized message strings. Source of the strings are the message resource bundles of the Struts framework. The following methods operate on these message resources.
Template example(s): #if( $text.greeting.exists ) $text.greeting #end Toolbox configuration: <tools> <toolbox scope="request"> <tool class="org.apache.velocity.tools.struts.MessageTool"/> </toolbox> </tools>
This tool should only be used in the request scope.
- 从以下版本开始:
- VelocityTools 1.0
- 版本:
- $Id: MessageTool.java 601976 2007-12-07 03:50:51Z nbubna $
- 作者:
- Gabe Sidler
-
嵌套类概要
嵌套类修饰符和类型类说明class
Helper class to simplify tool usage when retrieving no-arg messages from the default bundle that have periods in their key. -
字段概要
从类继承的字段 org.apache.velocity.tools.struts.MessageResourcesTool
application, LOG, request
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明boolean
Checks if a message string for a specified message key exists for the user's locale.boolean
Checks if a message string for a specified message key exists for the user's locale.Looks up and returns the localized message for the specified key.Looks up and returns the localized message for the specified key.Looks up and returns the localized message for the specified key.Looks up and returns the localized message for the specified key.Looks up and returns the localized message for the specified key.Same asget(String key, Object[] args)
, but takes ajava.util.List
instead of an array.Looks up and returns the localized message for the specified key.Same asget(String key, Object[] args)
, but takes ajava.util.List
instead of an array.从类继承的方法 org.apache.velocity.tools.struts.MessageResourcesTool
configure, getLocale, getResources, init
-
构造器详细资料
-
MessageTool
public MessageTool()
-
-
方法详细资料
-
get
Looks up and returns the localized message for the specified key. The user's locale is consulted to determine the language of the message.Example use: $text.forms.profile.title
- 参数:
key
- message key
-
get
Looks up and returns the localized message for the specified key. The user's locale is consulted to determine the language of the message.- 参数:
key
- message keybundle
- The bundle name to look for.- 返回:
- the localized message for the specified key or
null
if no such message exists - 从以下版本开始:
- VelocityTools 1.1
-
get
Looks up and returns the localized message for the specified key. Replacement parameters passed withargs
are inserted into the message. The user's locale is consulted to determine the language of the message.- 参数:
key
- message keyargs
- replacement parameters for this message- 返回:
- the localized message for the specified key or
null
if no such message exists
-
get
Looks up and returns the localized message for the specified key. Replacement parameters passed withargs
are inserted into the message. The user's locale is consulted to determine the language of the message.- 参数:
key
- message keybundle
- The bundle name to look for.args
- replacement parameters for this message- 返回:
- the localized message for the specified key or
null
if no such message exists - 从以下版本开始:
- VelocityTools 1.1
-
get
Looks up and returns the localized message for the specified key. Replacement parameters passed withargs
are inserted into the message.- 参数:
key
- message keybundle
- The bundle name to look for.args
- replacement parameters for this messagelocale
- The locale to use for this message.- 返回:
- the localized message for the specified key or
null
if no such message exists - 从以下版本开始:
- VelocityTools 1.4
-
get
Same asget(String key, Object[] args)
, but takes ajava.util.List
instead of an array. This is more Velocity friendly.- 参数:
key
- message keyargs
- replacement parameters for this message- 返回:
- the localized message for the specified key or
null
if no such message exists
-
get
Same asget(String key, Object[] args)
, but takes ajava.util.List
instead of an array. This is more Velocity friendly.- 参数:
key
- message keybundle
- The bundle name to look for.args
- replacement parameters for this message- 返回:
- the localized message for the specified key or
null
if no such message exists - 从以下版本开始:
- VelocityTools 1.1
-
get
Looks up and returns the localized message for the specified key. Replacement parameters passed withargs
are inserted into the message.- 参数:
key
- message keybundle
- The bundle name to look for.args
- replacement parameters for this messagelocale
- The locale to use for this message.- 返回:
- the localized message for the specified key or
null
if no such message exists - 从以下版本开始:
- VelocityTools 1.4
-
exists
Checks if a message string for a specified message key exists for the user's locale.- 参数:
key
- message key- 返回:
true
if a message strings exists,false
otherwise
-
exists
Checks if a message string for a specified message key exists for the user's locale.- 参数:
key
- message keybundle
- The bundle name to look for.- 返回:
true
if a message strings exists,false
otherwise- 从以下版本开始:
- VelocityTools 1.1
-