|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.tools.ant.ProjectComponent org.apache.tools.ant.Task org.apache.tools.ant.taskdefs.Echo mazz.i18n.ant.I18NMessageAntTask
@I18NResourceBundle(baseName="i18n-anttask-messages", defaultLocale="en") public class I18NMessageAntTask
An ANT task to retrieve an i18n message. A typical usage of this ANT task is as follows:
The<taskdef name="i18n-msg" classpathref="i18nlog-jar.classpath" classname="mazz.i18n.ant.I18NMessageAntTask" /> <i18n-msg message="my.bundle.key" <!-- the message key that identifies the message in the bundle --> bundle="my-messages" <!-- where the messages are found; if not specified, 'messages' is the default --> locale="de" <!-- explicitly defines what message translation to retrieve; defaults to the VM default locale --> property="prop.name"> <!-- if defined, the message is stored in this property; otherwise it is echoed --> <arg value="first arg" /> <!-- replaces {0} in the message --> <arg value="second arg" /> <!-- replaces {1} in the message --> <i18n-msg>
classpathref
must also point to the resource bundle files that contain the i18n messages. Note
that this task extends the echo
task, so all attributes for that task are also allowed. The only
difference is the message
attribute is not the message itself, but rather the resource bundle
message key.
Nested Class Summary | |
---|---|
class |
I18NMessageAntTask.Arg
The inner <arg> element that defines the replacement strings for the localized message placeholders (for example: {0}, {1}). |
Nested classes/interfaces inherited from class org.apache.tools.ant.taskdefs.Echo |
---|
org.apache.tools.ant.taskdefs.Echo.EchoLevel |
Field Summary |
---|
Fields inherited from class org.apache.tools.ant.taskdefs.Echo |
---|
append, file, logLevel, message |
Fields inherited from class org.apache.tools.ant.Task |
---|
description, location, target, taskName, taskType, wrapper |
Fields inherited from class org.apache.tools.ant.ProjectComponent |
---|
project |
Constructor Summary | |
---|---|
I18NMessageAntTask()
|
Method Summary | |
---|---|
I18NMessageAntTask.Arg |
createArg()
Creates a new argument that is used to define the values of the localized message placeholders (such as {0}). |
void |
execute()
|
void |
setBundle(Msg.BundleBaseName bundle)
Sets the base bundle name which identifies the resource bundle where the message can be found. |
void |
setLocale(java.util.Locale locale)
Sets the locale of the message to be retrieved. |
void |
setProperty(java.lang.String property)
Sets the name of the property whose value will be set to the localized message string. |
Methods inherited from class org.apache.tools.ant.taskdefs.Echo |
---|
addText, setAppend, setFile, setLevel, setMessage |
Methods inherited from class org.apache.tools.ant.Task |
---|
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType |
Methods inherited from class org.apache.tools.ant.ProjectComponent |
---|
getProject, setProject |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public I18NMessageAntTask()
Method Detail |
---|
public void setBundle(Msg.BundleBaseName bundle)
bundle
- public void setLocale(java.util.Locale locale)
locale
- public void setProperty(java.lang.String property)
property
- public I18NMessageAntTask.Arg createArg()
public void execute() throws org.apache.tools.ant.BuildException
execute
in class org.apache.tools.ant.taskdefs.Echo
org.apache.tools.ant.BuildException
Task.execute()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |