Commits

Anonymous committed 8dab086

i18n should allow for parameters in messages, duh

git-svn-id: http://svn.opensymphony.com/svn/xwork/trunk@34e221344d-f017-0410-9bd5-d282ab1896d7

Comments (0)

Files changed (1)

src/java/com/opensymphony/xwork/util/LocalizedTextUtil.java

      * @return
      */
     public static String findText(Class aClass, String aTextName, Locale locale, String defaultMessage) {
+        OgnlValueStack valueStack = ActionContext.getContext().getValueStack();
         do {
             try {
                 ResourceBundle bundle = findResourceBundle(aClass.getName(), locale);
 
-                return bundle.getString(aTextName);
+                return TextParseUtil.translateVariables(bundle.getString(aTextName), valueStack);
             } catch (MissingResourceException ex) {
                 aClass = aClass.getSuperclass();
             }
         } while (!aClass.equals(Object.class));
 
         try {
-            return findDefaultText(aTextName, locale);
+            return TextParseUtil.translateVariables(findDefaultText(aTextName, locale), valueStack);
         } catch (MissingResourceException ex) {
             //ignore
         }
 
         LOG.debug("Unable to find text for key " + aTextName);
 
-        return defaultMessage;
+        return TextParseUtil.translateVariables(defaultMessage, valueStack);
     }
 }