What is a good way for handling parameters in localized strings in javascript? I am using the same format as in java's MessageFormat class, e.g.:
There are {0} apples in basket ID {1}.
Where {0} will be replaced with the first parameter and {1} with the second.
This is the call I want to use in JS (i.e. I want to implement origStr):
var str = replaceParams(origStr, [5, 'AAA']);
I am guessing the best strategy would be to use a regular expression. If so, please offer a good regular expression. But I'm open to hear any other options.