Skip to content

Commit

Permalink
Update Jooa11y.php
Browse files Browse the repository at this point in the history
- Fixed locale issues
- Add default values
  • Loading branch information
adamchaboryk committed Feb 10, 2024
1 parent 7a0bd40 commit 4248c07
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions plugins/system/jooa11y/src/Extension/Jooa11y.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function initJooa11y()
// Get the right locale
$splitLang = explode('-', $getLang);
$lang = $splitLang[0];
$country = isset($parts[1]) ? $parts[1] : '';
$country = isset($splitLang[1]) ? $splitLang[1] : '';

// Sa11y is available in the following languages
$supportedLang = [
Expand Down Expand Up @@ -135,6 +135,7 @@ public function initJooa11y()
'sk',
'sv',
'tr',
'uk',
'ua',
'zh',
];
Expand All @@ -143,11 +144,11 @@ public function initJooa11y()
if (!\in_array($lang, $supportedLang)) {
$lang = 'en';
} elseif ($lang === 'pt') {
$lang = $country === 'br' ? 'ptBR' : 'ptPT';
$lang = $country === 'BR' ? 'ptBR' : 'ptPT';
} elseif ($lang === 'uk') {
$lang = 'ua';
} elseif ($lang === 'en') {
$lang = $country === 'us' ? 'enUS' : 'en';
$lang = $country === 'US' ? 'enUS' : 'en';
}

// Get the document object
Expand All @@ -158,11 +159,11 @@ public function initJooa11y()
'checkRoot' => $this->params->get('checkRoot', 'main'),
'readabilityRoot' => $this->params->get('readabilityRoot', 'main'),
'containerIgnore' => $this->params->get('containerIgnore'),
'contrastPlugin' => $this->params->get('contrastPlugin'),
'formLabelsPlugin' => $this->params->get('formLabelsPlugin'),
'linksAdvancedPlugin' => $this->params->get('linksAdvancedPlugin'),
'colourFilterPlugin' => $this->params->get('colourFilterPlugin'),
'checkAllHideToggles' => $this->params->get('additionalChecks'),
'contrastPlugin' => $this->params->get('contrastPlugin', 1),
'formLabelsPlugin' => $this->params->get('formLabelsPlugin', 1),
'linksAdvancedPlugin' => $this->params->get('linksAdvancedPlugin', 1),
'colourFilterPlugin' => $this->params->get('colourFilterPlugin', 1),
'checkAllHideToggles' => $this->params->get('additionalChecks', 0),
'shadowComponents' => $this->params->get('shadowComponents'),
];
$getExtraProps = $this->params->get('extraProps', []);
Expand Down

0 comments on commit 4248c07

Please sign in to comment.