Skip to content

Commit

Permalink
Fix call of getTwoLetterIsoCode
Browse files Browse the repository at this point in the history
  • Loading branch information
lochmueller committed Nov 20, 2024
1 parent c5febc2 commit 429b5fc
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions Classes/Negotiation/DefaultNegotiation.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,18 @@ public function __construct(protected Normalizer $normalizer) {}

public function __invoke(NegotiateSiteLanguageEvent $event): void
{
$compareWith = [
'getLocale',
'getTwoLetterIsoCode',
];

$userLanguages = $this->normalizer->normalizeList($event->getUserLanguages());
foreach ($userLanguages->toArray() as $userLanguage) {
foreach ($event->getSite()->getLanguages() as $siteLanguage) {
foreach ($compareWith as $function) {
$compareWith = [
(string)$siteLanguage->getLocale(),
$siteLanguage->getLocale()->getLanguageCode(),
];
foreach ($compareWith as $value) {
$config = $siteLanguage->toArray();
if ($siteLanguage->enabled()
&& ($config['excludeFromLanguageDetection'] ?? false) !== true
&& (string)$userLanguage === $this->normalizer->normalize((string)$siteLanguage->{$function}())
&& (string)$userLanguage === $this->normalizer->normalize($value)
) {
$event->setSelectedLanguage($siteLanguage);

Expand Down

0 comments on commit 429b5fc

Please sign in to comment.