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

http://issues.apache.org/bugzilla/show_bug.cgi?id=30034

Locale feature is unsutisfuctory





------- Additional Comments From [EMAIL PROTECTED]  2004-07-11 11:59 -------
If you turn the "locale" to false, no locale tracking is made on the session,
meaning struts will get the locale from each query.
So if I change my browser to German, struts looks for german resources, does not
find them and I'm in trouble :(

The hook:

interface LocaleSupplier {
  public Locale getLocale(HttpServletRequest request);
}

class DefaultLocaleSupplier implements LocaleSupplier {
  public Locale getLocale(HttpServletRequest request) {
    Locale l = getlocaleFromSession(request);
    if (l == null)
       l = getLocaleFromURL(request);
    if (l == null)
       l = getLocaleFromApplication(request);
    if (l == 0)
       l = getLocaleFromSystem(request);
     return l;
   }

add to servlet configuration an optional parameter:
    <init-param>
      <param-name>locale-supplier</param-name>
      <param-value>full.qualified.class.Name</param-value>
    </init-param>

This has the advantages the locale has a decent default behaiviour :

in apache I could map mysite.com, mysite.de, mysite.nl, mysite.it all to the
same tomcat application. the getLocaleFromURL will check the domain name and
give back the correct locale.
One could also implement the getLocaleFromURL so that it functions in another
way, thus uses subdomains:

www.mysite.com, 
de.mysite.com, 
nl.mysite.com

or

www.mysite.com/en/
www.mysite.com/de/
www.mysite.com/nl/

These are all possible locale parsing methods.

Since the LocaleSupplier also checks the session, if the site-developer want to
give the user the option to change the locale, he just needs to save the locale
in the session - it will "override" the default one comming from the url.

How do you find this?

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to