You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Jeroen Kransen <st...@jeroen.kransen.nl> on 2005/01/27 21:57:06 UTC
feature request concerning locales
Hello,
I'm not sure if this is the right way or the right place to place a
feature request. If not, you can stop reading now. Instead of a feature
request, it might also be considered a (minor) bug.
I noticed the strong support for different locales by struts, which I
like very much. There is however one thing I am missing. Imagine that my
preferred language as set in the "Accept-language" setting of my browser
(and HTTP header in requests) is: "fr,de" (French and German
respectively). If I go to a Struts site that supports only English and
German (en,de), there is no match at all, no matter that I accept
German. Reason is the following lines in RequestUtils.java:
if (userLocale == null) {
// Returns Locale based on Accept-Language header or the
server default
userLocale = request.getLocale();
}
So, only the (first) preferred language is considered, and any
successive languages are discarded. According to the HTTP specs, it can
be a list of languages ("nl,en;q=0.8,de;q=0.5,..."). This is why the
HttpServletRequest also has a method getLocales() which returns an
Enumeration. I would like it if Struts would try to match any of the
successive languages for which .properties files exist if the first
isn't matched. I realize that it may cause a performance penalty, so
maybe it can be made a configuration option
(match-second-languages=true/false or something).
I hope you will consider to add this feature.
Regards, Jeroen Kransen
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
Re: feature request concerning locales
Posted by Martin Cooper <mf...@gmail.com>.
Good catch. Please file an enhancement request for this, so that it
doesn't get lost. See the instructions here:
http://struts.apache.org/faqs/helping.html#bugs
--
Martin Cooper
On Thu, 27 Jan 2005 21:57:06 +0100, Jeroen Kransen
<st...@jeroen.kransen.nl> wrote:
> Hello,
>
> I'm not sure if this is the right way or the right place to place a
> feature request. If not, you can stop reading now. Instead of a feature
> request, it might also be considered a (minor) bug.
>
> I noticed the strong support for different locales by struts, which I
> like very much. There is however one thing I am missing. Imagine that my
> preferred language as set in the "Accept-language" setting of my browser
> (and HTTP header in requests) is: "fr,de" (French and German
> respectively). If I go to a Struts site that supports only English and
> German (en,de), there is no match at all, no matter that I accept
> German. Reason is the following lines in RequestUtils.java:
>
> if (userLocale == null) {
> // Returns Locale based on Accept-Language header or the
> server default
> userLocale = request.getLocale();
> }
>
> So, only the (first) preferred language is considered, and any
> successive languages are discarded. According to the HTTP specs, it can
> be a list of languages ("nl,en;q=0.8,de;q=0.5,..."). This is why the
> HttpServletRequest also has a method getLocales() which returns an
> Enumeration. I would like it if Struts would try to match any of the
> successive languages for which .properties files exist if the first
> isn't matched. I realize that it may cause a performance penalty, so
> maybe it can be made a configuration option
> (match-second-languages=true/false or something).
>
> I hope you will consider to add this feature.
>
> Regards, Jeroen Kransen
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org