javascript file access to resources asp.net mvc
public static JavaScriptResult JavascriptResources(ResourceManager manager, string resourceObjectName, CultureInfo culture)
{
ResourceSet resourceSet = manager.GetResourceSet(culture, true, true);
StringBuilder sb = new StringBuilder();
sb.AppendFormat("var {0}=new Object();", resourceObjectName);
var enumerator = resourceSet.GetEnumerator();
while (enumerator.MoveNext())
{
sb.AppendFormat("{0}.{1}='{2}';", resourceObjectName, enumerator.Key,
System.Web.HttpUtility.JavaScriptStringEncode(enumerator.Value.ToString()));
}
return new JavaScriptResult()
{
Script = sb.ToString()
};
}