I have an XML file which has a simple nodes like:
<question lang='en'>Do you want to buy %s from us ?</question>
<question lang='fr'>Voulez-vous acheter chez nous cette %s ?</question>
I have a library in C# (with ASP.NET) which takes node value depending by user language.
I want to use the text in javascript alert like
var test = '<%=Language.GetString(Question.EN) %>';
I want to display the following content in alert dialog by calling a similary sprintf in javascript.
Or have I to use this plugin: http://www.diveintojavascript.com/projects/javascript-sprintf ?
Thank you
You could use
String.prototypeto add a new function to theStringtype (JSFiddle demo):