i found solution : i used a page GetLocalisedScript.aspx to serve my js files.
Code behind :
protected void Page_Load(object sender, EventArgs e)
{
string retval = "";
string file = Request["JsFileName"].ToString();
using(StreamReader sr = new StreamReader(Server.MapPath(string.Format("~\\scripts\\{0}.js",file))))
{
retval = sr.ReadToEnd();
sr.Close();
}
Regex rx = new Regex("##Translate(.+?)##",RegexOptions.Singleline);
MatchCollection mc = rx.Matches(retval,0);
foreach (Match m in mc)
{
string strResxKey = m.Value.Replace("##Translate(", "").Replace(")##", "");
string val = GetGlobalResourceObject("myResource", strResxKey).ToString();
retval = retval.Replace(m.Value, val);
}
//Just write out the XML data
Response.ContentType = "text/xml";
//NOTE THAT THIS PAGE DOESN'T CONTAIN ANY HTML TAG, WHATSOEVER
Response.Output.Write(retval);
}
HTML Markup :
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GetLocalisedScript.aspx.cs" Inherits="TestMulti.GetLocalisedScript" %>
and in my page replaced standard src with something like this :
<script src="GetLocalisedScript.aspx?JsFileName=JsFileNameWithoutExtension" type="text/jscript" ></script>
now in my js file(JsFileNameWithoutExtension) i will change strings like this :
function alert2(val) {
alert("##Translate(MyStringToTranslate)##");
}