diff options
author | sgiehl <stefan@piwik.org> | 2014-01-12 03:08:38 +0400 |
---|---|---|
committer | sgiehl <stefan@piwik.org> | 2014-01-12 03:08:38 +0400 |
commit | ff8e583c2269aedbb94b4be71ad8093f7760241a (patch) | |
tree | a3963796ca1d4e28ce8a72e5c93d9d7182d49c05 /core | |
parent | 50c8c46fdeba59b2169d7bb920af1bcdd9782f30 (diff) |
fixed translation issue with plugins; plugin default translations (en), were not loaded if a translation file for a specific language exists
Diffstat (limited to 'core')
-rw-r--r-- | core/Plugin/Manager.php | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/core/Plugin/Manager.php b/core/Plugin/Manager.php index 34e69c0ec2..dec9921093 100644 --- a/core/Plugin/Manager.php +++ b/core/Plugin/Manager.php @@ -841,19 +841,29 @@ class Manager extends Singleton $defaultLangPath = sprintf($path, $langCode); $defaultEnglishLangPath = sprintf($path, 'en'); - if (file_exists($defaultLangPath)) { - $translations = $this->getTranslationsFromFile($defaultLangPath); - } elseif (file_exists($defaultEnglishLangPath)) { + $translationsLoaded = false; + + // merge in english translations as default first + if (file_exists($defaultEnglishLangPath)) { $translations = $this->getTranslationsFromFile($defaultEnglishLangPath); - } else { - return false; + $translationsLoaded = true; + if (isset($translations[$pluginName])) { + // only merge translations of plugin - prevents overwritten strings + Translate::mergeTranslationArray(array($pluginName => $translations[$pluginName])); + } } - if (isset($translations[$pluginName])) { - // only merge translations of plugin - prevents overwritten strings - Translate::mergeTranslationArray(array($pluginName => $translations[$pluginName])); + // merge in specific language translations (to overwrite english defaults) + if (file_exists($defaultLangPath)) { + $translations = $this->getTranslationsFromFile($defaultLangPath); + $translationsLoaded = true; + if (isset($translations[$pluginName])) { + // only merge translations of plugin - prevents overwritten strings + Translate::mergeTranslationArray(array($pluginName => $translations[$pluginName])); + } } - return true; + + return $translationsLoaded; } /** |