You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2003/02/28 18:26:22 UTC

DO NOT REPLY [Bug 17535] New: - needs more ways to specify locale

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17535>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17535

<bean:message> needs more ways to specify locale

           Summary: <bean:message> needs more ways to specify locale
           Product: Struts
           Version: 1.1 RC1
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Custom Tags
        AssignedTo: struts-dev@jakarta.apache.org
        ReportedBy: gdebruyckere@deloitte.com


Currently, the <bean:message> tag is designed to retrieve messages in the 
user's locale only. Consider a situation where a user needs to print a report 
for his/her manager, who speaks a different language (common in some 
countries). At the moment, a way to do this is to use the following construct:

...
<bean:define id="manager" name="managerBean" type="ManagerBean"/>
<bean:define id="managerLocale" name="manager" property="locale" 
type="java.util.Locale" toScope="session"/>
...
<bean:message key="report.title" locale="managerLocale"/>
...

This works fine, as long as the locale object is created in session scope. This 
is because the object is eventually retrieved using the 
RequestUtils.retrieveUserLocale() method, which only looks for it in the 
session. I think it would be more logical if the <bean:message> tag would look 
for the locale in page, request, session and application scope consecutively.

But why store an extra locale object in any scope? It would be great to have a 
way to specify the manager's locale property directly, e.g.:

...
<bean:define id="manager" name="managerBean" type="ManagerBean"/>
...
<bean:message key="report.title" localeName="manager" localeProperty="locale"/>
...

The easiest way would be to reuse the "name" and "property" attributes. 
Although this might be confusing, they could be used to specify the locale if 
the "key" attribute is also provided, e.g.:

...
<bean:message key="report.title" name="manager" property="locale"/>
...

I hope to have made a useful contribution, and would be grateful for such an 
enhancement. Thank you.

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