From: Michael Date: Sun, 3 Sep 2023 19:22:52 +0000 (+0000) Subject: Simplified conversion X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4df7faef6db11cb7e6a82a98835b38701ce6b1d5;p=friendica.git Simplified conversion --- diff --git a/src/Core/L10n.php b/src/Core/L10n.php index 9d1fa70167..96935a4ed6 100644 --- a/src/Core/L10n.php +++ b/src/Core/L10n.php @@ -414,16 +414,15 @@ class L10n */ public function convertForLanguageDetection(array $languages): array { - $languages['fi'] = $languages['fi-fi']; - unset($languages['fi-fi']); - $languages['da'] = $languages['da-dk']; - unset($languages['da-dk']); - $languages['nb'] = $languages['nb-no']; - unset($languages['nb-no']); - $languages['pt-BR'] = $languages['pt-br']; - unset($languages['pt-br']); - $languages['zh-Hans'] = $languages['zh-cn']; - unset($languages['zh-cn']); + foreach ($languages as $key => $language) { + $newkey = $this->convertCodeForLanguageDetection($key); + if ($newkey != $key) { + if (!isset($languages[$newkey])) { + $languages[$newkey] = $language; + } + unset($languages[$key]); + } + } ksort($languages);