Created
November 6, 2013 23:49
-
-
Save dgershman/7346371 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ResourceManager rm = new ResourceManager(ConfigurationManager.AppSettings["JSResourcesAssemblyType"].ToString(), | |
| Assembly.LoadFile(ConfigurationManager.AppSettings["JSResourcesAssemblyPath"].ToString())); | |
| if (context.Request.QueryString["CultureCode"] == null) return; | |
| var culture = context.Request.QueryString["CultureCode"].ToString(); | |
| ResourceSet rs = rm.GetResourceSet(new CultureInfo(culture), true, true); | |
| var sbInitial = "var rm = {"; | |
| var sb = new StringBuilder(sbInitial); | |
| var resEnum = rs.GetEnumerator(); | |
| while (resEnum.MoveNext()) | |
| { | |
| if (sb.ToString() != sbInitial) sb.Append(","); | |
| sb.Append(""" + resEnum.Key + "":"" + | |
| resEnum.Value.ToString().Replace("rn", "").Replace(""", "\"") + """); | |
| } | |
| sb.Append("}"); | |
| sb.ToString(); | |
| context.Response.ContentType = "text/javascript"; | |
| context.Response.Write(sb.ToString()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment