I'm in for comments on how the "locale" attribute would fit in best with the rest; for me, this works ideal;
 
I have a javax.servlet.Filter active that ensures that the sessionAttribute that "org.apache.struts.Globals.LOCALE_KEY"
points to is filled with either the first-request-in-session-Locale or the Locale that is actively requested by the user
(also by means of this filter).
 
then I fill in this attribute for all tables that I want displayed using this specific Locale.
 
the code I added was specifically written to ensure backward compatibility.
 
 
Dennis
 
p.s. As mentioned in another email to the displaytag-user list by Matt Raible the currently best way to override
the default locale is by adding <setProperty> tags. My code was specifically written to overcome this "short-coming"
(if I am allowed to name it as such)
 
 
 
----- Original Message -----
From: char
Sent: Wednesday, August 18, 2004 2:26 PM
Subject: Re: [displaytag-user] session wide Locale-specific displaytag.properties

hi,
why not let the "display:table" auto search the name in scope form page, request, session?
 
sorry, I know little about tag so could you explain it?
 
charlse
----- Original Message -----
Sent: Wednesday, August 18, 2004 4:48 AM
Subject: [displaytag-user] session wide Locale-specific displaytag.properties

Hi displaytag users,
 
I've implemented code for personal use that enables the use of session-, or request- wide Locale-specific
displaytag.properties to work besides the current Locale implementation.
 
 
as an example:
 
You could now do the following:
 
<%
    //just an example: store the preferred Locale for this session in an attribute
    if (session.getAttribute("userLocale") == null)
        {
        session.setAttribute("userLocale", request.getLocale());
        }
 
    // create a long list that spans over multiple pages
    request.setAttribute("list",new TestList(123));
%>
 
 
<display:table locale="sessionScope.userLocale" name="list" pagesize="15"/>
 
 
The table menu that enables browsing of the pages in the list could then be in any Locale you want.
for backward compatibility, if you specify the locale attribute the code will search for the displaytag.properties
files in the classpath at path: i18n/ ( e.g. i18n/displaytag_nl.properties )
 
Is anybody interested in this functionality ? should I submit the code ?
 
 
Dennis Geurts
 

Reply via email to