Commits

Anonymous committed 5efb1f8

use the action's locale if possible

git-svn-id: http://svn.opensymphony.com/svn/webwork/trunk@1795573baa09-0c28-0410-bef9-dab3c582ae83

  • Participants
  • Parent commits 3a2b7ff

Comments (0)

Files changed (1)

File src/java/com/opensymphony/webwork/views/freemarker/FreemarkerResult.java

 import com.opensymphony.webwork.views.util.ResourceUtil;
 import com.opensymphony.xwork.ActionContext;
 import com.opensymphony.xwork.ActionInvocation;
+import com.opensymphony.xwork.LocaleProvider;
 import com.opensymphony.xwork.util.OgnlValueStack;
 import freemarker.template.*;
 
     }
 
     /**
-     * Returns the locale used for the
-     * {@link Configuration#getTemplate(String, Locale)} call.
-     * The base implementation simply returns the locale setting of the
-     * configuration. Override this method to provide different behaviour,
+     * Returns the locale used for the {@link Configuration#getTemplate(String, Locale)} call. The base implementation
+     * simply returns the locale setting of the action (assuming the action implements {@link LocaleProvider}) or, if
+     * the action does not the configuration's locale is returned. Override this method to provide different behaviour,
      */
     protected Locale deduceLocale() {
-        return configuration.getLocale();
+        if (invocation.getAction() instanceof LocaleProvider) {
+            return ((LocaleProvider) invocation.getAction()).getLocale();
+        } else {
+            return configuration.getLocale();
+        }
     }
 
     /**