I am an advanced user of Dojo and now implementing i18n. As part of it - I need the ability to have resource file with arguments - something like this:
root: {
personalHello: 'Hello {1}'
}
So, when I call it with a name it will be something like this:
somDiv.innerHTML = i18n.personalHello['David']
Or something like this. Can anyone refer me to an example that uses it?
Thanks!
OK, found the answer in this link.
Appearently, you can do something like this in resources:
root: {
personalHello: 'Hello ${a1}'
}
And then call it like this from the code:
somDiv.innerHTML = dojo.string.substitute(i18n.personalHello, {a1: 'David'};
In Dojo >= 1.7 (AMD):
require(["dojo/string"], function(string) {
somDiv.innerHTML = string.substitute(i18n.personalHello, {a1: 'David'};
})
Checked it. It works!