struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Germuska <...@Germuska.com>
Subject Re: Locale resolver (Re: WW/SAF2 i18n & Cintoo Messages)
Date Fri, 30 Jun 2006 19:30:45 GMT
At 11:36 AM -0700 6/30/06, Paul Benedict wrote:
>Some further reflections:
>
>WW and SPR both use ThreadLocal to store the locale of the thread's 
>request. However, there still needs to be a shared object that can 
>set/retrieve the local across web frameworks.
>
>So I 100% agree with the ThreadLocal use, but it is not directly 
>relevant to my question. That would be an implementation of the 
>locale resolver, in which it would expose the locale in the thread 
>for a particular framework.

On the other hand, perhaps using a thread local is a more elegant 
strategy than requiring a specific mechanism which looks for a 
specific object in the ApplicationContext and uses a specific 
reflection mechanism to find a locale.

At 10:53 AM -0700 6/30/06, Paul Benedict wrote:
>3) Modify RequestUtils.getUserLocale to lookup the stategy first and 
>use it. RequestUtils will have a pre-built strategy for doing 
>session look-up, to implement requirement #1 (see above).

That is, there are lots of ways to make sure that Globals.LOCALE_KEY 
points to the right locale, and you could leave the details which you 
specify (to do with Globals.LOCALE_RESOLVER_KEY) more up to the 
implementor.  I might just write a ServletFilter instead of putting 
in a LOCALE_RESOLVER, or I might write a custom chain command.  It 
seems to me better to leave the things which need the Locale ignorant 
of how to find it.  In fact, you could easily replace the "SetLocale" 
command with another that consulted cookies or request parameters.

Joe
-- 
Joe Germuska
Joe@Germuska.com * http://blog.germuska.com    

"You really can't burn anything out by trying something new, and
even if you can burn it out, it can be fixed.  Try something new."
	-- Robert Moog

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


Mime
View raw message