-
Type:
Bug
-
Status: Closed
-
Resolution: Fixed
-
Affects Version/s: 6.1.1 CE GA2
-
Fix Version/s: 6.0.X EE, 6.1.30 EE GA3, 6.2.3 CE GA4
-
Component/s: Legacy Components, Legacy Components > API
-
Labels:None
-
Environment:Tomcat-Bundle
Our portal-ext.properties has (among other things) following values:
locales=en_US,de_DE
locale.default.request=true
locale.prepend.friendly.url.style=2
We want to always have the language-code in the URL - e.g. www.example.com/en/whatever
Even if English is the default language.
With 6.0.6 CE this worked well but it seems broken in 6.1.1 CE.
I've been digging and debugging and the problem seems to be in the I18nFilter class around lines 130-150:
132: String i18nPathLanguageId = i18nLanguageId;
133:
134: Locale locale = LocaleUtil.fromLanguageId(i18nLanguageId);
135:
136: if (!LanguageUtil.isDuplicateLanguageCode(locale.getLanguage()))
139: else {
140: Locale priorityLocale = LanguageUtil.getLocale(
141: locale.getLanguage());
142:
143: if (locale.equals(priorityLocale))
146: }
147:
148: Locale i18nPathLocale = LocaleUtil.fromLanguageId(i18nPathLanguageId);
149:
150: if (!LanguageUtil.isAvailableLocale(i18nPathLocale))
A new guest visits the site for the first time and English is default.
1) i18nLanguageId is "en_US"
2) Because there are no duplicate languages (e.g. no "en_UK", "en_AU"...) i18nPathLanguageId is set to "en", which is correct.
3) Now the i18nPathLocale is only "en" (without the "US")
4) The result in line 150 is that LanguageUtil.isAvailableLocale(i18nPathLocale) = false and the function return null.
The problem is that the isAvailableLocale()-test is done with i18nPathLocale (="en") but the available locales are "en_US" and "de_DE".
Lines 148-152 are the only thing that changed between 6.0 and 6.1 which also explains why this worked in 6.0.
- duplicates
-
LPS-35039 Portal redirects guests to the default language when locale.prepend.friendly.url.style=2 and locale.default.request=true
- Closed