dlr 01/11/12 12:15:39
Modified: src/tool/org/apache/turbine/tool LocalizationTool.java
Log:
o Added format(String key, Object[] args) overload to support using
the return values from other bean methods in a template.
o Added format(String key, ArrayList args) overload as a work around
for a bug in Velocity.
Revision Changes Path
1.23 +27 -0
jakarta-turbine-3/src/tool/org/apache/turbine/tool/LocalizationTool.java
Index: LocalizationTool.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-3/src/tool/org/apache/turbine/tool/LocalizationTool.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -u -r1.22 -r1.23
--- LocalizationTool.java 2001/11/11 19:37:28 1.22
+++ LocalizationTool.java 2001/11/12 20:15:39 1.23
@@ -54,6 +54,7 @@
* <http://www.apache.org/>.
*/
+import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.MissingResourceException;
@@ -199,6 +200,20 @@
}
/**
+ * Formats a localized value using the provided objects.
+ *
+ * @param key The identifier for the localized text to retrieve,
+ * @param args The <code>MessageFormat</code> data used when
+ * formatting the localized text.
+ * @return Formatted localized text.
+ * @see #format(String, List)
+ */
+ public String format(String key, Object[] args)
+ {
+ return Localization.format(getBundleName(), getLocale(), key, args);
+ }
+
+ /**
* <p>Formats a localized value using the provided objects.</p>
*
* <p>ResourceBundle:
@@ -225,6 +240,18 @@
{
return Localization.format(getBundleName(), getLocale(), key,
args.toArray());
+ }
+
+ /**
+ * This method exists as a work around for an "overloaded Java
+ * method called from Velocity template" delegation bug in
+ * Velocity.
+ *
+ * @see #format(String, List)
+ */
+ public String format(String key, ArrayList args)
+ {
+ return format(key, (List) args);
}
/**
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>