Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorsgiehl <stefan@piwik.org>2014-01-12 03:08:38 +0400
committersgiehl <stefan@piwik.org>2014-01-12 03:08:38 +0400
commitff8e583c2269aedbb94b4be71ad8093f7760241a (patch)
treea3963796ca1d4e28ce8a72e5c93d9d7182d49c05 /core
parent50c8c46fdeba59b2169d7bb920af1bcdd9782f30 (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.php28
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;
}
/**