You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by pr...@apache.org on 2003/09/04 03:47:43 UTC
cvs commit: jakarta-commons/jelly/jelly-tags/fmt/src/test/org/apache/commons/jelly/tags/fmt abc.properties suite.jelly
proyal 2003/09/03 18:47:43
Modified: jelly/jelly-tags/fmt/src/java/org/apache/commons/jelly/tags/fmt
MessageTag.java
jelly/jelly-tags/fmt/src/test/org/apache/commons/jelly/tags/fmt
abc.properties suite.jelly
Log:
[JELLY-70] Have fmt:message tag process <param> tags in body when specifying
key attribute
Patch from Willie Vu
Revision Changes Path
1.4 +4 -0 jakarta-commons/jelly/jelly-tags/fmt/src/java/org/apache/commons/jelly/tags/fmt/MessageTag.java
Index: MessageTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons/jelly/jelly-tags/fmt/src/java/org/apache/commons/jelly/tags/fmt/MessageTag.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- MessageTag.java 26 Jan 2003 02:02:08 -0000 1.3
+++ MessageTag.java 4 Sep 2003 01:47:43 -0000 1.4
@@ -111,14 +111,18 @@
}
public void doTag(XMLOutput output) throws JellyTagException {
+
Object keyInput = null;
if (this.key != null) {
keyInput = this.key.evaluate(context);
+ // process <param> sub tags
+ invokeBody(output);
}
else {
// get key from body
keyInput = getBodyText();
}
+
if ((keyInput == null) || keyInput.equals("")) {
try {
1.2 +2 -0 jakarta-commons/jelly/jelly-tags/fmt/src/test/org/apache/commons/jelly/tags/fmt/abc.properties
Index: abc.properties
===================================================================
RCS file: /home/cvs/jakarta-commons/jelly/jelly-tags/fmt/src/test/org/apache/commons/jelly/tags/fmt/abc.properties,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- abc.properties 16 Jan 2003 16:21:46 -0000 1.1
+++ abc.properties 4 Sep 2003 01:47:43 -0000 1.2
@@ -4,3 +4,5 @@
key2=value2
key3=value3 {0} {1}
+
+key4=value4 {0} {1} {2,number,integer}
1.3 +33 -0 jakarta-commons/jelly/jelly-tags/fmt/src/test/org/apache/commons/jelly/tags/fmt/suite.jelly
Index: suite.jelly
===================================================================
RCS file: /home/cvs/jakarta-commons/jelly/jelly-tags/fmt/src/test/org/apache/commons/jelly/tags/fmt/suite.jelly,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- suite.jelly 18 Jan 2003 06:35:27 -0000 1.2
+++ suite.jelly 4 Sep 2003 01:47:43 -0000 1.3
@@ -27,6 +27,7 @@
<test:case name="testParam" xmlns="dummy">
<j:set var="keyvar" value="key3"/>
<j:set var="valuevar" value="param1"/>
+
<fmt:bundle basename="org.apache.commons.jelly.tags.fmt.abc">
<fmt:message var="dummyKey3">${keyvar}<fmt:param value="${valuevar}"/>
<fmt:param value="param2"/>
@@ -37,6 +38,38 @@
<m:echo>key3: '${dummyKey3}'</m:echo>
<test:assertEquals expected="value3 param1 param2" actual="${dummyKey3}" />
+
+ <fmt:bundle basename="org.apache.commons.jelly.tags.fmt.abc">
+ <fmt:message var="dummyKey3" key="${keyvar}"><fmt:param value="${valuevar}"/>
+ <fmt:param value="param2"/>
+ </fmt:message>
+ </fmt:bundle>
+
+ <m:echo>i10n content is </m:echo>
+ <m:echo>key3: '${dummyKey3}'</m:echo>
+
+ <test:assertEquals expected="value3 param1 param2" actual="${dummyKey3}" />
+ </test:case>
+
+ <test:case name="testParam" xmlns="dummy">
+ <j:set var="keyvar" value="key4"/>
+ <j:set var="valuevar" value="param1"/>
+ <j:set var="intvalue" value="123"/>
+ <j:new className="java.lang.Integer" var="intValue">
+ <j:arg value="123"/>
+ </j:new>
+ <test:assertEquals expected="java.lang.Integer" actual="${intValue.class.name}" />
+ <fmt:bundle basename="org.apache.commons.jelly.tags.fmt.abc">
+ <fmt:message var="dummyKey4">${keyvar}<fmt:param value="${valuevar}"/>
+ <fmt:param value="param2"/>
+ <fmt:param value='${intValue}'/>
+ </fmt:message>
+ </fmt:bundle>
+
+ <m:echo>i10n content is </m:echo>
+ <m:echo>key4: '${dummyKey4}'</m:echo>
+
+ <test:assertEquals expected="value4 param1 param2 123" actual="${dummyKey4}" />
</test:case>