diff options
Diffstat (limited to 'application/Languages.php')
-rw-r--r-- | application/Languages.php | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/application/Languages.php b/application/Languages.php index 4fa32426..5cda802e 100644 --- a/application/Languages.php +++ b/application/Languages.php | |||
@@ -3,7 +3,6 @@ | |||
3 | namespace Shaarli; | 3 | namespace Shaarli; |
4 | 4 | ||
5 | use Gettext\GettextTranslator; | 5 | use Gettext\GettextTranslator; |
6 | use Gettext\Merge; | ||
7 | use Gettext\Translations; | 6 | use Gettext\Translations; |
8 | use Gettext\Translator; | 7 | use Gettext\Translator; |
9 | use Gettext\TranslatorInterface; | 8 | use Gettext\TranslatorInterface; |
@@ -92,7 +91,7 @@ class Languages | |||
92 | /** | 91 | /** |
93 | * Initialize the translator using php gettext extension (gettext dependency act as a wrapper). | 92 | * Initialize the translator using php gettext extension (gettext dependency act as a wrapper). |
94 | */ | 93 | */ |
95 | protected function initGettextTranslator () | 94 | protected function initGettextTranslator() |
96 | { | 95 | { |
97 | $this->translator = new GettextTranslator(); | 96 | $this->translator = new GettextTranslator(); |
98 | $this->translator->setLanguage($this->language); | 97 | $this->translator->setLanguage($this->language); |
@@ -125,7 +124,8 @@ class Languages | |||
125 | $translations = $translations->addFromPoFile('inc/languages/'. $this->language .'/LC_MESSAGES/shaarli.po'); | 124 | $translations = $translations->addFromPoFile('inc/languages/'. $this->language .'/LC_MESSAGES/shaarli.po'); |
126 | $translations->setDomain('shaarli'); | 125 | $translations->setDomain('shaarli'); |
127 | $this->translator->loadTranslations($translations); | 126 | $this->translator->loadTranslations($translations); |
128 | } catch (\InvalidArgumentException $e) {} | 127 | } catch (\InvalidArgumentException $e) { |
128 | } | ||
129 | 129 | ||
130 | // Default extension translation from the current theme | 130 | // Default extension translation from the current theme |
131 | $theme = $this->conf->get('theme'); | 131 | $theme = $this->conf->get('theme'); |
@@ -137,7 +137,8 @@ class Languages | |||
137 | ); | 137 | ); |
138 | $translations->setDomain($theme); | 138 | $translations->setDomain($theme); |
139 | $this->translator->loadTranslations($translations); | 139 | $this->translator->loadTranslations($translations); |
140 | } catch (\InvalidArgumentException $e) {} | 140 | } catch (\InvalidArgumentException $e) { |
141 | } | ||
141 | } | 142 | } |
142 | 143 | ||
143 | // Extension translations (plugins, themes, etc.). | 144 | // Extension translations (plugins, themes, etc.). |
@@ -147,10 +148,13 @@ class Languages | |||
147 | } | 148 | } |
148 | 149 | ||
149 | try { | 150 | try { |
150 | $extension = Translations::fromPoFile($translationPath . $this->language .'/LC_MESSAGES/'. $domain .'.po'); | 151 | $extension = Translations::fromPoFile( |
152 | $translationPath . $this->language .'/LC_MESSAGES/'. $domain .'.po' | ||
153 | ); | ||
151 | $extension->setDomain($domain); | 154 | $extension->setDomain($domain); |
152 | $this->translator->loadTranslations($extension); | 155 | $this->translator->loadTranslations($extension); |
153 | } catch (\InvalidArgumentException $e) {} | 156 | } catch (\InvalidArgumentException $e) { |
157 | } | ||
154 | } | 158 | } |
155 | } | 159 | } |
156 | 160 | ||