From 341b75a99013570eafde267e1f04ae41bb28365b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Thu, 11 Aug 2011 13:57:01 +0200 Subject: [PATCH] Implement translation for advisor rules --- libraries/advisor.class.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/libraries/advisor.class.php b/libraries/advisor.class.php index bea2acaba0..d817593062 100644 --- a/libraries/advisor.class.php +++ b/libraries/advisor.class.php @@ -99,9 +99,11 @@ class Advisor switch($type) { case 'notfired': case 'fired': - $jst = Advisor::splitJustification($rule['justification']); + $jst = Advisor::splitJustification($rule); if(count($jst) > 1) { try { + /* Translate */ + $jst[0] = _gettext($jst[0]); $str = $this->ruleExprEvaluate( 'sprintf("'.$jst[0].'",'.$jst[1].')', strlen('sprintf("'.$jst[0].'"') @@ -112,9 +114,16 @@ class Advisor } $rule['justification'] = $str; + } else { + $rule['justification'] = _gettext($rule['justification']); } + $rule['name'] = _gettext($rule['name']); + $rule['issue'] = _gettext($rule['issue']); - $rule['recommendation'] = preg_replace('/\{([a-z_0-9]+)\}/Ui','\1',$rule['recommendation']); + $rule['recommendation'] = preg_replace( + '/\{([a-z_0-9]+)\}/Ui', + '\1', + _gettext($rule['recommendation'])); break; }