﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
4414	I18N Javascript interpolate function	tobias@…	Malcolm Tredinnick	"why do you interpolate javascript translation strings just once? i currently have the case, that i have to replace like this:
{{{
var transObj = { numShown: numShown, numAvail: numAvail};
interpolate(gettext(""%(numShown)s out of %(numAvail)s""), transObj, true));
}}}
{{{
#!python
Index: views/i18n.py
===================================================================
--- views/i18n.py       (revision 5038)
+++ views/i18n.py       (working copy)
@@ -69,9 +69,9 @@
 InterPolate = r""""""
 function interpolate(fmt, obj, named) {
   if (named) {
-    return fmt.replace(/%\(\w+\)s/, function(match){return String(obj[match.slice(2,-2)])});
+    return fmt.replace(/%\(\w+\)s/g, function(match){return String(obj[match.slice(2,-2)])});
   } else {
-    return fmt.replace(/%s/, function(match){return String(obj.shift())});
+    return fmt.replace(/%s/g, function(match){return String(obj.shift())});
   }
 }
 """"""
}}}"		new	Internationalization	dev			i18n javascript interpolate		Accepted	1	0	0	0	0	0
