The ASP.NET ScriptManager control has the ability to provide localization for your scripts in a couple of ways.
If your script is embedded in your assembly as a resource using the WebResourceAttribute then you can use the ScriptResourceAttribute to let the ScriptManager know that you have some localized strings stored in a .resx file somewhere that you want served up any time your script is served. These strings get injected into the page as a JSON object and then in your main script you output references to the JSON object rather than literal strings.
For example, you would embed your script like this:
[assembly: System.Web.UI.WebResource("ProjectNamespace.MyScript.js", "application/x-javascript")]
[assembly: System.Web.UI.ScriptResource("ProjectNamespace.MyScript.js", "ProjectNamespace.MyScriptResources", "Messages")]
The "ProjectNamespace.MyScript.js" is the full path to the embedded resource that is your script. In the ScriptResourceAttribute, the second parameter is the full path to the embedded .resx file (minus the .resx extension) that contains all of the localized messages. You treat that just like any other .resx, so you'd have MyScriptResources.resx for the default culture, then MyScriptResources.es-MX.resx for Mexican Spanish overrides, etc. That last parameter in the ScriptResourceAttribute is the name of the JSON object that will be generated.
In your script, you reference the JSON object:
function DoSomething()
{
alert(Messages.ErrorMessage);
}
In the above snippet, "ErrorMessage" is the name of one of the string resources in the .resx file.
If you embed the script, reference it from the ScriptManager using a tag that specifies an Assembly and a Name.
Alternatively, you can keep fully localized copies of the script, like "MyScript.js," "MyScript.es-MX.js," "MyScript.en-UK.js," etc. where the localized logic and messages are hardcoded right into the script.
If you do this localization method, reference it from the ScriptManager using a that specifies a Path.
There is a really nice overview and links to detailed walkthroughs on this with code examples on MSDN.
Note that if you are using ASP.NET MVC, the ScriptManager control doesn't really work with it. In that case, you'll want to look at a different solution like the jQuery globalization plugin or potentially a custom ScriptManager replacement for use in MVC.