aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/Languages.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-09-22 20:25:47 +0200
committerArthurHoaro <arthur@hoa.ro>2020-11-09 10:56:24 +0100
commit53054b2bf6a919fd4ff9b44b6ad1986f21f488b6 (patch)
tree39cad52645ce00fbf863ff8e482d10dfcbe7f26c /application/Languages.php
parente09bb93e18a333eff8e6a4156f5b58ba9c7d25cd (diff)
downloadShaarli-53054b2bf6a919fd4ff9b44b6ad1986f21f488b6.tar.gz
Shaarli-53054b2bf6a919fd4ff9b44b6ad1986f21f488b6.tar.zst
Shaarli-53054b2bf6a919fd4ff9b44b6ad1986f21f488b6.zip
Apply PHP Code Beautifier on source code for linter automatic fixes
Diffstat (limited to 'application/Languages.php')
-rw-r--r--application/Languages.php13
1 files changed, 7 insertions, 6 deletions
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
76 $this->language = $confLanguage; 76 $this->language = $confLanguage;
77 } 77 }
78 78
79 if (! extension_loaded('gettext') 79 if (
80 ! extension_loaded('gettext')
80 || in_array($this->conf->get('translation.mode', 'auto'), ['auto', 'php']) 81 || in_array($this->conf->get('translation.mode', 'auto'), ['auto', 'php'])
81 ) { 82 ) {
82 $this->initPhpTranslator(); 83 $this->initPhpTranslator();
@@ -98,7 +99,7 @@ class Languages
98 $this->translator->loadDomain(self::DEFAULT_DOMAIN, 'inc/languages'); 99 $this->translator->loadDomain(self::DEFAULT_DOMAIN, 'inc/languages');
99 100
100 // Default extension translation from the current theme 101 // Default extension translation from the current theme
101 $themeTransFolder = rtrim($this->conf->get('raintpl_tpl'), '/') .'/'. $this->conf->get('theme') .'/language'; 102 $themeTransFolder = rtrim($this->conf->get('raintpl_tpl'), '/') . '/' . $this->conf->get('theme') . '/language';
102 if (is_dir($themeTransFolder)) { 103 if (is_dir($themeTransFolder)) {
103 $this->translator->loadDomain($this->conf->get('theme'), $themeTransFolder, false); 104 $this->translator->loadDomain($this->conf->get('theme'), $themeTransFolder, false);
104 } 105 }
@@ -121,7 +122,7 @@ class Languages
121 $translations = new Translations(); 122 $translations = new Translations();
122 // Core translations 123 // Core translations
123 try { 124 try {
124 $translations = $translations->addFromPoFile('inc/languages/'. $this->language .'/LC_MESSAGES/shaarli.po'); 125 $translations = $translations->addFromPoFile('inc/languages/' . $this->language . '/LC_MESSAGES/shaarli.po');
125 $translations->setDomain('shaarli'); 126 $translations->setDomain('shaarli');
126 $this->translator->loadTranslations($translations); 127 $this->translator->loadTranslations($translations);
127 } catch (\InvalidArgumentException $e) { 128 } catch (\InvalidArgumentException $e) {
@@ -129,11 +130,11 @@ class Languages
129 130
130 // Default extension translation from the current theme 131 // Default extension translation from the current theme
131 $theme = $this->conf->get('theme'); 132 $theme = $this->conf->get('theme');
132 $themeTransFolder = rtrim($this->conf->get('raintpl_tpl'), '/') .'/'. $theme .'/language'; 133 $themeTransFolder = rtrim($this->conf->get('raintpl_tpl'), '/') . '/' . $theme . '/language';
133 if (is_dir($themeTransFolder)) { 134 if (is_dir($themeTransFolder)) {
134 try { 135 try {
135 $translations = Translations::fromPoFile( 136 $translations = Translations::fromPoFile(
136 $themeTransFolder .'/'. $this->language .'/LC_MESSAGES/'. $theme .'.po' 137 $themeTransFolder . '/' . $this->language . '/LC_MESSAGES/' . $theme . '.po'
137 ); 138 );
138 $translations->setDomain($theme); 139 $translations->setDomain($theme);
139 $this->translator->loadTranslations($translations); 140 $this->translator->loadTranslations($translations);
@@ -149,7 +150,7 @@ class Languages
149 150
150 try { 151 try {
151 $extension = Translations::fromPoFile( 152 $extension = Translations::fromPoFile(
152 $translationPath . $this->language .'/LC_MESSAGES/'. $domain .'.po' 153 $translationPath . $this->language . '/LC_MESSAGES/' . $domain . '.po'
153 ); 154 );
154 $extension->setDomain($domain); 155 $extension->setDomain($domain);
155 $this->translator->loadTranslations($extension); 156 $this->translator->loadTranslations($extension);