Akses File JavaScript ke Sumber Daya 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()
};
}
Enchanting Eel