aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/L10N
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2023-06-21 07:11:16 +0200
committerJoas Schilling <coding@schilljs.com>2023-06-21 07:14:56 +0200
commitab8205fd35a3815673fc17fa78adc5bc770cfdc7 (patch)
tree9ed65a1661b83f8790dc2f61e37a8d5b0333bc79 /lib/private/L10N
parent5fb7ea22be0814eb8e1e1e0f2df6032ef53983cc (diff)
downloadnextcloud-server-ab8205fd35a3815673fc17fa78adc5bc770cfdc7.tar.gz
nextcloud-server-ab8205fd35a3815673fc17fa78adc5bc770cfdc7.zip
fix(l10n): Fix plural issue with different locale and language
We need to use the language code here instead of the locale, because Symfony does not distinguish between the two and would otherwise e.g. with locale "Czech" and language "German" try to pick a non-existing plural rule, because Czech has 4 plural forms and German only 2. Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/L10N')
-rw-r--r--lib/private/L10N/L10N.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/private/L10N/L10N.php b/lib/private/L10N/L10N.php
index d0794c9c9c0..ea4aa0527bb 100644
--- a/lib/private/L10N/L10N.php
+++ b/lib/private/L10N/L10N.php
@@ -215,7 +215,12 @@ class L10N implements IL10N {
public function getIdentityTranslator(): IdentityTranslator {
if (\is_null($this->identityTranslator)) {
$this->identityTranslator = new IdentityTranslator();
- $this->identityTranslator->setLocale($this->getLocaleCode());
+ // We need to use the language code here instead of the locale,
+ // because Symfony does not distinguish between the two and would
+ // otherwise e.g. with locale "Czech" and language "German" try to
+ // pick a non-existing plural rule, because Czech has 4 plural forms
+ // and German only 2.
+ $this->identityTranslator->setLocale($this->getLanguageCode());
}
return $this->identityTranslator;