diff options
author | Thomas Steur <thomas.steur@googlemail.com> | 2014-08-25 12:10:43 +0400 |
---|---|---|
committer | Thomas Steur <thomas.steur@googlemail.com> | 2014-08-25 12:10:43 +0400 |
commit | dc0544c12767ca6f2d1679c87c3e94f0bc9982ff (patch) | |
tree | 5507f49876253df02e4200229094c7e5330ade0b /core/Plugin | |
parent | 5d36a959d9957ab3641c934524ea9f18d1dcfb47 (diff) |
refs #5863 we need to pass the langCode to loadPluginTranslations() otherwise langCode will be always an empty string. If there is no plugin loaded yet and no language generate a simple cache file for core translations, load a translation only if a langCode is there
Diffstat (limited to 'core/Plugin')
-rw-r--r-- | core/Plugin/Manager.php | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/core/Plugin/Manager.php b/core/Plugin/Manager.php index 17c056cba6..6a9537df1f 100644 --- a/core/Plugin/Manager.php +++ b/core/Plugin/Manager.php @@ -650,9 +650,18 @@ class Manager extends Singleton $language = Translate::getLanguageToLoad(); } - $cache = new CacheFile('tracker', 43200); // ttl=12hours - $cacheKey = 'PluginTranslations-' . $language; - $cacheKey .= '-' . md5(implode('', $this->getLoadedPluginsName())); // makes sure to create a translation in case loaded plugins change (ie Tests vs Tracker vs UI etc) + $cache = new CacheFile('tracker', 43200); // ttl=12hours + $cacheKey = 'PluginTranslations'; + + if (!empty($language)) { + $cacheKey .= '-' . trim($language); + } + + if (!empty($this->loadedPlugins)) { + // makes sure to create a translation in case loaded plugins change (ie Tests vs Tracker vs UI etc) + $cacheKey .= '-' . md5(implode('', $this->getLoadedPluginsName())); + } + $translations = $cache->get($cacheKey); if (!empty($translations) && @@ -1015,7 +1024,10 @@ class Manager extends Singleton } // merge in specific language translations (to overwrite english defaults) - if ($defaultEnglishLangPath != $defaultLangPath && file_exists($defaultLangPath)) { + if (!empty($langCode) && + $defaultEnglishLangPath != $defaultLangPath && + file_exists($defaultLangPath)) { + $translations = $this->getTranslationsFromFile($defaultLangPath); $translationsLoaded = true; if (isset($translations[$pluginName])) { |