I'm outputting the localization key/value pairs present in the JS localization resource into lang.js
like this:
[Route("js/lang.js")]
public ActionResult Lang()
{
ResourceManager manager = new ResourceManager("Normandy.App_GlobalResources.JsLocalization", System.Reflection.Assembly.GetExecutingAssembly());
ResourceSet resources = manager.GetResourceSet(CultureInfo.CurrentCulture, true, true);
Dictionary<string, string> result = new Dictionary<string, string>();
IDictionaryEnumerator enumerator = resources.GetEnumerator();
while (enumerator.MoveNext())
result.Add((string)enumerator.Key, (string)enumerator.Value);
return Json(result);
}
The contents of /js/lang.js are (I include the file with a normal <script>
tag):
{"Test":"test","_Lang":"en"}
Is there any way to make them be:
var LANG = {"Test":"test","_Lang":"en"}