Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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...
commit 50d8bdf3070c70cdd150dd4f08c735ee6c464b48 1 parent f4cad96
Richard D. Worth authored June 18, 2011
8  generator/Program.cs
@@ -548,6 +548,14 @@ public class Program {
548 548
         private static void WriteCulture(string outputdir, string fileName, string extend, string global, CultureInfo culture, StringBuilder aggregateScript) {
549 549
             var globInfo = GlobalizationInfo.GetGlobInfo(culture);
550 550
             var diff = (String.IsNullOrEmpty(extend) || culture == CultureInfo.InvariantCulture || culture.Name.Equals("en")) ? globInfo.ToDictionary(false) : GlobalizationInfo.DiffGlobInfos(GlobalizationInfo.BasisGlobInfo, globInfo.ToDictionary(true));
  551
+
  552
+            // Fix for Issue #31 - en-US 'englishName' is wrong
  553
+            // Special case diff of englishName for en-US. The generator diff seemingly finds both "en" and "en-US" to
  554
+            // have englishName "English (United States)" but globalize.js (correctly) has the neutral "English" for "en"/"default"
  555
+            if (culture.Name.Equals("en-US")) {
  556
+                diff.Add("englishName", globInfo.englishName);
  557
+            }
  558
+
551 559
             var script = GlobalizationInfo.GenerateJavaScript(extend, global, culture, culture.Name, diff, aggregateScript);
552 560
             var filePath = Path.Combine(outputdir, String.Format(fileName, (String.IsNullOrEmpty(culture.Name) ? "invariant" : culture.Name)));
553 561
 
2  lib/cultures/globalize.culture.en-US.js
@@ -26,7 +26,7 @@ if ( typeof require !== "undefined"
26 26
 }
27 27
 
28 28
 Globalize.addCultureInfo( "en-US", "default", {
29  
-
  29
+	englishName: "English (United States)"
30 30
 });
31 31
 
32 32
 }( this ));
2  lib/cultures/globalize.cultures.js
@@ -6996,7 +6996,7 @@ Globalize.addCultureInfo( "el-GR", "default", {
6996 6996
 });
6997 6997
 
6998 6998
 Globalize.addCultureInfo( "en-US", "default", {
6999  
-
  6999
+	englishName: "English (United States)"
7000 7000
 });
7001 7001
 
7002 7002
 Globalize.addCultureInfo( "fi-FI", "default", {

0 notes on commit 50d8bdf

Please sign in to comment.
Something went wrong with that request. Please try again.