Permalink
Browse files

Generator: Special case englishName for en-US to be consistent with e…

…nglishName for default(en) culture in globalize.js. Fixes #31 - en-US 'englishName' is wrong
  • Loading branch information...
1 parent f4cad96 commit 50d8bdf3070c70cdd150dd4f08c735ee6c464b48 @rdworth rdworth committed Jun 19, 2011
Showing with 10 additions and 2 deletions.
  1. +8 −0 generator/Program.cs
  2. +1 −1 lib/cultures/globalize.culture.en-US.js
  3. +1 −1 lib/cultures/globalize.cultures.js
View
@@ -548,6 +548,14 @@ public class Program {
private static void WriteCulture(string outputdir, string fileName, string extend, string global, CultureInfo culture, StringBuilder aggregateScript) {
var globInfo = GlobalizationInfo.GetGlobInfo(culture);
var diff = (String.IsNullOrEmpty(extend) || culture == CultureInfo.InvariantCulture || culture.Name.Equals("en")) ? globInfo.ToDictionary(false) : GlobalizationInfo.DiffGlobInfos(GlobalizationInfo.BasisGlobInfo, globInfo.ToDictionary(true));
+
+ // Fix for Issue #31 - en-US 'englishName' is wrong
+ // Special case diff of englishName for en-US. The generator diff seemingly finds both "en" and "en-US" to
+ // have englishName "English (United States)" but globalize.js (correctly) has the neutral "English" for "en"/"default"
+ if (culture.Name.Equals("en-US")) {
+ diff.Add("englishName", globInfo.englishName);
+ }
+
var script = GlobalizationInfo.GenerateJavaScript(extend, global, culture, culture.Name, diff, aggregateScript);
var filePath = Path.Combine(outputdir, String.Format(fileName, (String.IsNullOrEmpty(culture.Name) ? "invariant" : culture.Name)));
@@ -26,7 +26,7 @@ if ( typeof require !== "undefined"
}
Globalize.addCultureInfo( "en-US", "default", {
-
+ englishName: "English (United States)"
});
}( this ));
@@ -6996,7 +6996,7 @@ Globalize.addCultureInfo( "el-GR", "default", {
});
Globalize.addCultureInfo( "en-US", "default", {
-
+ englishName: "English (United States)"
});
Globalize.addCultureInfo( "fi-FI", "default", {

0 comments on commit 50d8bdf

Please sign in to comment.