Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
pierrestoffe committed Jun 10, 2022
2 parents ac8bf13 + b41ec48 commit a2bd8af
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .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"}
5 changes: 5 additions & 0 deletions CHANGELOG.md
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions src/services/LanguageRedirectorService.php
Expand Up @@ -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);
Expand Down Expand Up @@ -491,6 +492,7 @@ public function _getSitesPerLanguageInGroup(string $group = null)
}

$languagesInGroup = $languages[$siteGroup] ?? null;
$languagesInGroup = array_change_key_case($languagesInGroup, CASE_LOWER);

return $languagesInGroup;
}
Expand Down

0 comments on commit a2bd8af

Please sign in to comment.