X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=js%2FCommon.js;h=8f5294ef60db3c13e12c62db59dc18e291cfe68b;hb=27e0bdba223bf18398c1229f3994fa77fc58f66e;hp=294f76b98b295d97f1c3abc569bcacf59e128062;hpb=12ec93d76da79447cdf101ee5f978cb588c5f36d;p=civicrm-core.git diff --git a/js/Common.js b/js/Common.js index 294f76b98b..8f5294ef60 100644 --- a/js/Common.js +++ b/js/Common.js @@ -44,10 +44,12 @@ var cj = jQuery; function ts(text, params) { "use strict"; text = CRM.strings[text] || text; - if (params && typeof(params) === 'object') { + if (typeof(params) === 'object') { for (var i in params) { - // sprintf emulation: escape % characters in the replacements to avoid conflicts - text = text.replace(new RegExp('%' + i, 'g'), params[i].replace(/%/g, '%-crmescaped-')); + if (typeof(params[i]) === 'string' || typeof(params[i]) === 'number') { + // sprintf emulation: escape % characters in the replacements to avoid conflicts + text = text.replace(new RegExp('%' + i, 'g'), String(params[i]).replace(/%/g, '%-crmescaped-')); + } } return text.replace(/%-crmescaped-/g, '%'); }