From 53054b2bf6a919fd4ff9b44b6ad1986f21f488b6 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Tue, 22 Sep 2020 20:25:47 +0200 Subject: Apply PHP Code Beautifier on source code for linter automatic fixes --- application/Languages.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'application/Languages.php') diff --git a/application/Languages.php b/application/Languages.php index d83e0765..8d0e13c8 100644 --- a/application/Languages.php +++ b/application/Languages.php @@ -76,7 +76,8 @@ class Languages $this->language = $confLanguage; } - if (! extension_loaded('gettext') + if ( + ! extension_loaded('gettext') || in_array($this->conf->get('translation.mode', 'auto'), ['auto', 'php']) ) { $this->initPhpTranslator(); @@ -98,7 +99,7 @@ class Languages $this->translator->loadDomain(self::DEFAULT_DOMAIN, 'inc/languages'); // Default extension translation from the current theme - $themeTransFolder = rtrim($this->conf->get('raintpl_tpl'), '/') .'/'. $this->conf->get('theme') .'/language'; + $themeTransFolder = rtrim($this->conf->get('raintpl_tpl'), '/') . '/' . $this->conf->get('theme') . '/language'; if (is_dir($themeTransFolder)) { $this->translator->loadDomain($this->conf->get('theme'), $themeTransFolder, false); } @@ -121,7 +122,7 @@ class Languages $translations = new Translations(); // Core translations try { - $translations = $translations->addFromPoFile('inc/languages/'. $this->language .'/LC_MESSAGES/shaarli.po'); + $translations = $translations->addFromPoFile('inc/languages/' . $this->language . '/LC_MESSAGES/shaarli.po'); $translations->setDomain('shaarli'); $this->translator->loadTranslations($translations); } catch (\InvalidArgumentException $e) { @@ -129,11 +130,11 @@ class Languages // Default extension translation from the current theme $theme = $this->conf->get('theme'); - $themeTransFolder = rtrim($this->conf->get('raintpl_tpl'), '/') .'/'. $theme .'/language'; + $themeTransFolder = rtrim($this->conf->get('raintpl_tpl'), '/') . '/' . $theme . '/language'; if (is_dir($themeTransFolder)) { try { $translations = Translations::fromPoFile( - $themeTransFolder .'/'. $this->language .'/LC_MESSAGES/'. $theme .'.po' + $themeTransFolder . '/' . $this->language . '/LC_MESSAGES/' . $theme . '.po' ); $translations->setDomain($theme); $this->translator->loadTranslations($translations); @@ -149,7 +150,7 @@ class Languages try { $extension = Translations::fromPoFile( - $translationPath . $this->language .'/LC_MESSAGES/'. $domain .'.po' + $translationPath . $this->language . '/LC_MESSAGES/' . $domain . '.po' ); $extension->setDomain($domain); $this->translator->loadTranslations($extension); -- cgit v1.2.3 From b99e00f7cd5f7e2090f44cd97bfb426db55340c2 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Sun, 8 Nov 2020 15:02:45 +0100 Subject: Manually fix remaining PHPCS errors --- application/Languages.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'application/Languages.php') diff --git a/application/Languages.php b/application/Languages.php index 8d0e13c8..60e91631 100644 --- a/application/Languages.php +++ b/application/Languages.php @@ -41,7 +41,7 @@ class Languages /** * Core translations domain */ - const DEFAULT_DOMAIN = 'shaarli'; + public const DEFAULT_DOMAIN = 'shaarli'; /** * @var TranslatorInterface @@ -122,7 +122,9 @@ class Languages $translations = new Translations(); // Core translations try { - $translations = $translations->addFromPoFile('inc/languages/' . $this->language . '/LC_MESSAGES/shaarli.po'); + $translations = $translations->addFromPoFile( + 'inc/languages/' . $this->language . '/LC_MESSAGES/shaarli.po' + ); $translations->setDomain('shaarli'); $this->translator->loadTranslations($translations); } catch (\InvalidArgumentException $e) { -- cgit v1.2.3