From 66aa5654142879547c3003933c35b2c9223e8881 Mon Sep 17 00:00:00 2001 From: Pierre Stoffe Date: Fri, 10 Jun 2022 20:14:22 +0200 Subject: [PATCH 1/2] Lowercase locales from config file before processing Signed-off-by: Pierre Stoffe --- src/services/LanguageRedirectorService.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/services/LanguageRedirectorService.php b/src/services/LanguageRedirectorService.php index efb4f63..f98a2aa 100644 --- a/src/services/LanguageRedirectorService.php +++ b/src/services/LanguageRedirectorService.php @@ -325,6 +325,7 @@ public function getSiteFromLanguage(string $language = null, string $group = nul public function getSitesPerLanguage(string $group = null) { $languages = LanguageRedirector::getInstance()->getSettings()->languages; + $languages = array_change_key_case($languages, CASE_LOWER); if (is_array(reset($languages))) { $languages = $this->_getSitesPerLanguageInGroup($group); @@ -491,6 +492,7 @@ public function _getSitesPerLanguageInGroup(string $group = null) } $languagesInGroup = $languages[$siteGroup] ?? null; + $languagesInGroup = array_change_key_case($languagesInGroup, CASE_LOWER); return $languagesInGroup; } From b41ec48373e12756598e3563f58c940bcb0c514a Mon Sep 17 00:00:00 2001 From: Pierre Stoffe Date: Fri, 10 Jun 2022 20:18:27 +0200 Subject: [PATCH 2/2] Version bump Signed-off-by: Pierre Stoffe --- .craftplugin | 2 +- CHANGELOG.md | 5 +++++ composer.json | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.craftplugin b/.craftplugin index 38b880e..2676217 100644 --- a/.craftplugin +++ b/.craftplugin @@ -1 +1 @@ -{"pluginName":"Locale Redirector","pluginDescription":"Automatically redirect visitors to their preferred language","pluginVersion":"2.0.0","pluginAuthorName":"Pierre Stoffe","pluginVendorName":"pierrestoffe","pluginAuthorUrl":"https://pierrestoffe.be","pluginAuthorGithub":"pierrestoffe","codeComments":"yes","pluginComponents":["services"],"consolecommandName":"","controllerName":"","cpsectionName":"","elementName":"","fieldName":"","modelName":"","purchasableName":"","recordName":"","serviceName":"","taskName":"","utilityName":"","widgetName":"","apiVersion":"api_version_3_0"} +{"pluginName":"Locale Redirector","pluginDescription":"Automatically redirect visitors to their preferred language","pluginVersion":"2.0.1","pluginAuthorName":"Pierre Stoffe","pluginVendorName":"pierrestoffe","pluginAuthorUrl":"https://pierrestoffe.be","pluginAuthorGithub":"pierrestoffe","codeComments":"yes","pluginComponents":["services"],"consolecommandName":"","controllerName":"","cpsectionName":"","elementName":"","fieldName":"","modelName":"","purchasableName":"","recordName":"","serviceName":"","taskName":"","utilityName":"","widgetName":"","apiVersion":"api_version_3_0"} diff --git a/CHANGELOG.md b/CHANGELOG.md index d87af5b..d29a58d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ## [Unreleased] +## [2.0.1] - 2022-06-10 + +### Fixed +- Fixed language matching issue that would occur when the locales in the config file are not lowercase + ## [2.0.0] - 2022-05-15 ### Added diff --git a/composer.json b/composer.json index 13b34d1..87034ad 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "pierrestoffe/craft-language-redirector", "description": "Automatically redirect visitors to their preferred language", "type": "craft-plugin", - "version": "2.0.0", + "version": "2.0.1", "keywords": [ "craft", "cms",