diff options
author | c39cfbb3 <145777845+c39cfbb3@users.noreply.github.com> | 2023-10-07 11:44:46 +0800 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2023-10-18 02:33:54 +0200 |
commit | f7cd3d17b8cd41ec8cfb867b1404c0ac452a2c80 (patch) | |
tree | 492d0ee5217f4f48e621bc405aed8dd90aaf0964 /lib | |
parent | 54d1ec58bf432df9b9c65583dfb0e207022d5076 (diff) | |
download | nextcloud-server-f7cd3d17b8cd41ec8cfb867b1404c0ac452a2c80.tar.gz nextcloud-server-f7cd3d17b8cd41ec8cfb867b1404c0ac452a2c80.zip |
L10N/Factory: Support "Accept-Language: zh-Hans-CN" and alike
Signed-off-by: c39cfbb3 <145777845+c39cfbb3@users.noreply.github.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/L10N/Factory.php | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/private/L10N/Factory.php b/lib/private/L10N/Factory.php index f7d3fec4ff6..7361ab1a9dd 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].'_'.$preferred_language_parts[count($preferred_language_parts) - 1] === strtolower($available_language)) { + return $available_language; + } } // Fallback from de_De to de |