From 28322aef2a83b7f0de772ed834457efc1d68da64 Mon Sep 17 00:00:00 2001 From: cnlevy Date: Wed, 14 Aug 2013 01:20:25 +0300 Subject: [PATCH] added try/catch clause around 'eval' call simple workaround for bug when translating 'Invoice #{0}', where # is meant to be literal --- assets/JsTrans.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/assets/JsTrans.js b/assets/JsTrans.js index ad122ea..4c2409f 100644 --- a/assets/JsTrans.js +++ b/assets/JsTrans.js @@ -46,10 +46,12 @@ Yii.translate.process = function (message, params, dictionary) { var eval_expr = ex.split('n').join(num); // if expression matches, set translation to current chunk - if (eval(eval_expr)) { - translation = msg; - break; - } + try { + if (eval(eval_expr)) { + translation = msg; + break; + } + } catch(ex) {} } } } @@ -85,4 +87,4 @@ Yii.t = function (category, message, params, language) { // pass message and dictionary to translate function return Yii.translate.process(message, params, dictionary); -} \ No newline at end of file +}