You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by se...@apache.org on 2007/04/24 17:25:04 UTC

svn commit: r531981 - /jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/src/java/org/apache/turbine/services/localization/LocalizationTool.java

Author: seade
Date: Tue Apr 24 08:25:03 2007
New Revision: 531981

URL: http://svn.apache.org/viewvc?view=rev&rev=531981
Log:
Allow for a List argument so that the Velocity ["arg1", "arg2", "arg3"] syntax is supported.

Modified:
    jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/src/java/org/apache/turbine/services/localization/LocalizationTool.java

Modified: jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/src/java/org/apache/turbine/services/localization/LocalizationTool.java
URL: http://svn.apache.org/viewvc/jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/src/java/org/apache/turbine/services/localization/LocalizationTool.java?view=diff&rev=531981&r1=531980&r2=531981
==============================================================================
--- jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/src/java/org/apache/turbine/services/localization/LocalizationTool.java (original)
+++ jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/src/java/org/apache/turbine/services/localization/LocalizationTool.java Tue Apr 24 08:25:03 2007
@@ -16,6 +16,7 @@
  * limitations under the License.
  */
 
+import java.util.List;
 import java.util.Locale;
 import java.util.MissingResourceException;
 
@@ -145,7 +146,21 @@
     {
         return Localization.format(getBundleName(null), getLocale(), key, args);
     }
-    
+
+    /**
+     * Formats a localized value using the provided objects.  This variation
+     * allows for a List so that the velocity ["arg1", "arg2", "arg3"] syntax
+     * is supported.
+     *
+     * @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, List args)
+    {
+        return Localization.format(getBundleName(null), getLocale(), key, args.toArray());
+    }
 
     // ApplicationTool implmentation
 



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org