From fd18ea20bc24cfa5a12a625370bca1fbe9339464 Mon Sep 17 00:00:00 2001 From: sgiehl Date: Sat, 14 Sep 2013 23:45:35 +0200 Subject: fixes #4151 removed _js hack --- core/Translate.php | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'core/Translate.php') diff --git a/core/Translate.php b/core/Translate.php index c36410f505..179cc1be31 100644 --- a/core/Translate.php +++ b/core/Translate.php @@ -163,10 +163,6 @@ class Translate { $translations = &$GLOBALS['Piwik_translations']; - // Hack: common translations used in JS but not only, force them to be defined in JS - $translations['General']['Save_js'] = $translations['General']['Save']; - $translations['General']['OrCancel_js'] = $translations['General']['OrCancel']; - $clientSideTranslations = array(); foreach ($this->getClientSideTranslationKeys() as $key) { list($plugin, $stringName) = explode("_", $key, 2); @@ -178,7 +174,7 @@ class Translate 'for(var i in translations) { piwik_translations[i] = translations[i];} '; $js .= 'function _pk_translate(translationStringId) { ' . 'if( typeof(piwik_translations[translationStringId]) != \'undefined\' ){ return piwik_translations[translationStringId]; }' . - 'return "The string "+translationStringId+" was not loaded in javascript. Make sure it is suffixed with _js.";}'; + 'return "The string "+translationStringId+" was not loaded in javascript. Make sure it is added in the Translate.getClientSideTranslationKeys hook.";}'; return $js; } @@ -194,15 +190,7 @@ class Translate Piwik_PostEvent(self::GET_CLIENT_SIDE_TRANSLATION_KEYS_EVENT, array(&$result)); - $translations = $GLOBALS['Piwik_translations']; - foreach ($translations as $module => $keys) { - foreach($keys as $key => $value) { - // Find keys ending with _js - if (preg_match($moduleRegex, $key)) { - $result[] = $module . '_' . $key; - } - } - } + $result = array_unique($result); return $result; } -- cgit v1.2.3