diff options
Diffstat (limited to 'lib/private/L10N')
-rw-r--r-- | lib/private/L10N/Factory.php | 7 | ||||
-rw-r--r-- | lib/private/L10N/L10NString.php | 7 | ||||
-rw-r--r-- | lib/private/L10N/LanguageIterator.php | 14 | ||||
-rw-r--r-- | lib/private/L10N/LanguageNotFoundException.php | 1 | ||||
-rw-r--r-- | lib/private/L10N/LazyL10N.php | 1 |
5 files changed, 13 insertions, 17 deletions
diff --git a/lib/private/L10N/Factory.php b/lib/private/L10N/Factory.php index a5b208cfb3c..a1afb1f4f0a 100644 --- a/lib/private/L10N/Factory.php +++ b/lib/private/L10N/Factory.php @@ -115,7 +115,6 @@ class Factory implements IFactory { */ public function get($app, $lang = null, $locale = null) { return new LazyL10N(function () use ($app, $lang, $locale) { - $app = \OC_App::cleanAppId($app); if ($lang !== null) { $lang = str_replace(['\0', '/', '\\', '..'], '', (string)$lang); @@ -353,7 +352,7 @@ class Factory implements IFactory { public function getLanguageIterator(IUser $user = null): ILanguageIterator { $user = $user ?? $this->userSession->getUser(); - if($user === null) { + if ($user === null) { throw new \RuntimeException('Failed to get an IUser instance'); } return new LanguageIterator($user, $this->config); @@ -543,7 +542,7 @@ class Factory implements IFactory { $res = ''; $p = 0; $length = strlen($body); - for($i = 0; $i < $length; $i++) { + for ($i = 0; $i < $length; $i++) { $ch = $body[$i]; switch ($ch) { case '?': @@ -594,7 +593,7 @@ class Factory implements IFactory { $commonLanguages = []; $languages = []; - foreach($languageCodes as $lang) { + foreach ($languageCodes as $lang) { $l = $this->get('lib', $lang); // TRANSLATORS this is the language name for the language switcher in the personal settings and should be the localized version $potentialName = (string) $l->t('__language_name__'); diff --git a/lib/private/L10N/L10NString.php b/lib/private/L10N/L10NString.php index 47635cf67fc..683cd902ab6 100644 --- a/lib/private/L10N/L10NString.php +++ b/lib/private/L10N/L10NString.php @@ -63,13 +63,12 @@ class L10NString implements \JsonSerializable { $translations = $this->l10n->getTranslations(); $text = $this->text; - if(array_key_exists($this->text, $translations)) { - if(is_array($translations[$this->text])) { + if (array_key_exists($this->text, $translations)) { + if (is_array($translations[$this->text])) { $fn = $this->l10n->getPluralFormFunction(); $id = $fn($this->count); $text = $translations[$this->text][$id]; - } - else{ + } else { $text = $translations[$this->text]; } } diff --git a/lib/private/L10N/LanguageIterator.php b/lib/private/L10N/LanguageIterator.php index 8c9624d7d53..0670ac56503 100644 --- a/lib/private/L10N/LanguageIterator.php +++ b/lib/private/L10N/LanguageIterator.php @@ -55,18 +55,18 @@ class LanguageIterator implements ILanguageIterator { * @since 14.0.0 */ public function current(): string { - switch($this->i) { + switch ($this->i) { /** @noinspection PhpMissingBreakStatementInspection */ case 0: $forcedLang = $this->config->getSystemValue('force_language', false); - if(is_string($forcedLang)) { + if (is_string($forcedLang)) { return $forcedLang; } $this->next(); /** @noinspection PhpMissingBreakStatementInspection */ case 1: $forcedLang = $this->config->getSystemValue('force_language', false); - if(is_string($forcedLang) + if (is_string($forcedLang) && ($truncated = $this->getTruncatedLanguage($forcedLang)) !== $forcedLang ) { return $truncated; @@ -75,14 +75,14 @@ class LanguageIterator implements ILanguageIterator { /** @noinspection PhpMissingBreakStatementInspection */ case 2: $userLang = $this->config->getUserValue($this->user->getUID(), 'core', 'lang', null); - if(is_string($userLang)) { + if (is_string($userLang)) { return $userLang; } $this->next(); /** @noinspection PhpMissingBreakStatementInspection */ case 3: $userLang = $this->config->getUserValue($this->user->getUID(), 'core', 'lang', null); - if(is_string($userLang) + if (is_string($userLang) && ($truncated = $this->getTruncatedLanguage($userLang)) !== $userLang ) { return $truncated; @@ -93,7 +93,7 @@ class LanguageIterator implements ILanguageIterator { /** @noinspection PhpMissingBreakStatementInspection */ case 5: $defaultLang = $this->config->getSystemValue('default_language', 'en'); - if(($truncated = $this->getTruncatedLanguage($defaultLang)) !== $defaultLang) { + if (($truncated = $this->getTruncatedLanguage($defaultLang)) !== $defaultLang) { return $truncated; } $this->next(); @@ -131,7 +131,7 @@ class LanguageIterator implements ILanguageIterator { protected function getTruncatedLanguage(string $lang):string { $pos = strpos($lang, '_'); - if($pos !== false) { + if ($pos !== false) { $lang = substr($lang, 0, $pos); } return $lang; diff --git a/lib/private/L10N/LanguageNotFoundException.php b/lib/private/L10N/LanguageNotFoundException.php index b7c407f6ee9..20b22a8b5ec 100644 --- a/lib/private/L10N/LanguageNotFoundException.php +++ b/lib/private/L10N/LanguageNotFoundException.php @@ -24,5 +24,4 @@ namespace OC\L10N; class LanguageNotFoundException extends \Exception { - } diff --git a/lib/private/L10N/LazyL10N.php b/lib/private/L10N/LazyL10N.php index 2b47de55dd9..9ffcb4df98f 100644 --- a/lib/private/L10N/LazyL10N.php +++ b/lib/private/L10N/LazyL10N.php @@ -68,5 +68,4 @@ class LazyL10N implements IL10N { public function getLocaleCode(): string { return $this->getL()->getLocaleCode(); } - } |