diff options
author | Bjoern Schiessle <bjoern@schiessle.org> | 2017-11-30 12:47:55 +0100 |
---|---|---|
committer | Bjoern Schiessle <bjoern@schiessle.org> | 2017-11-30 17:29:08 +0100 |
commit | 8b734347b17da5ff2ec7f12e2149aeec785310f2 (patch) | |
tree | efb9ffc1a75037f86d03858196b3dfd5ca5f6889 /lib/private/L10N | |
parent | 49ec86a81fa19884de125ec48325d85e2e1b1561 (diff) | |
download | nextcloud-server-8b734347b17da5ff2ec7f12e2149aeec785310f2.tar.gz nextcloud-server-8b734347b17da5ff2ec7f12e2149aeec785310f2.zip |
use formal version of German if default_language is set to 'de_DE'
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'lib/private/L10N')
-rw-r--r-- | lib/private/L10N/Factory.php | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/lib/private/L10N/Factory.php b/lib/private/L10N/Factory.php index 399bebb8189..150b36cec44 100644 --- a/lib/private/L10N/Factory.php +++ b/lib/private/L10N/Factory.php @@ -260,7 +260,7 @@ class Factory implements IFactory { foreach ($available as $available_language) { if ($preferred_language === strtolower($available_language)) { - return $available_language; + return $this->respectDefaultLanguage($app, $available_language); } } @@ -277,6 +277,30 @@ class Factory implements IFactory { } /** + * if default language is set to de_DE (formal German) this should be + * preferred to 'de' (non-formal German) if possible + * + * @param string|null $app + * @param string $lang + * @return string + */ + protected function respectDefaultLanguage($app, $lang) { + $result = $lang; + $defaultLanguage = $this->config->getSystemValue('default_language', false); + + // use formal version of german ("Sie" instead of "Du") if the default + // language is set to 'de_DE' if possible + if (strtolower($lang) === 'de' + && strtolower($defaultLanguage) === 'de_de' && + $this->languageExists($app, 'de_DE') + ) { + $result = 'de_DE'; + } + + return $result; + } + + /** * Checks if $sub is a subdirectory of $parent * * @param string $sub |