-
-
Notifications
You must be signed in to change notification settings - Fork 186
Milestone
Description
Description
This is a little tricky but I think I found the issue. We are using German (de) and Austrian (at) translations. Using Firefox, German users are redirected to /at. The issue is, that Firefox does not request to whole locale de_DE but only de.
The following lines from the core detectedLanguage method match the first occurence of de in the languages, which results in de_AT instead of de_DE thus redirecting to the "wrong" language.
// kirby/src/Cms/App.php
// Find language matches (e.g. en_GB => en)
$matchLanguage = function ($language) use ($acceptedLang) {
$languageLocale = $language->locale(LC_ALL);
$acceptedLocale = $acceptedLang->locale();
return
$languageLocale === $acceptedLocale ||
$acceptedLocale === Str::substr($languageLocale, 0, 2);
};Expected behavior
If no direct match for LC_ALL is found, the main language code match (e.g. de) should take precedence over the sliced part of LC_ALL.
Screenshots
To reproduce
- Set
"languages" => true, "languages.detect" => true - Add languages
en,de,at - Use Firefox to visit the hompage without language slug
Your setup
Kirby Version
Kirby 4 / Kirby 5
Your system (please complete the following information)
- Device: MacBook
- OS: macOS
- Browser: Firefox
- Version: 143.0.1 (aarch64)
Metadata
Metadata
Assignees
Labels
No labels
