aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2023-10-18 03:43:26 +0200
committerGitHub <noreply@github.com>2023-10-18 03:43:26 +0200
commit1f8c21a581227d330248f7fd01240287052875a1 (patch)
treebf0343daaa02fd737ad16245fe58ce65fca7a072 /lib
parent1d9d3b691247c6c6541db5c4e0a902472d846402 (diff)
parent1bf15da86343b8213a8554fcf3cda78a9000b455 (diff)
downloadnextcloud-server-1f8c21a581227d330248f7fd01240287052875a1.tar.gz
nextcloud-server-1f8c21a581227d330248f7fd01240287052875a1.zip
Merge pull request #40808 from c39cfbb3/patch-3
fix(L10N): Support "Accept-Language: zh-Hans-CN" and alike
Diffstat (limited to 'lib')
-rw-r--r--lib/private/L10N/Factory.php4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/private/L10N/Factory.php b/lib/private/L10N/Factory.php
index f7d3fec4ff6..6de620e7ec7 100644
--- a/lib/private/L10N/Factory.php
+++ b/lib/private/L10N/Factory.php
@@ -490,10 +490,14 @@ class Factory implements IFactory {
[$preferred_language] = explode(';', $preference);
$preferred_language = str_replace('-', '_', $preferred_language);
+ $preferred_language_parts = explode('_', $preferred_language);
foreach ($available as $available_language) {
if ($preferred_language === strtolower($available_language)) {
return $this->respectDefaultLanguage($app, $available_language);
}
+ if ($preferred_language_parts[0].'_'.end($preferred_language_parts) === strtolower($available_language)) {
+ return $available_language;
+ }
}
// Fallback from de_De to de