dlr: Please make this part of the LocalizationService and expose the functionality through the LocalizationTool. The reason is that this way, we will have a consistent interface for the Service as well as the Tool.
-jon on 10/23/01 11:46 AM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > dlr 01/10/23 11:46:11 > > Modified: src/tool/org/apache/turbine/tool LocalizationTool.java > Log: > Patch by Leonardr Richardson <[EMAIL PROTECTED]> which adds > MessageFormat capabilities to property values defined in a > ResourceBundle. > > Revision Changes Path > 1.15 +42 -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.14 > retrieving revision 1.15 > diff -u -u -r1.14 -r1.15 > --- LocalizationTool.java 2001/10/22 06:08:58 1.14 > +++ LocalizationTool.java 2001/10/23 18:46:11 1.15 > @@ -54,6 +54,7 @@ > * <http://www.apache.org/>. > */ > > +import java.text.MessageFormat; > import java.util.Locale; > import java.util.MissingResourceException; > import java.util.ResourceBundle; > @@ -83,6 +84,7 @@ > * > * @author <a href="mailto:[EMAIL PROTECTED]">Daniel Rall</a> > * @author <a href="mailto:[EMAIL PROTECTED]">Jon Stevens</a> > + * @author <a href="mailto:[EMAIL PROTECTED]">Leonard Richardson</a> > */ > public class LocalizationTool implements ApplicationTool > { > @@ -167,6 +169,46 @@ > { > return formatErrorMessage(key, noKey); > } > + } > + > + /** > + * Formats a localized value using the provided object. > + * > + * @param key The identifier for the localized text to retrieve, > + * @param arg1 The object to use as {0} when formatting the localized > text. > + * @return Formatted localized text. > + * @see #format(String, Object[]) > + */ > + public String format(String key, Object arg1) > + { > + return format(key, new Object[] { arg1 }); > + } > + > + /** > + * Formats a localized value using the provided objects. > + * > + * @param key The identifier for the localized text to retrieve, > + * @param arg1 The object to use as {0} when formatting the localized > text. > + * @param arg2 The object to use as {1} when formatting the localized > text. > + * @return Formatted localized text. > + * @see #format(String, Object[]) > + */ > + public String format(String key, Object arg1, Object arg2) > + { > + return format(key, new Object[] { arg1, arg2 }); > + } > + > + /** > + * Formats a localized value using the provided objects. > + * > + * @param key The identifier for the localized text to retrieve, > + * @param args The objects to use as {0}, {1}, etc. when > + * formatting the localized text. > + * @return Formatted localized text. > + */ > + public String format(String key, Object[] args) > + { > + return MessageFormat.format(get(key), args); > } > > /** --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
