Rafa created WW-5549: ------------------------ Summary: i18n interceptor param supportedLocale (when set) disables request_locale param functionality Key: WW-5549 URL: https://issues.apache.org/jira/browse/WW-5549 Project: Struts 2 Issue Type: Bug Components: Core Interceptors Affects Versions: 6.3.0 Reporter: Rafa
It seems that when {{supportedLocale}} parameter is set on {{i18n}} interceptor - language change using {{request_locale}} param is not possible anymore if current browser {{Accept-Language}} matches the {{supportedLocale}} value. I set {{supportedLocale}} parameter on the {{i18n}} interceptor (e.g. to {{fr,en}} value). Now i enter the webapp (using a browser with fr language set as default) and the struts locale is set to {{fr}} (as expected - ok). Now i try switching the locale to {{en}} using the {{?request_locale=en}} built-in feature - but this does not work ({{{}fr{}}} is still set as language). If i do not set the {{supportedLocale}} param on the {{i18n}} interceptor - everything works fine (for exactly the same webapp, and the {{request_locale}} request param switch is working fine) but then i loose the feature of {_}struts preselecting fr language as default for browsers with fr language set as default{_}. When i look into the source code of [I18nInterceptor.java|https://github.com/apache/struts/blob/main/core/src/main/java/org/apache/struts2/interceptor/I18nInterceptor.java#L302] (line 302) it looks like {{AcceptLanguageLocaleHandler.find()}} is always returning one of the {{supportedLocale}} locales if browser has matching {{Accept-Language}} header - but it shall not e.g. when {{request_locale}} param is set (it shall take precedence here). -- This message was sent by Atlassian Jira (v8.20.10#820010)