diff options
author | sgiehl <stefan@piwik.org> | 2013-12-29 20:05:54 +0400 |
---|---|---|
committer | sgiehl <stefan@piwik.org> | 2013-12-29 20:06:01 +0400 |
commit | b7afa1779a66c08c3fb6d92f6fdd5ba8db8e5b9d (patch) | |
tree | 3fe13943487b4828630f42b7e5ff0027a058c251 | |
parent | 09abd7abef8ee6f6f3b9c9531798233dc84a551d (diff) |
include plugins translations in calculation of language infos
-rw-r--r-- | plugins/LanguagesManager/API.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/plugins/LanguagesManager/API.php b/plugins/LanguagesManager/API.php index 07cd97c0e8..bdf65962ed 100644 --- a/plugins/LanguagesManager/API.php +++ b/plugins/LanguagesManager/API.php @@ -79,12 +79,31 @@ class API extends \Piwik\Plugin\API { $data = file_get_contents(PIWIK_INCLUDE_PATH . '/lang/en.json'); $englishTranslation = json_decode($data, true); + + // merge with plugin translations if any + $pluginFiles = glob(sprintf('%s/plugins/*/lang/en.json', PIWIK_INCLUDE_PATH)); + foreach ($pluginFiles AS $file) { + + $data = file_get_contents($file); + $pluginTranslations = json_decode($data, true); + $englishTranslation = array_merge_recursive($englishTranslation, $pluginTranslations); + } + $filenames = $this->getAvailableLanguages(); $languagesInfo = array(); foreach ($filenames as $filename) { $data = file_get_contents(sprintf('%s/lang/%s.json', PIWIK_INCLUDE_PATH, $filename)); $translations = json_decode($data, true); + // merge with plugin translations if any + $pluginFiles = glob(sprintf('%s/plugins/*/lang/%s.json', PIWIK_INCLUDE_PATH, $filename)); + foreach ($pluginFiles AS $file) { + + $data = file_get_contents($file); + $pluginTranslations = json_decode($data, true); + $translations = array_merge_recursive($translations, $pluginTranslations); + } + $intersect = function ($array, $array2) { $res = $array; foreach ($array as $module => $keys) { |