You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "jason (JIRA)" <ji...@apache.org> on 2009/03/19 06:23:02 UTC
[jira] Created: (WW-3048) %{getText('login.username')} always uses
the en_US locale instead of ActionContext's locale
%{getText('login.username')} always uses the en_US locale instead of ActionContext's locale
-------------------------------------------------------------------------------------------
Key: WW-3048
URL: https://issues.apache.org/struts/browse/WW-3048
Project: Struts 2
Issue Type: Bug
Components: Other
Affects Versions: 2.1.6
Environment: Linux(Ubuntu) 2.6.24-19-generic; Sun Java 1.5.0_16; Tomcat 6.0.18; Intel x86 32-bit CPU
Reporter: jason
I have two property files: Messages.properties (the default locale) and Messages_de.properties (German locale). But when i use the following tag with the browser's locale set to de_DE:
<s:textfield id="username" name="username" label="%{getText('login.username')}" />
The output always uses the default locale's property file, i.e. Messages.properties. I even tries to use the request_locale like this:
http://myserver:8080/mycontext/myaction.action?request_locale=de
But the result is the same!
Then I tries to use <s:debug/> on the jsp page, and i can see the locale property for 'myaction' object in valueStack is set to 'en_US', but the com.opensymphony.xwork2.ActionContext.locale is set to de_DE.
Then I copies the code from Debug.java and put it to myaction's execute() method:
ValueStack stack = ActionContext.getContext().getActionInvocation().getStack();
Iterator iter = stack.getRoot().iterator();
List stackValues = new ArrayList(stack.getRoot().size());
OgnlReflectionProvider reflectionProvider = new OgnlReflectionProvider();
OgnlUtil ognlUtil = new OgnlUtil();
reflectionProvider.setOgnlUtil(ognlUtil);
while (iter.hasNext()) {
Object o = iter.next();
Map values;
try {
values = reflectionProvider.getBeanMap(o);
} catch (Exception e) {
throw new StrutsException("Caught an exception while getting the property values of " + o, e);
}
System.out.print(values);
}
Here i can see the locale property for 'myaction' object in valueStack is set to de_DE, this is correct.
My question is why the <s:debug/> output for myaction object's locale property is always 'en_US' but my copied code outputs 'de_DE'? and does the "%{getText('login.username')} ognl expression use the ActionContext's locale?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (WW-3048) %{getText('login.username')} always uses
the en_US locale instead of ActionContext's locale
Posted by "jason (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-3048?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
jason updated WW-3048:
----------------------
Environment: Linux(Ubuntu) 2.6.24-19-generic; Sun Java 1.5.0_16; Tomcat 6.0.18; Intel x86 32-bit CPU; integrated with Tile 2.0.6 and Spring Framework 2.5.5 (was: Linux(Ubuntu) 2.6.24-19-generic; Sun Java 1.5.0_16; Tomcat 6.0.18; Intel x86 32-bit CPU)
> %{getText('login.username')} always uses the en_US locale instead of ActionContext's locale
> -------------------------------------------------------------------------------------------
>
> Key: WW-3048
> URL: https://issues.apache.org/struts/browse/WW-3048
> Project: Struts 2
> Issue Type: Bug
> Components: Other
> Affects Versions: 2.1.6
> Environment: Linux(Ubuntu) 2.6.24-19-generic; Sun Java 1.5.0_16; Tomcat 6.0.18; Intel x86 32-bit CPU; integrated with Tile 2.0.6 and Spring Framework 2.5.5
> Reporter: jason
>
> I have two property files: Messages.properties (the default locale) and Messages_de.properties (German locale). But when i use the following tag with the browser's locale set to de_DE:
> <s:textfield id="username" name="username" label="%{getText('login.username')}" />
> The output always uses the default locale's property file, i.e. Messages.properties. I even tries to use the request_locale like this:
> http://myserver:8080/mycontext/myaction.action?request_locale=de
> But the result is the same!
> Then I tries to use <s:debug/> on the jsp page, and i can see the locale property for 'myaction' object in valueStack is set to 'en_US', but the com.opensymphony.xwork2.ActionContext.locale is set to de_DE.
> Then I copies the code from Debug.java and put it to myaction's execute() method:
> ValueStack stack = ActionContext.getContext().getActionInvocation().getStack();
>
> Iterator iter = stack.getRoot().iterator();
> List stackValues = new ArrayList(stack.getRoot().size());
> OgnlReflectionProvider reflectionProvider = new OgnlReflectionProvider();
> OgnlUtil ognlUtil = new OgnlUtil();
> reflectionProvider.setOgnlUtil(ognlUtil);
> while (iter.hasNext()) {
> Object o = iter.next();
> Map values;
> try {
> values = reflectionProvider.getBeanMap(o);
> } catch (Exception e) {
> throw new StrutsException("Caught an exception while getting the property values of " + o, e);
> }
> System.out.print(values);
> }
> Here i can see the locale property for 'myaction' object in valueStack is set to de_DE, this is correct.
> My question is why the <s:debug/> output for myaction object's locale property is always 'en_US' but my copied code outputs 'de_DE'? and does the "%{getText('login.username')} ognl expression use the ActionContext's locale?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.