You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by li...@apache.org on 2010/09/15 03:40:15 UTC

svn commit: r997163 [31/37] - in /shindig/trunk/features/src/main/javascript/features: caja/ com.google.gadgets.analytics/ container/ core.config/ core.io/ core.json/ core.legacy/ core.log/ core.prefs/ core.util/ dynamic-height.util/ dynamic-height/ fl...

Modified: shindig/trunk/features/src/main/javascript/features/i18n/datetimeparsetest.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/i18n/datetimeparsetest.js?rev=997163&r1=997162&r2=997163&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/i18n/datetimeparsetest.js (original)
+++ shindig/trunk/features/src/main/javascript/features/i18n/datetimeparsetest.js Wed Sep 15 01:39:49 2010
@@ -22,596 +22,596 @@
  */
 
 function DateTimeParseTest(name) {
-    TestCase.call(this, name);
+  TestCase.call(this, name);
 }
 
 DateTimeParseTest.inherits(TestCase);
 
 var DateTimeConstants_en = {
-    ERAS:["BC", "AD"],
-    ERANAMES:["Before Christ", "Anno Domini"],
-    NARROWMONTHS:["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
-    MONTHS:["January", "February", "March", "April", "May", "June", "July",
-        "August", "September", "October", "November", "December"],
-    SHORTMONTHS:["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep",
-        "Oct", "Nov", "Dec"],
-    WEEKDAYS:["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
-        "Saturday"],
-    SHORTWEEKDAYS:["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
-    NARROWWEEKDAYS:["S", "M", "T", "W", "T", "F", "S"],
-    SHORTQUARTERS:["Q1", "Q2", "Q3", "Q4"],
-    QUARTERS:["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"],
-    AMPMS:["AM", "PM"],
-    DATEFORMATS:["EEEE, MMMM d, yyyy", "MMMM d, yyyy", "MMM d, yyyy", "M/d/yy"],
-    TIMEFORMATS:["h:mm:ss a v", "h:mm:ss a z", "h:mm:ss a", "h:mm a"],
-    ZONESTRINGS:null
+  ERAS: ['BC', 'AD'],
+  ERANAMES: ['Before Christ', 'Anno Domini'],
+  NARROWMONTHS: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
+  MONTHS: ['January', 'February', 'March', 'April', 'May', 'June', 'July',
+    'August', 'September', 'October', 'November', 'December'],
+  SHORTMONTHS: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
+    'Oct', 'Nov', 'Dec'],
+  WEEKDAYS: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday',
+    'Saturday'],
+  SHORTWEEKDAYS: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
+  NARROWWEEKDAYS: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
+  SHORTQUARTERS: ['Q1', 'Q2', 'Q3', 'Q4'],
+  QUARTERS: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter'],
+  AMPMS: ['AM', 'PM'],
+  DATEFORMATS: ['EEEE, MMMM d, yyyy', 'MMMM d, yyyy', 'MMM d, yyyy', 'M/d/yy'],
+  TIMEFORMATS: ['h:mm:ss a v', 'h:mm:ss a z', 'h:mm:ss a', 'h:mm a'],
+  ZONESTRINGS: null
 };
 
 DateTimeConstants_en.STANDALONENARROWMONTHS =
-DateTimeConstants_en.NARROWMONTHS;
+    DateTimeConstants_en.NARROWMONTHS;
 DateTimeConstants_en.STANDALONEMONTHS = DateTimeConstants_en.MONTHS;
 DateTimeConstants_en.STANDALONESHORTMONTHS = DateTimeConstants_en.SHORTMONTHS;
 DateTimeConstants_en.STANDALONEWEEKDAYS = DateTimeConstants_en.WEEKDAYS;
 DateTimeConstants_en.STANDALONESHORTWEEKDAYS =
-DateTimeConstants_en.SHORTWEEKDAYS;
+    DateTimeConstants_en.SHORTWEEKDAYS;
 DateTimeConstants_en.STANDALONENARROWWEEKDAYS =
-DateTimeConstants_en.NARROWWEEKDAYS;
+    DateTimeConstants_en.NARROWWEEKDAYS;
 
 DateTimeParseTest.prototype.setUp = function() {
-    gadgets.i18n.dtParser_
+  gadgets.i18n.dtParser_
             = new gadgets.i18n.DateTimeParse(DateTimeConstants_en);
 };
 
 DateTimeParseTest.prototype.testNegativeYear = function() {
-    var date = new Date();
+  var date = new Date();
 
-    this.assertTrue(gadgets.i18n.parseDateTime("MM/dd, yyyy", "11/22, 1999",
-            0, date) > 0);
-    this.assertEquals(1999, date.getFullYear());
-    this.assertEquals(11 - 1, date.getMonth());
-    this.assertEquals(22, date.getDate());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("MM/dd, yyyy", "11/22, -1999",
-            0, date) > 0);
-    this.assertEquals(-1999, date.getFullYear());
-    this.assertEquals(11 - 1, date.getMonth());
-    this.assertEquals(22, date.getDate());
+  this.assertTrue(gadgets.i18n.parseDateTime('MM/dd, yyyy', '11/22, 1999',
+      0, date) > 0);
+  this.assertEquals(1999, date.getFullYear());
+  this.assertEquals(11 - 1, date.getMonth());
+  this.assertEquals(22, date.getDate());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('MM/dd, yyyy', '11/22, -1999',
+      0, date) > 0);
+  this.assertEquals(-1999, date.getFullYear());
+  this.assertEquals(11 - 1, date.getMonth());
+  this.assertEquals(22, date.getDate());
 };
 
 DateTimeParseTest.prototype.testEra = function() {
-    var date = new Date();
+  var date = new Date();
 
-    this.assertTrue(gadgets.i18n.parseDateTime("MM/dd, yyyyG", "11/22, 1999BC",
-            0, date) > 0);
-    this.assertEquals(-1998, date.getFullYear());
-    this.assertEquals(11 - 1, date.getMonth());
-    this.assertEquals(22, date.getDate());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("MM/dd, yyyyG", "11/22, 1BC",
-            0, date) > 0);
-    this.assertEquals(0, date.getFullYear());
-    this.assertEquals(11 - 1, date.getMonth());
-    this.assertEquals(22, date.getDate());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("MM/dd, yyyyG", "11/22, 1999AD",
-            0, date) > 0);
-    this.assertEquals(1999, date.getFullYear());
-    this.assertEquals(11 - 1, date.getMonth());
-    this.assertEquals(22, date.getDate());
+  this.assertTrue(gadgets.i18n.parseDateTime('MM/dd, yyyyG', '11/22, 1999BC',
+      0, date) > 0);
+  this.assertEquals(-1998, date.getFullYear());
+  this.assertEquals(11 - 1, date.getMonth());
+  this.assertEquals(22, date.getDate());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('MM/dd, yyyyG', '11/22, 1BC',
+      0, date) > 0);
+  this.assertEquals(0, date.getFullYear());
+  this.assertEquals(11 - 1, date.getMonth());
+  this.assertEquals(22, date.getDate());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('MM/dd, yyyyG', '11/22, 1999AD',
+      0, date) > 0);
+  this.assertEquals(1999, date.getFullYear());
+  this.assertEquals(11 - 1, date.getMonth());
+  this.assertEquals(22, date.getDate());
 };
 
 DateTimeParseTest.prototype.testFractionalSeconds = function() {
-    var date = new Date();
+  var date = new Date();
 
-    this.assertTrue(gadgets.i18n.parseDateTime("hh:mm:ss.SSS", "11:12:13.956",
-            0, date) > 0);
-    this.assertEquals(11, date.getHours());
-    this.assertEquals(12, date.getMinutes());
-    this.assertEquals(13, date.getSeconds());
-    this.assertEquals(956, date.getTime() % 1000);
-
-    this.assertTrue(gadgets.i18n.parseDateTime("hh:mm:ss.SSS", "11:12:13.95",
-            0, date) > 0);
-    this.assertEquals(11, date.getHours());
-    this.assertEquals(12, date.getMinutes());
-    this.assertEquals(13, date.getSeconds());
-    this.assertEquals(950, date.getTime() % 1000);
-
-    this.assertTrue(gadgets.i18n.parseDateTime("hh:mm:ss.SSS", "11:12:13.9",
-            0, date) > 0);
-    this.assertEquals(11, date.getHours());
-    this.assertEquals(12, date.getMinutes());
-    this.assertEquals(13, date.getSeconds());
-    this.assertEquals(900, date.getTime() % 1000);
+  this.assertTrue(gadgets.i18n.parseDateTime('hh:mm:ss.SSS', '11:12:13.956',
+      0, date) > 0);
+  this.assertEquals(11, date.getHours());
+  this.assertEquals(12, date.getMinutes());
+  this.assertEquals(13, date.getSeconds());
+  this.assertEquals(956, date.getTime() % 1000);
+
+  this.assertTrue(gadgets.i18n.parseDateTime('hh:mm:ss.SSS', '11:12:13.95',
+      0, date) > 0);
+  this.assertEquals(11, date.getHours());
+  this.assertEquals(12, date.getMinutes());
+  this.assertEquals(13, date.getSeconds());
+  this.assertEquals(950, date.getTime() % 1000);
+
+  this.assertTrue(gadgets.i18n.parseDateTime('hh:mm:ss.SSS', '11:12:13.9',
+      0, date) > 0);
+  this.assertEquals(11, date.getHours());
+  this.assertEquals(12, date.getMinutes());
+  this.assertEquals(13, date.getSeconds());
+  this.assertEquals(900, date.getTime() % 1000);
 };
 
 DateTimeParseTest.prototype.testAmbiguousYear = function() {
-    var date = new Date();
+  var date = new Date();
 
   // assume this year is 2006, year 27 to 99 will be interpret as 1927 to 1999
-    // year 00 to 25 will be 2000 to 2025. Year 26 can be either 1926 or 2026
-    // depend on the exact time.
-    var org_date = new Date();
-    org_date.setFullYear(org_date.getFullYear() + 20);
+  // year 00 to 25 will be 2000 to 2025. Year 26 can be either 1926 or 2026
+  // depend on the exact time.
+  var org_date = new Date();
+  org_date.setFullYear(org_date.getFullYear() + 20);
 
   // following 2 lines only works in 2006. Keep them here as they explained
-    // our intention better.
-    //assertTrue(DateTimeParse.parse("01/01/26", 0, "MM/dd/yy", date) > 0);
-    //assertTrue(date.getYear() == 2026 - 1900);
-
-    // rewrite so that it works in any year.
-    org_date.setMonth(0);
-    org_date.setDate(1);
-    org_date.setHours(0);
-    org_date.setMinutes(0);
-    org_date.setSeconds(0);
-    org_date.setMilliseconds(1);
-    var str = '01/01/' + (org_date.getFullYear() % 100);
-    this.assertTrue(gadgets.i18n.parseDateTime("MM/dd/yy", str, 0, date) > 0);
-    this.assertEquals(org_date.getFullYear(), date.getFullYear());
+  // our intention better.
+  //assertTrue(DateTimeParse.parse("01/01/26", 0, "MM/dd/yy", date) > 0);
+  //assertTrue(date.getYear() == 2026 - 1900);
+
+  // rewrite so that it works in any year.
+  org_date.setMonth(0);
+  org_date.setDate(1);
+  org_date.setHours(0);
+  org_date.setMinutes(0);
+  org_date.setSeconds(0);
+  org_date.setMilliseconds(1);
+  var str = '01/01/' + (org_date.getFullYear() % 100);
+  this.assertTrue(gadgets.i18n.parseDateTime('MM/dd/yy', str, 0, date) > 0);
+  this.assertEquals(org_date.getFullYear(), date.getFullYear());
 
   // following 2 lines only works in 2006. Keep them here as they explained
-    // our intention better.
-    //assertTrue(DateTimeParse.parse("MM/dd/yy", "12/30/26", 0, date) > 0);
-    //assertTrue(date.getYear() == 1926 - 1900);
-
-    // rewrite so that it works in any year.
-    org_date.setMonth(11);
-    org_date.setDate(31);
-    org_date.setHours(23);
-    org_date.setMinutes(59);
-    org_date.setSeconds(59);
-    org_date.setMilliseconds(999);
-    str = '12/31/' + (org_date.getFullYear() % 100);
-    this.assertTrue(gadgets.i18n.parseDateTime("MM/dd/yy", str, 0, date) > 0);
-    this.assertEquals(org_date.getFullYear(), date.getFullYear() + 100);
-
-    this.assertTrue(
-            gadgets.i18n.parseDateTime("yy,MM,dd", "2097,07,21", 0, date) > 0);
-    this.assertEquals(2097, date.getFullYear());
+  // our intention better.
+  //assertTrue(DateTimeParse.parse("MM/dd/yy", "12/30/26", 0, date) > 0);
+  //assertTrue(date.getYear() == 1926 - 1900);
+
+  // rewrite so that it works in any year.
+  org_date.setMonth(11);
+  org_date.setDate(31);
+  org_date.setHours(23);
+  org_date.setMinutes(59);
+  org_date.setSeconds(59);
+  org_date.setMilliseconds(999);
+  str = '12/31/' + (org_date.getFullYear() % 100);
+  this.assertTrue(gadgets.i18n.parseDateTime('MM/dd/yy', str, 0, date) > 0);
+  this.assertEquals(org_date.getFullYear(), date.getFullYear() + 100);
+
+  this.assertTrue(
+      gadgets.i18n.parseDateTime('yy,MM,dd', '2097,07,21', 0, date) > 0);
+  this.assertEquals(2097, date.getFullYear());
 
   // Test the ability to move the disambiguation century
-    gadgets.i18n.DateTimeParse.ambiguousYearCenturyStart = 60;
+  gadgets.i18n.DateTimeParse.ambiguousYearCenturyStart = 60;
 
-    org_date.setMonth(0);
-    org_date.setDate(1);
-    org_date.setHours(0);
-    org_date.setMinutes(0);
-    org_date.setSeconds(0);
-    org_date.setMilliseconds(1);
-    str = '01/01/' + (org_date.getFullYear() % 100);
-    this.assertTrue(gadgets.i18n.parseDateTime("MM/dd/yy", str, 0, date) > 0);
+  org_date.setMonth(0);
+  org_date.setDate(1);
+  org_date.setHours(0);
+  org_date.setMinutes(0);
+  org_date.setSeconds(0);
+  org_date.setMilliseconds(1);
+  str = '01/01/' + (org_date.getFullYear() % 100);
+  this.assertTrue(gadgets.i18n.parseDateTime('MM/dd/yy', str, 0, date) > 0);
 
-    this.assertEquals(org_date.getFullYear(), date.getFullYear());
+  this.assertEquals(org_date.getFullYear(), date.getFullYear());
 
   // Increment org_date 20 more years
-    org_date.setFullYear(date.getFullYear() + 20);
-    str = '01/01/' + (org_date.getFullYear() % 100);
-    this.assertTrue(gadgets.i18n.parseDateTime("MM/dd/yy", str, 0, date) > 0);
-    this.assertEquals(org_date.getFullYear(), date.getFullYear());
-
-    org_date.setFullYear(date.getFullYear() + 21);
-    str = '01/01/' + (org_date.getFullYear() % 100);
-    this.assertTrue(gadgets.i18n.parseDateTime("MM/dd/yy", str, 0, date) > 0);
-    this.assertEquals(org_date.getFullYear(), date.getFullYear() + 100);
+  org_date.setFullYear(date.getFullYear() + 20);
+  str = '01/01/' + (org_date.getFullYear() % 100);
+  this.assertTrue(gadgets.i18n.parseDateTime('MM/dd/yy', str, 0, date) > 0);
+  this.assertEquals(org_date.getFullYear(), date.getFullYear());
+
+  org_date.setFullYear(date.getFullYear() + 21);
+  str = '01/01/' + (org_date.getFullYear() % 100);
+  this.assertTrue(gadgets.i18n.parseDateTime('MM/dd/yy', str, 0, date) > 0);
+  this.assertEquals(org_date.getFullYear(), date.getFullYear() + 100);
 
   // Reset parameter for other test cases
-    gadgets.i18n.DateTimeParse.ambiguousYearCenturyStart = 80;
+  gadgets.i18n.DateTimeParse.ambiguousYearCenturyStart = 80;
 };
 
 DateTimeParseTest.prototype.testLeapYear = function() {
-    var date = new Date();
+  var date = new Date();
 
-    this.assertTrue(gadgets.i18n.parseDateTime("MMdd, yyyy", "0229, 2001",
-            0, date) > 0);
-    this.assertEquals(3 - 1, date.getMonth());
-    this.assertEquals(1, date.getDate());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("MMdd, yyyy", "0229, 2000",
-            0, date) > 0);
-    this.assertEquals(2 - 1, date.getMonth());
-    this.assertEquals(29, date.getDate());
+  this.assertTrue(gadgets.i18n.parseDateTime('MMdd, yyyy', '0229, 2001',
+      0, date) > 0);
+  this.assertEquals(3 - 1, date.getMonth());
+  this.assertEquals(1, date.getDate());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('MMdd, yyyy', '0229, 2000',
+      0, date) > 0);
+  this.assertEquals(2 - 1, date.getMonth());
+  this.assertEquals(29, date.getDate());
 };
 
 DateTimeParseTest.prototype.testAbutField = function() {
-    var date = new Date();
+  var date = new Date();
 
-    this.assertTrue(gadgets.i18n.parseDateTime("hhmm", "1122", 0, date) > 0);
-    this.assertEquals(11, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("hhmm", "122", 0, date) > 0);
-    this.assertEquals(1, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(
-            gadgets.i18n.parseDateTime("hhmmss", "112233", 0, date) > 0);
-    this.assertEquals(11, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-    this.assertEquals(33, date.getSeconds());
-
-    this.assertTrue(
-            gadgets.i18n.parseDateTime("hhmmss", "12233", 0, date) > 0);
-    this.assertEquals(1, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-    this.assertEquals(33, date.getSeconds());
-
-    this.assertTrue(
-            gadgets.i18n.parseDateTime("yyyyMMdd", "19991202", 0, date) > 0);
-    this.assertEquals(1999, date.getFullYear());
-    this.assertEquals(12 - 1, date.getMonth());
-    this.assertEquals(02, date.getDate());
-
-    this.assertTrue(
-            gadgets.i18n.parseDateTime("yyyyMMdd", "9991202", 0, date) > 0);
-    this.assertTrue(date.getFullYear() == 999);
-    this.assertEquals(12 - 1, date.getMonth());
-    this.assertEquals(02, date.getDate());
-
-    this.assertTrue(
-            gadgets.i18n.parseDateTime("yyyyMMdd", "991202", 0, date) > 0);
-    this.assertEquals(99, date.getFullYear());
-    this.assertEquals(12 - 1, date.getMonth());
-    this.assertEquals(02, date.getDate());
-
-    this.assertTrue(
-            gadgets.i18n.parseDateTime("yyyyMMdd", "91202", 0, date) > 0);
-    this.assertEquals(9, date.getFullYear());
-    this.assertEquals(12 - 1, date.getMonth());
-    this.assertEquals(02, date.getDate());
+  this.assertTrue(gadgets.i18n.parseDateTime('hhmm', '1122', 0, date) > 0);
+  this.assertEquals(11, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('hhmm', '122', 0, date) > 0);
+  this.assertEquals(1, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(
+      gadgets.i18n.parseDateTime('hhmmss', '112233', 0, date) > 0);
+  this.assertEquals(11, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+  this.assertEquals(33, date.getSeconds());
+
+  this.assertTrue(
+      gadgets.i18n.parseDateTime('hhmmss', '12233', 0, date) > 0);
+  this.assertEquals(1, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+  this.assertEquals(33, date.getSeconds());
+
+  this.assertTrue(
+      gadgets.i18n.parseDateTime('yyyyMMdd', '19991202', 0, date) > 0);
+  this.assertEquals(1999, date.getFullYear());
+  this.assertEquals(12 - 1, date.getMonth());
+  this.assertEquals(02, date.getDate());
+
+  this.assertTrue(
+      gadgets.i18n.parseDateTime('yyyyMMdd', '9991202', 0, date) > 0);
+  this.assertTrue(date.getFullYear() == 999);
+  this.assertEquals(12 - 1, date.getMonth());
+  this.assertEquals(02, date.getDate());
+
+  this.assertTrue(
+      gadgets.i18n.parseDateTime('yyyyMMdd', '991202', 0, date) > 0);
+  this.assertEquals(99, date.getFullYear());
+  this.assertEquals(12 - 1, date.getMonth());
+  this.assertEquals(02, date.getDate());
+
+  this.assertTrue(
+      gadgets.i18n.parseDateTime('yyyyMMdd', '91202', 0, date) > 0);
+  this.assertEquals(9, date.getFullYear());
+  this.assertEquals(12 - 1, date.getMonth());
+  this.assertEquals(02, date.getDate());
 };
 
 DateTimeParseTest.prototype.testYearParsing = function() {
-    var date = new Date();
+  var date = new Date();
 
-    this.assertTrue(
-            gadgets.i18n.parseDateTime("yyMMdd", "991202", 0, date) > 0);
-    this.assertEquals(1999, date.getFullYear());
-    this.assertEquals(12 - 1, date.getMonth());
-    this.assertEquals(02, date.getDate());
-
-    this.assertTrue(
-            gadgets.i18n.parseDateTime("yyyyMMdd", "20051202", 0, date) > 0);
-    this.assertEquals(2005, date.getFullYear());
-    this.assertEquals(12 - 1, date.getMonth());
-    this.assertEquals(02, date.getDate());
+  this.assertTrue(
+      gadgets.i18n.parseDateTime('yyMMdd', '991202', 0, date) > 0);
+  this.assertEquals(1999, date.getFullYear());
+  this.assertEquals(12 - 1, date.getMonth());
+  this.assertEquals(02, date.getDate());
+
+  this.assertTrue(
+      gadgets.i18n.parseDateTime('yyyyMMdd', '20051202', 0, date) > 0);
+  this.assertEquals(2005, date.getFullYear());
+  this.assertEquals(12 - 1, date.getMonth());
+  this.assertEquals(02, date.getDate());
 };
 
 DateTimeParseTest.prototype.testHourParsing_hh = function() {
-    var date = new Date();
+  var date = new Date();
 
-    this.assertTrue(gadgets.i18n.parseDateTime("hhmm", "0022", 0, date) > 0);
-    this.assertEquals(00, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("hhmm", "1122", 0, date) > 0);
-    this.assertEquals(11, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("hhmm", "1222", 0, date) > 0);
-    this.assertEquals(00, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("hhmm", "2322", 0, date) > 0);
-    this.assertEquals(23, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("hhmm", "2422", 0, date) > 0);
-    this.assertEquals(00, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("hhmma", "0022am", 0, date) > 0);
-    this.assertEquals(00, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("hhmma", "1122am", 0, date) > 0);
-    this.assertEquals(11, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("hhmma", "1222am", 0, date) > 0);
-    this.assertEquals(00, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("hhmma", "2322am", 0, date) > 0);
-    this.assertEquals(23, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("hhmma", "2422am", 0, date) > 0);
-    this.assertEquals(00, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("hhmma", "0022pm", 0, date) > 0);
-    this.assertEquals(12, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("hhmma", "1122pm", 0, date) > 0);
-    this.assertEquals(23, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("hhmma", "1222pm", 0, date) > 0);
-    this.assertEquals(12, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("hhmma", "2322pm", 0, date) > 0);
-    this.assertEquals(23, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("hhmma", "2422pm", 0, date) > 0);
-    this.assertEquals(00, date.getHours());
-    this.assertEquals(22, date.getMinutes());
+  this.assertTrue(gadgets.i18n.parseDateTime('hhmm', '0022', 0, date) > 0);
+  this.assertEquals(00, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('hhmm', '1122', 0, date) > 0);
+  this.assertEquals(11, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('hhmm', '1222', 0, date) > 0);
+  this.assertEquals(00, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('hhmm', '2322', 0, date) > 0);
+  this.assertEquals(23, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('hhmm', '2422', 0, date) > 0);
+  this.assertEquals(00, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('hhmma', '0022am', 0, date) > 0);
+  this.assertEquals(00, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('hhmma', '1122am', 0, date) > 0);
+  this.assertEquals(11, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('hhmma', '1222am', 0, date) > 0);
+  this.assertEquals(00, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('hhmma', '2322am', 0, date) > 0);
+  this.assertEquals(23, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('hhmma', '2422am', 0, date) > 0);
+  this.assertEquals(00, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('hhmma', '0022pm', 0, date) > 0);
+  this.assertEquals(12, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('hhmma', '1122pm', 0, date) > 0);
+  this.assertEquals(23, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('hhmma', '1222pm', 0, date) > 0);
+  this.assertEquals(12, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('hhmma', '2322pm', 0, date) > 0);
+  this.assertEquals(23, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('hhmma', '2422pm', 0, date) > 0);
+  this.assertEquals(00, date.getHours());
+  this.assertEquals(22, date.getMinutes());
 };
 
 DateTimeParseTest.prototype.testHourParsing_KK = function() {
-    var date = new Date();
+  var date = new Date();
 
-    this.assertTrue(gadgets.i18n.parseDateTime("KKmm", "0022", 0, date) > 0);
-    this.assertEquals(00, date.getHours());
-    this.assertEquals(22, date.getMinutes());
+  this.assertTrue(gadgets.i18n.parseDateTime('KKmm', '0022', 0, date) > 0);
+  this.assertEquals(00, date.getHours());
+  this.assertEquals(22, date.getMinutes());
 
-    this.assertTrue(gadgets.i18n.parseDateTime("KKmm", "1122", 0, date) > 0);
-    this.assertEquals(11, date.getHours());
-    this.assertEquals(22, date.getMinutes());
+  this.assertTrue(gadgets.i18n.parseDateTime('KKmm', '1122', 0, date) > 0);
+  this.assertEquals(11, date.getHours());
+  this.assertEquals(22, date.getMinutes());
 
-    this.assertTrue(gadgets.i18n.parseDateTime("KKmm", "1222", 0, date) > 0);
-    this.assertEquals(12, date.getHours());
-    this.assertEquals(22, date.getMinutes());
+  this.assertTrue(gadgets.i18n.parseDateTime('KKmm', '1222', 0, date) > 0);
+  this.assertEquals(12, date.getHours());
+  this.assertEquals(22, date.getMinutes());
 
-    this.assertTrue(gadgets.i18n.parseDateTime("KKmm", "2322", 0, date) > 0);
-    this.assertEquals(23, date.getHours());
-    this.assertEquals(22, date.getMinutes());
+  this.assertTrue(gadgets.i18n.parseDateTime('KKmm', '2322', 0, date) > 0);
+  this.assertEquals(23, date.getHours());
+  this.assertEquals(22, date.getMinutes());
 
-    this.assertTrue(gadgets.i18n.parseDateTime("KKmm", "2422", 0, date) > 0);
-    this.assertEquals(00, date.getHours());
-    this.assertEquals(22, date.getMinutes());
+  this.assertTrue(gadgets.i18n.parseDateTime('KKmm', '2422', 0, date) > 0);
+  this.assertEquals(00, date.getHours());
+  this.assertEquals(22, date.getMinutes());
 
 
-    this.assertTrue(gadgets.i18n.parseDateTime("KKmma", "0022am", 0, date) > 0);
-    this.assertEquals(00, date.getHours());
-    this.assertEquals(22, date.getMinutes());
+  this.assertTrue(gadgets.i18n.parseDateTime('KKmma', '0022am', 0, date) > 0);
+  this.assertEquals(00, date.getHours());
+  this.assertEquals(22, date.getMinutes());
 
-    this.assertTrue(gadgets.i18n.parseDateTime("KKmma", "1122am", 0, date) > 0);
-    this.assertEquals(11, date.getHours());
-    this.assertEquals(22, date.getMinutes());
+  this.assertTrue(gadgets.i18n.parseDateTime('KKmma', '1122am', 0, date) > 0);
+  this.assertEquals(11, date.getHours());
+  this.assertEquals(22, date.getMinutes());
 
-    this.assertTrue(gadgets.i18n.parseDateTime("KKmma", "1222am", 0, date) > 0);
-    this.assertEquals(12, date.getHours());
-    this.assertEquals(22, date.getMinutes());
+  this.assertTrue(gadgets.i18n.parseDateTime('KKmma', '1222am', 0, date) > 0);
+  this.assertEquals(12, date.getHours());
+  this.assertEquals(22, date.getMinutes());
 
-    this.assertTrue(gadgets.i18n.parseDateTime("KKmma", "2322am", 0, date) > 0);
-    this.assertEquals(23, date.getHours());
-    this.assertEquals(22, date.getMinutes());
+  this.assertTrue(gadgets.i18n.parseDateTime('KKmma', '2322am', 0, date) > 0);
+  this.assertEquals(23, date.getHours());
+  this.assertEquals(22, date.getMinutes());
 
-    this.assertTrue(gadgets.i18n.parseDateTime("KKmma", "2422am", 0, date) > 0);
-    this.assertEquals(00, date.getHours());
-    this.assertEquals(22, date.getMinutes());
+  this.assertTrue(gadgets.i18n.parseDateTime('KKmma', '2422am', 0, date) > 0);
+  this.assertEquals(00, date.getHours());
+  this.assertEquals(22, date.getMinutes());
 
-    this.assertTrue(gadgets.i18n.parseDateTime("KKmma", "0022pm", 0, date) > 0);
-    this.assertEquals(12, date.getHours());
-    this.assertEquals(22, date.getMinutes());
+  this.assertTrue(gadgets.i18n.parseDateTime('KKmma', '0022pm', 0, date) > 0);
+  this.assertEquals(12, date.getHours());
+  this.assertEquals(22, date.getMinutes());
 
-    this.assertTrue(gadgets.i18n.parseDateTime("KKmma", "1122pm", 0, date) > 0);
-    this.assertEquals(23, date.getHours());
-    this.assertEquals(22, date.getMinutes());
+  this.assertTrue(gadgets.i18n.parseDateTime('KKmma', '1122pm', 0, date) > 0);
+  this.assertEquals(23, date.getHours());
+  this.assertEquals(22, date.getMinutes());
 
-    this.assertTrue(gadgets.i18n.parseDateTime("KKmma", "1222pm", 0, date) > 0);
-    this.assertEquals(12, date.getHours());
-    this.assertEquals(22, date.getMinutes());
+  this.assertTrue(gadgets.i18n.parseDateTime('KKmma', '1222pm', 0, date) > 0);
+  this.assertEquals(12, date.getHours());
+  this.assertEquals(22, date.getMinutes());
 
-    this.assertTrue(gadgets.i18n.parseDateTime("KKmma", "2322pm", 0, date) > 0);
-    this.assertEquals(23, date.getHours());
-    this.assertEquals(22, date.getMinutes());
+  this.assertTrue(gadgets.i18n.parseDateTime('KKmma', '2322pm', 0, date) > 0);
+  this.assertEquals(23, date.getHours());
+  this.assertEquals(22, date.getMinutes());
 
-    this.assertTrue(gadgets.i18n.parseDateTime("KKmma", "2422pm", 0, date) > 0);
-    this.assertEquals(00, date.getHours());
-    this.assertEquals(22, date.getMinutes());
+  this.assertTrue(gadgets.i18n.parseDateTime('KKmma', '2422pm', 0, date) > 0);
+  this.assertEquals(00, date.getHours());
+  this.assertEquals(22, date.getMinutes());
 };
 
 DateTimeParseTest.prototype.testHourParsing_kk = function() {
-    var date = new Date();
+  var date = new Date();
 
-    this.assertTrue(gadgets.i18n.parseDateTime("kkmm", "0022", 0, date) > 0);
-    this.assertEquals(00, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("kkmm", "1122", 0, date) > 0);
-    this.assertEquals(11, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("kkmm", "1222", 0, date) > 0);
-    this.assertEquals(12, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("kkmm", "2322", 0, date) > 0);
-    this.assertEquals(23, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("kkmm", "2422", 0, date) > 0);
-    this.assertEquals(00, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("kkmma", "0022am", 0, date) > 0);
-    this.assertEquals(00, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("kkmma", "1122am", 0, date) > 0);
-    this.assertEquals(11, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("kkmma", "1222am", 0, date) > 0);
-    this.assertEquals(12, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("kkmma", "2322am", 0, date) > 0);
-    this.assertEquals(23, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("kkmma", "2422am", 0, date) > 0);
-    this.assertEquals(00, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("kkmma", "0022pm", 0, date) > 0);
-    this.assertEquals(12, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("kkmma", "1122pm", 0, date) > 0);
-    this.assertEquals(23, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("kkmma", "1222pm", 0, date) > 0);
-    this.assertEquals(12, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("kkmma", "2322pm", 0, date) > 0);
-    this.assertEquals(23, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("kkmma", "2422pm", 0, date) > 0);
-    this.assertEquals(00, date.getHours());
-    this.assertEquals(22, date.getMinutes());
+  this.assertTrue(gadgets.i18n.parseDateTime('kkmm', '0022', 0, date) > 0);
+  this.assertEquals(00, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('kkmm', '1122', 0, date) > 0);
+  this.assertEquals(11, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('kkmm', '1222', 0, date) > 0);
+  this.assertEquals(12, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('kkmm', '2322', 0, date) > 0);
+  this.assertEquals(23, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('kkmm', '2422', 0, date) > 0);
+  this.assertEquals(00, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('kkmma', '0022am', 0, date) > 0);
+  this.assertEquals(00, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('kkmma', '1122am', 0, date) > 0);
+  this.assertEquals(11, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('kkmma', '1222am', 0, date) > 0);
+  this.assertEquals(12, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('kkmma', '2322am', 0, date) > 0);
+  this.assertEquals(23, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('kkmma', '2422am', 0, date) > 0);
+  this.assertEquals(00, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('kkmma', '0022pm', 0, date) > 0);
+  this.assertEquals(12, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('kkmma', '1122pm', 0, date) > 0);
+  this.assertEquals(23, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('kkmma', '1222pm', 0, date) > 0);
+  this.assertEquals(12, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('kkmma', '2322pm', 0, date) > 0);
+  this.assertEquals(23, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('kkmma', '2422pm', 0, date) > 0);
+  this.assertEquals(00, date.getHours());
+  this.assertEquals(22, date.getMinutes());
 };
 
 DateTimeParseTest.prototype.testHourParsing_HH = function() {
-    var date = new Date();
+  var date = new Date();
 
-    this.assertTrue(gadgets.i18n.parseDateTime("HHmm", "0022", 0, date) > 0);
-    this.assertEquals(00, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("HHmm", "1122", 0, date) > 0);
-    this.assertEquals(11, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("HHmm", "1222", 0, date) > 0);
-    this.assertEquals(12, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("HHmm", "2322", 0, date) > 0);
-    this.assertEquals(23, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("HHmm", "2422", 0, date) > 0);
-    this.assertEquals(00, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("HHmma", "0022am", 0, date) > 0);
-    this.assertEquals(00, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("HHmma", "1122am", 0, date) > 0);
-    this.assertEquals(11, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("HHmma", "1222am", 0, date) > 0);
-    this.assertEquals(12, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("HHmma", "2322am", 0, date) > 0);
-    this.assertEquals(23, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("HHmma", "2422am", 0, date) > 0);
-    this.assertEquals(00, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("HHmma", "0022pm", 0, date) > 0);
-    this.assertEquals(12, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("HHmma", "1122pm", 0, date) > 0);
-    this.assertEquals(23, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("HHmma", "1222pm", 0, date) > 0);
-    this.assertEquals(12, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("HHmma", "2322pm", 0, date) > 0);
-    this.assertEquals(23, date.getHours());
-    this.assertEquals(22, date.getMinutes());
-
-    this.assertTrue(gadgets.i18n.parseDateTime("HHmma", "2422pm", 0, date) > 0);
-    this.assertEquals(00, date.getHours());
-    this.assertEquals(22, date.getMinutes());
+  this.assertTrue(gadgets.i18n.parseDateTime('HHmm', '0022', 0, date) > 0);
+  this.assertEquals(00, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('HHmm', '1122', 0, date) > 0);
+  this.assertEquals(11, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('HHmm', '1222', 0, date) > 0);
+  this.assertEquals(12, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('HHmm', '2322', 0, date) > 0);
+  this.assertEquals(23, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('HHmm', '2422', 0, date) > 0);
+  this.assertEquals(00, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('HHmma', '0022am', 0, date) > 0);
+  this.assertEquals(00, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('HHmma', '1122am', 0, date) > 0);
+  this.assertEquals(11, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('HHmma', '1222am', 0, date) > 0);
+  this.assertEquals(12, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('HHmma', '2322am', 0, date) > 0);
+  this.assertEquals(23, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('HHmma', '2422am', 0, date) > 0);
+  this.assertEquals(00, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('HHmma', '0022pm', 0, date) > 0);
+  this.assertEquals(12, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('HHmma', '1122pm', 0, date) > 0);
+  this.assertEquals(23, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('HHmma', '1222pm', 0, date) > 0);
+  this.assertEquals(12, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('HHmma', '2322pm', 0, date) > 0);
+  this.assertEquals(23, date.getHours());
+  this.assertEquals(22, date.getMinutes());
+
+  this.assertTrue(gadgets.i18n.parseDateTime('HHmma', '2422pm', 0, date) > 0);
+  this.assertEquals(00, date.getHours());
+  this.assertEquals(22, date.getMinutes());
 };
 
 DateTimeParseTest.prototype.testEnglishDate = function() {
-    var date = new Date();
+  var date = new Date();
 
-    this.assertTrue(gadgets.i18n.parseDateTime("yyyy MMM dd hh:mm",
-            "2006 Jul 10 15:44", 0, date) > 0);
-    this.assertEquals(2006, date.getFullYear());
-    this.assertEquals(7 - 1, date.getMonth());
-    this.assertEquals(10, date.getDate());
-    this.assertEquals(15, date.getHours());
-    this.assertEquals(44, date.getMinutes());
+  this.assertTrue(gadgets.i18n.parseDateTime('yyyy MMM dd hh:mm',
+      '2006 Jul 10 15:44', 0, date) > 0);
+  this.assertEquals(2006, date.getFullYear());
+  this.assertEquals(7 - 1, date.getMonth());
+  this.assertEquals(10, date.getDate());
+  this.assertEquals(15, date.getHours());
+  this.assertEquals(44, date.getMinutes());
 };
 
 DateTimeParseTest.prototype.testTimeZone = function() {
-    var date = new Date();
+  var date = new Date();
 
-    this.assertTrue(gadgets.i18n.parseDateTime("MM/dd/yyyy, hh:mm:ss zzz",
-            "07/21/2003, 11:22:33 GMT-0700", 0,
-            date) > 0);
-    var hour_GmtMinus07 = date.getHours();
-
-    this.assertTrue(gadgets.i18n.parseDateTime("MM/dd/yyyy, hh:mm:ss zzz",
-            "07/21/2003, 11:22:33 GMT-0600", 0,
-            date) > 0);
-    var hour_GmtMinus06 = date.getHours();
-    this.assertEquals(1, (hour_GmtMinus07 + 24 - hour_GmtMinus06) % 24);
-
-    this.assertTrue(gadgets.i18n.parseDateTime("MM/dd/yyyy, hh:mm:ss zzz",
-            "07/21/2003, 11:22:33 GMT-0800", 0,
-            date) > 0);
-    var hour_GmtMinus08 = date.getHours();
-    this.assertEquals(1, (hour_GmtMinus08 + 24 - hour_GmtMinus07) % 24);
-
-    this.assertTrue(gadgets.i18n.parseDateTime("MM/dd/yyyy, HH:mm:ss zzz",
-            "07/21/2003, 23:22:33 GMT-0800", 0,
-            date) > 0);
-    this.assertEquals((date.getHours() + 24 - hour_GmtMinus07) % 24, 13);
-
-    this.assertTrue(gadgets.i18n.parseDateTime("MM/dd/yyyy, HH:mm:ss zzz",
-            "07/21/2003, 11:22:33 GMT+0800", 0,
-            date) > 0);
-    var hour_Gmt08 = date.getHours();
-    this.assertEquals(16, (hour_GmtMinus08 + 24 - hour_Gmt08) % 24);
-
-    this.assertTrue(gadgets.i18n.parseDateTime("MM/dd/yyyy, HH:mm:ss zzz",
-            "07/21/2003, 11:22:33 GMT0800", 0,
-            date) > 0);
-    this.assertEquals(hour_Gmt08, date.getHours());
+  this.assertTrue(gadgets.i18n.parseDateTime('MM/dd/yyyy, hh:mm:ss zzz',
+      '07/21/2003, 11:22:33 GMT-0700', 0,
+      date) > 0);
+  var hour_GmtMinus07 = date.getHours();
+
+  this.assertTrue(gadgets.i18n.parseDateTime('MM/dd/yyyy, hh:mm:ss zzz',
+      '07/21/2003, 11:22:33 GMT-0600', 0,
+      date) > 0);
+  var hour_GmtMinus06 = date.getHours();
+  this.assertEquals(1, (hour_GmtMinus07 + 24 - hour_GmtMinus06) % 24);
+
+  this.assertTrue(gadgets.i18n.parseDateTime('MM/dd/yyyy, hh:mm:ss zzz',
+      '07/21/2003, 11:22:33 GMT-0800', 0,
+      date) > 0);
+  var hour_GmtMinus08 = date.getHours();
+  this.assertEquals(1, (hour_GmtMinus08 + 24 - hour_GmtMinus07) % 24);
+
+  this.assertTrue(gadgets.i18n.parseDateTime('MM/dd/yyyy, HH:mm:ss zzz',
+      '07/21/2003, 23:22:33 GMT-0800', 0,
+      date) > 0);
+  this.assertEquals((date.getHours() + 24 - hour_GmtMinus07) % 24, 13);
+
+  this.assertTrue(gadgets.i18n.parseDateTime('MM/dd/yyyy, HH:mm:ss zzz',
+      '07/21/2003, 11:22:33 GMT+0800', 0,
+      date) > 0);
+  var hour_Gmt08 = date.getHours();
+  this.assertEquals(16, (hour_GmtMinus08 + 24 - hour_Gmt08) % 24);
+
+  this.assertTrue(gadgets.i18n.parseDateTime('MM/dd/yyyy, HH:mm:ss zzz',
+      '07/21/2003, 11:22:33 GMT0800', 0,
+      date) > 0);
+  this.assertEquals(hour_Gmt08, date.getHours());
 };
 
 DateTimeParseTest.prototype.testWeekDay = function() {
-    var date = new Date();
+  var date = new Date();
 
-    this.assertTrue(gadgets.i18n.parseDateTime("EEEE, MM/dd/yyyy",
-            "Wednesday, 08/16/2006", 0, date) > 0);
-    this.assertEquals(2006, date.getFullYear());
-    this.assertEquals(8 - 1, date.getMonth());
-    this.assertEquals(16, date.getDate());
-    this.assertTrue(gadgets.i18n.parseDateTime("EEEE, MM/dd/yyyy",
-            "Tuesday, 08/16/2006", 0, date) == 0);
-    this.assertTrue(gadgets.i18n.parseDateTime("EEEE, MM/dd/yyyy",
-            "Thursday, 08/16/2006", 0, date) == 0);
-    this.assertTrue(gadgets.i18n.parseDateTime("EEEE, MM/dd/yyyy",
-            "Wed, 08/16/2006", 0, date) > 0);
-    this.assertTrue(gadgets.i18n.parseDateTime("EEEE, MM/dd/yyyy",
-            "Wasdfed, 08/16/2006", 0, date) == 0);
-
-    date.setDate(25);
-    this.assertTrue(gadgets.i18n.parseDateTime("EEEE, MM/yyyy",
-            "Wed, 09/2006", 0, date) > 0);
-    this.assertEquals(27, date.getDate());
-
-    date.setDate(30);
-    this.assertTrue(gadgets.i18n.parseDateTime("EEEE, MM/yyyy",
-            "Wed, 09/2006", 0, date) > 0);
-    this.assertEquals(27, date.getDate());
-    date.setDate(30);
-    this.assertTrue(gadgets.i18n.parseDateTime("EEEE, MM/yyyy",
-            "Mon, 09/2006", 0, date) > 0);
-    this.assertEquals(25, date.getDate());
+  this.assertTrue(gadgets.i18n.parseDateTime('EEEE, MM/dd/yyyy',
+      'Wednesday, 08/16/2006', 0, date) > 0);
+  this.assertEquals(2006, date.getFullYear());
+  this.assertEquals(8 - 1, date.getMonth());
+  this.assertEquals(16, date.getDate());
+  this.assertTrue(gadgets.i18n.parseDateTime('EEEE, MM/dd/yyyy',
+      'Tuesday, 08/16/2006', 0, date) == 0);
+  this.assertTrue(gadgets.i18n.parseDateTime('EEEE, MM/dd/yyyy',
+      'Thursday, 08/16/2006', 0, date) == 0);
+  this.assertTrue(gadgets.i18n.parseDateTime('EEEE, MM/dd/yyyy',
+      'Wed, 08/16/2006', 0, date) > 0);
+  this.assertTrue(gadgets.i18n.parseDateTime('EEEE, MM/dd/yyyy',
+      'Wasdfed, 08/16/2006', 0, date) == 0);
+
+  date.setDate(25);
+  this.assertTrue(gadgets.i18n.parseDateTime('EEEE, MM/yyyy',
+      'Wed, 09/2006', 0, date) > 0);
+  this.assertEquals(27, date.getDate());
+
+  date.setDate(30);
+  this.assertTrue(gadgets.i18n.parseDateTime('EEEE, MM/yyyy',
+      'Wed, 09/2006', 0, date) > 0);
+  this.assertEquals(27, date.getDate());
+  date.setDate(30);
+  this.assertTrue(gadgets.i18n.parseDateTime('EEEE, MM/yyyy',
+      'Mon, 09/2006', 0, date) > 0);
+  this.assertEquals(25, date.getDate());
 
 };

Modified: shindig/trunk/features/src/main/javascript/features/i18n/formatting.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/i18n/formatting.js?rev=997163&r1=997162&r2=997163&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/i18n/formatting.js (original)
+++ shindig/trunk/features/src/main/javascript/features/i18n/formatting.js Wed Sep 15 01:39:49 2010
@@ -18,7 +18,7 @@
 
 
 /**
- * @fileoverview Functions for dealing with locale-specific formatting
+ * @fileoverview Functions for dealing with locale-specific formatting.
  *
  * Note: Gadgets locale is set at render time. Gadget containers should emit
  * the data files required by the i18n feature by emitting
@@ -46,19 +46,19 @@ gadgets.i18n.numFormatter_ = null;
  * @return {string} string representation of date/time.
  */
 gadgets.i18n.formatDateTime = function(pattern, date) {
-    if (!gadgets.i18n.dtFormatter_) {
-        gadgets.i18n.dtFormatter_ = new gadgets.i18n.DateTimeFormat(gadgets.i18n.DateTimeConstants);
-        typeof pattern == 'string'
+  if (!gadgets.i18n.dtFormatter_) {
+    gadgets.i18n.dtFormatter_ = new gadgets.i18n.DateTimeFormat(gadgets.i18n.DateTimeConstants);
+    typeof pattern == 'string'
                 ? gadgets.i18n.dtFormatter_.applyPattern(pattern)
                 : gadgets.i18n.dtFormatter_.applyStandardPattern(pattern);
-        gadgets.i18n.dtFormatter_.patternInUse_ = pattern;
-    } else if (gadgets.i18n.dtFormatter_.patternInUse_ != pattern) {
-        typeof pattern == 'string'
+    gadgets.i18n.dtFormatter_.patternInUse_ = pattern;
+  } else if (gadgets.i18n.dtFormatter_.patternInUse_ != pattern) {
+    typeof pattern == 'string'
                 ? gadgets.i18n.dtFormatter_.applyPattern(pattern)
                 : gadgets.i18n.dtFormatter_.applyStandardPattern(pattern);
-        gadgets.i18n.dtFormatter_.patternInUse_ = pattern;
-    }
-    return gadgets.i18n.dtFormatter_.format(date);
+    gadgets.i18n.dtFormatter_.patternInUse_ = pattern;
+  }
+  return gadgets.i18n.dtFormatter_.format(date);
 };
 
 
@@ -76,19 +76,19 @@ gadgets.i18n.formatDateTime = function(p
  * @return {number} The number of characters advanced or 0 if failed.
  */
 gadgets.i18n.parseDateTime = function(pattern, text, start, date) {
-    if (!gadgets.i18n.dtParser_) {
-        gadgets.i18n.dtParser_ = new gadgets.i18n.DateTimeParse(gadgets.i18n.DateTimeConstants);
-        typeof pattern == 'string'
+  if (!gadgets.i18n.dtParser_) {
+    gadgets.i18n.dtParser_ = new gadgets.i18n.DateTimeParse(gadgets.i18n.DateTimeConstants);
+    typeof pattern == 'string'
                 ? gadgets.i18n.dtParser_.applyPattern(pattern)
                 : gadgets.i18n.dtParser_.applyStandardPattern(pattern);
-        gadgets.i18n.dtParser_.patternInUse_ = pattern;
-    } else if (gadgets.i18n.dtParser_.patternInUse_ != pattern) {
-        typeof pattern == 'string'
+    gadgets.i18n.dtParser_.patternInUse_ = pattern;
+  } else if (gadgets.i18n.dtParser_.patternInUse_ != pattern) {
+    typeof pattern == 'string'
                 ? gadgets.i18n.dtParser_.applyPattern(pattern)
                 : gadgets.i18n.dtParser_.applyStandardPattern(pattern);
-        gadgets.i18n.dtParser_.patternInUse_ = pattern;
-    }
-    return gadgets.i18n.dtParser_.parse(text, start, date);
+    gadgets.i18n.dtParser_.patternInUse_ = pattern;
+  }
+  return gadgets.i18n.dtParser_.parse(text, start, date);
 };
 
 
@@ -104,23 +104,23 @@ gadgets.i18n.parseDateTime = function(pa
  * @return {string} The formatted string.
  */
 gadgets.i18n.formatNumber = function(pattern, value, opt_currencyCode) {
-    if (!gadgets.i18n.numFormatter_) {
-        gadgets.i18n.numFormatter_ = new gadgets.i18n.NumberFormat(gadgets.i18n.NumberFormatConstants);
-        typeof pattern == 'string'
+  if (!gadgets.i18n.numFormatter_) {
+    gadgets.i18n.numFormatter_ = new gadgets.i18n.NumberFormat(gadgets.i18n.NumberFormatConstants);
+    typeof pattern == 'string'
                 ? gadgets.i18n.numFormatter_.applyPattern(
-                  pattern, opt_currencyCode)
+        pattern, opt_currencyCode)
                 : gadgets.i18n.numFormatter_.applyStandardPattern(
                   pattern, opt_currencyCode);
-        gadgets.i18n.numFormatter_.patternInUse_ = pattern;
-    } else if (gadgets.i18n.numFormatter_.patternInUse_ != pattern) {
-        typeof pattern == 'string'
+    gadgets.i18n.numFormatter_.patternInUse_ = pattern;
+  } else if (gadgets.i18n.numFormatter_.patternInUse_ != pattern) {
+    typeof pattern == 'string'
                 ? gadgets.i18n.numFormatter_.applyPattern(
-                  pattern, opt_currencyCode)
+        pattern, opt_currencyCode)
                 : gadgets.i18n.numFormatter_.applyStandardPattern(
                   pattern, opt_currencyCode);
-        gadgets.i18n.numFormatter_.patternInUse_ = pattern;
-    }
-    return gadgets.i18n.numFormatter_.format(value);
+    gadgets.i18n.numFormatter_.patternInUse_ = pattern;
+  }
+  return gadgets.i18n.numFormatter_.format(value);
 };
 
 
@@ -139,27 +139,27 @@ gadgets.i18n.formatNumber = function(pat
  * @return {number} Parsed number, 0 if in error.
  */
 gadgets.i18n.parseNumber = function(pattern, text, opt_pos, opt_currencyCode) {
-    if (!gadgets.i18n.numFormatter_) {
-        gadgets.i18n.numFormatter_ = new gadgets.i18n.NumberFormat();
-        typeof pattern == 'string'
+  if (!gadgets.i18n.numFormatter_) {
+    gadgets.i18n.numFormatter_ = new gadgets.i18n.NumberFormat();
+    typeof pattern == 'string'
                 ? gadgets.i18n.numFormatter_.applyPattern(pattern,
                                                           opt_currencyCode)
                 : gadgets.i18n.numFormatter_.applyStandardPattern(
                   pattern, opt_currencyCode);
-        gadgets.i18n.numFormatter_.patternInUse_ = pattern;
-        gadgets.i18n.numFormatter_.currencyCodeInUse_ = opt_currencyCode;
-    } else if (gadgets.i18n.numFormatter_.patternInUse_ != pattern ||
-               gadgets.i18n.numFormatter_.currencyCodeInUse_
+    gadgets.i18n.numFormatter_.patternInUse_ = pattern;
+    gadgets.i18n.numFormatter_.currencyCodeInUse_ = opt_currencyCode;
+  } else if (gadgets.i18n.numFormatter_.patternInUse_ != pattern ||
+      gadgets.i18n.numFormatter_.currencyCodeInUse_
                        != opt_currencyCode) {
-        typeof pattern == 'string'
+    typeof pattern == 'string'
                 ? gadgets.i18n.numFormatter_.applyPattern(pattern,
                                                           opt_currencyCode)
                 : gadgets.i18n.numFormatter_.applyStandardPattern(
                   pattern, opt_currencyCode);
-        gadgets.i18n.numFormatter_.patternInUse_ = pattern;
-        gadgets.i18n.numFormatter_.currencyCodeInUse_ = opt_currencyCode;
-    }
-    return gadgets.i18n.numFormatter_.parse(text, opt_pos);
+    gadgets.i18n.numFormatter_.patternInUse_ = pattern;
+    gadgets.i18n.numFormatter_.currencyCodeInUse_ = opt_currencyCode;
+  }
+  return gadgets.i18n.numFormatter_.parse(text, opt_pos);
 };
 
 // Couple of constants to represent predefined Date/Time format type.

Modified: shindig/trunk/features/src/main/javascript/features/i18n/numberformat.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/i18n/numberformat.js?rev=997163&r1=997162&r2=997163&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/i18n/numberformat.js (original)
+++ shindig/trunk/features/src/main/javascript/features/i18n/numberformat.js Wed Sep 15 01:39:49 2010
@@ -18,7 +18,7 @@
 
 
 /**
- * @fileoverview Number format/parse library with locale support
+ * @fileoverview Number format/parse library with locale support.
  */
 
 gadgets.i18n = gadgets.i18n || {};
@@ -30,7 +30,7 @@ gadgets.i18n = gadgets.i18n || {};
  * @constructor
  */
 gadgets.i18n.NumberFormat = function(symbol) {
-    this.symbols_ = symbol;
+  this.symbols_ = symbol;
 };
 
 /**
@@ -42,23 +42,23 @@ gadgets.i18n.NumberFormat = function(sym
  *     the currency code for current locale will be used.
  */
 gadgets.i18n.NumberFormat.prototype.applyStandardPattern =
-function(patternType, opt_currency) {
-    switch (patternType) {
-        case gadgets.i18n.DECIMAL_PATTERN:
-            this.applyPattern(this.symbols_.DECIMAL_PATTERN, opt_currency);
-            break;
-        case gadgets.i18n.SCIENTIFIC_PATTERN:
-            this.applyPattern(this.symbols_.SCIENTIFIC_PATTERN, opt_currency);
-            break;
-        case gadgets.i18n.PERCENT_PATTERN:
-            this.applyPattern(this.symbols_.PERCENT_PATTERN, opt_currency);
-            break;
-        case gadgets.i18n.CURRENCY_PATTERN:
-            this.applyPattern(this.symbols_.CURRENCY_PATTERN, opt_currency);
-            break;
-        default:
-            throw Error('Unsupported pattern type.');
-    }
+    function(patternType, opt_currency) {
+  switch (patternType) {
+    case gadgets.i18n.DECIMAL_PATTERN:
+      this.applyPattern(this.symbols_.DECIMAL_PATTERN, opt_currency);
+      break;
+    case gadgets.i18n.SCIENTIFIC_PATTERN:
+      this.applyPattern(this.symbols_.SCIENTIFIC_PATTERN, opt_currency);
+      break;
+    case gadgets.i18n.PERCENT_PATTERN:
+      this.applyPattern(this.symbols_.PERCENT_PATTERN, opt_currency);
+      break;
+    case gadgets.i18n.CURRENCY_PATTERN:
+      this.applyPattern(this.symbols_.CURRENCY_PATTERN, opt_currency);
+      break;
+    default:
+      throw Error('Unsupported pattern type.');
+  }
 };
 
 
@@ -70,30 +70,30 @@ function(patternType, opt_currency) {
  *     the currency code for current locale will be used.
  */
 gadgets.i18n.NumberFormat.prototype.applyPattern =
-function(pattern, opt_currency) {
-    this.pattern_ = pattern;
-    this.intlCurrencyCode_ = opt_currency || this.symbols_.DEF_CURRENCY_CODE;
-    this.currencySymbol_ = gadgets.i18n.CurrencyCodeMap[this.intlCurrencyCode_];
-
-    this.maximumIntegerDigits_ = 40;
-    this.minimumIntegerDigits_ = 1;
-    this.maximumFractionDigits_ = 3; // invariant, >= minFractionDigits
-    this.minimumFractionDigits_ = 0;
-    this.minExponentDigits_ = 0;
-
-    this.positivePrefix_ = '';
-    this.positiveSuffix_ = '';
-    this.negativePrefix_ = '-';
-    this.negativeSuffix_ = '';
+    function(pattern, opt_currency) {
+  this.pattern_ = pattern;
+  this.intlCurrencyCode_ = opt_currency || this.symbols_.DEF_CURRENCY_CODE;
+  this.currencySymbol_ = gadgets.i18n.CurrencyCodeMap[this.intlCurrencyCode_];
+
+  this.maximumIntegerDigits_ = 40;
+  this.minimumIntegerDigits_ = 1;
+  this.maximumFractionDigits_ = 3; // invariant, >= minFractionDigits
+  this.minimumFractionDigits_ = 0;
+  this.minExponentDigits_ = 0;
+
+  this.positivePrefix_ = '';
+  this.positiveSuffix_ = '';
+  this.negativePrefix_ = '-';
+  this.negativeSuffix_ = '';
 
   // The multiplier for use in percent, per mille, etc.
-    this.multiplier_ = 1;
-    this.groupingSize_ = 3;
-    this.decimalSeparatorAlwaysShown_ = false;
-    this.isCurrencyFormat_ = false;
-    this.useExponentialNotation_ = false;
+  this.multiplier_ = 1;
+  this.groupingSize_ = 3;
+  this.decimalSeparatorAlwaysShown_ = false;
+  this.isCurrencyFormat_ = false;
+  this.useExponentialNotation_ = false;
 
-    this.parsePattern_(this.pattern_);
+  this.parsePattern_(this.pattern_);
 };
 
 
@@ -110,53 +110,53 @@ function(pattern, opt_currency) {
  * @return {number} Parsed number, or 0 if the parse fails.
  */
 gadgets.i18n.NumberFormat.prototype.parse = function(text, opt_pos) {
-    var pos = opt_pos || [0];
+  var pos = opt_pos || [0];
 
-    var start = pos[0];
-    var ret = 0;
+  var start = pos[0];
+  var ret = 0;
 
-    var gotPositive = text.indexOf(this.positivePrefix_, pos[0]) == pos[0];
-    var gotNegative = text.indexOf(this.negativePrefix_, pos[0]) == pos[0];
+  var gotPositive = text.indexOf(this.positivePrefix_, pos[0]) == pos[0];
+  var gotNegative = text.indexOf(this.negativePrefix_, pos[0]) == pos[0];
 
   // check for the longest match
-    if (gotPositive && gotNegative) {
-        if (this.positivePrefix_.length > this.negativePrefix_.length) {
-            gotNegative = false;
-        } else if (this.positivePrefix_.length < this.negativePrefix_.length) {
-            gotPositive = false;
-        }
-    }
-
-    if (gotPositive) {
-        pos[0] += this.positivePrefix_.length;
-    } else if (gotNegative) {
-        pos[0] += this.negativePrefix_.length;
-    }
+  if (gotPositive && gotNegative) {
+    if (this.positivePrefix_.length > this.negativePrefix_.length) {
+      gotNegative = false;
+    } else if (this.positivePrefix_.length < this.negativePrefix_.length) {
+      gotPositive = false;
+    }
+  }
+
+  if (gotPositive) {
+    pos[0] += this.positivePrefix_.length;
+  } else if (gotNegative) {
+    pos[0] += this.negativePrefix_.length;
+  }
 
   // process digits or Inf, find decimal position
-    if (text.indexOf(this.symbols_.INFINITY, pos[0]) == pos[0]) {
-        pos[0] += this.symbols_.INFINITY.length;
-        ret = Infinity;
-    } else {
-        ret = this.parseNumber_(text, pos);
-    }
+  if (text.indexOf(this.symbols_.INFINITY, pos[0]) == pos[0]) {
+    pos[0] += this.symbols_.INFINITY.length;
+    ret = Infinity;
+  } else {
+    ret = this.parseNumber_(text, pos);
+  }
 
   // check for suffix
-    if (gotPositive) {
-        if (!(text.indexOf(this.positiveSuffix_, pos[0]) == pos[0])) {
-            pos[0] = start;
-            return 0;
-        }
-        pos[0] += this.positiveSuffix_.length;
-    } else if (gotNegative) {
-        if (!(text.indexOf(this.negativeSuffix_, pos[0]) == pos[0])) {
-            pos[0] = start;
-            return 0;
-        }
-        pos[0] += this.negativeSuffix_.length;
+  if (gotPositive) {
+    if (!(text.indexOf(this.positiveSuffix_, pos[0]) == pos[0])) {
+      pos[0] = start;
+      return 0;
+    }
+    pos[0] += this.positiveSuffix_.length;
+  } else if (gotNegative) {
+    if (!(text.indexOf(this.negativeSuffix_, pos[0]) == pos[0])) {
+      pos[0] = start;
+      return 0;
     }
+    pos[0] += this.negativeSuffix_.length;
+  }
 
-    return gotNegative ? -ret : ret;
+  return gotNegative ? -ret : ret;
 };
 
 
@@ -171,67 +171,67 @@ gadgets.i18n.NumberFormat.prototype.pars
  * @private
  */
 gadgets.i18n.NumberFormat.prototype.parseNumber_ = function(text, pos) {
-    var sawDecimal = false;
-    var sawExponent = false;
-    var sawDigit = false;
-    var scale = 1;
-    var decimal = this.isCurrencyFormat_ ? this.symbols_.MONETARY_SEP :
-                  this.symbols_.DECIMAL_SEP;
-    var grouping = this.isCurrencyFormat_ ? this.symbols_.MONETARY_GROUP_SEP :
-                   this.symbols_.GROUP_SEP;
-    var exponentChar = this.symbols_.EXP_SYMBOL;
-
-    var normalizedText = '';
-    for (; pos[0] < text.length; pos[0]++) {
-        var ch = text.charAt(pos[0]);
-        var digit = this.getDigit_(ch);
-        if (digit >= 0 && digit <= 9) {
-            normalizedText += digit;
-            sawDigit = true;
-        } else if (ch == decimal.charAt(0)) {
-            if (sawDecimal || sawExponent) {
-                break;
-            }
-            normalizedText += '.';
-            sawDecimal = true;
-        } else if (ch == grouping.charAt(0) || '\u00a0' == grouping.charAt(0) &&
-                                               ch == ' ' && pos[0] + 1 < text.length &&
-                                               this.getDigit_(text.charAt(pos[0] + 1)) >= 0) {
-            if (sawDecimal || sawExponent) {
-                break;
-            }
-            continue;
-        } else if (ch == exponentChar.charAt(0)) {
-            if (sawExponent) {
-                break;
-            }
-            normalizedText += 'E';
-            sawExponent = true;
-        } else if (ch == '+' || ch == '-') {
-            normalizedText += ch;
-        } else if (ch == this.symbols_.PERCENT.charAt(0)) {
-            if (scale != 1) {
-                break;
-            }
-            scale = 100;
-            if (sawDigit) {
-                pos[0]++; // eat this character if parse end here
-                break;
-            }
-        } else if (ch == this.symbols_.PERMILL.charAt(0)) {
-            if (scale != 1) {
-                break;
-            }
-            scale = 1000;
-            if (sawDigit) {
-                pos[0]++; // eat this character if parse end here
-                break;
-            }
-        } else {
-            break;
-        }
+  var sawDecimal = false;
+  var sawExponent = false;
+  var sawDigit = false;
+  var scale = 1;
+  var decimal = this.isCurrencyFormat_ ? this.symbols_.MONETARY_SEP :
+      this.symbols_.DECIMAL_SEP;
+  var grouping = this.isCurrencyFormat_ ? this.symbols_.MONETARY_GROUP_SEP :
+      this.symbols_.GROUP_SEP;
+  var exponentChar = this.symbols_.EXP_SYMBOL;
+
+  var normalizedText = '';
+  for (; pos[0] < text.length; pos[0]++) {
+    var ch = text.charAt(pos[0]);
+    var digit = this.getDigit_(ch);
+    if (digit >= 0 && digit <= 9) {
+      normalizedText += digit;
+      sawDigit = true;
+    } else if (ch == decimal.charAt(0)) {
+      if (sawDecimal || sawExponent) {
+        break;
+      }
+      normalizedText += '.';
+      sawDecimal = true;
+    } else if (ch == grouping.charAt(0) || '\u00a0' == grouping.charAt(0) &&
+        ch == ' ' && pos[0] + 1 < text.length &&
+        this.getDigit_(text.charAt(pos[0] + 1)) >= 0) {
+      if (sawDecimal || sawExponent) {
+        break;
+      }
+      continue;
+    } else if (ch == exponentChar.charAt(0)) {
+      if (sawExponent) {
+        break;
+      }
+      normalizedText += 'E';
+      sawExponent = true;
+    } else if (ch == '+' || ch == '-') {
+      normalizedText += ch;
+    } else if (ch == this.symbols_.PERCENT.charAt(0)) {
+      if (scale != 1) {
+        break;
+      }
+      scale = 100;
+      if (sawDigit) {
+        pos[0]++; // eat this character if parse end here
+        break;
+      }
+    } else if (ch == this.symbols_.PERMILL.charAt(0)) {
+      if (scale != 1) {
+        break;
+      }
+      scale = 1000;
+      if (sawDigit) {
+        pos[0]++; // eat this character if parse end here
+        break;
+      }
+    } else {
+      break;
     }
-    return parseFloat(normalizedText) / scale;
+  }
+  return parseFloat(normalizedText) / scale;
 };
 
 
@@ -242,33 +242,33 @@ gadgets.i18n.NumberFormat.prototype.pars
  * @return {string} The formatted number string.
  */
 gadgets.i18n.NumberFormat.prototype.format = function(number) {
-    if (isNaN(number)) {
-        return this.symbols_.NAN;
-    }
+  if (isNaN(number)) {
+    return this.symbols_.NAN;
+  }
 
-    var parts = [];
+  var parts = [];
 
   // in icu code, it is commented that certain computation need to keep the
-    // negative sign for 0.
-    var isNegative = number < 0.0 || number == 0.0 && 1 / number < 0.0;
+  // negative sign for 0.
+  var isNegative = number < 0.0 || number == 0.0 && 1 / number < 0.0;
 
-    parts.push(isNegative ? this.negativePrefix_ : this.positivePrefix_);
+  parts.push(isNegative ? this.negativePrefix_ : this.positivePrefix_);
 
-    if (!isFinite(number)) {
-        parts.push(this.symbols_.INFINITY);
-    } else {
-        // convert number to non-negative value
-        number *= isNegative ? -1 : 1;
+  if (!isFinite(number)) {
+    parts.push(this.symbols_.INFINITY);
+  } else {
+    // convert number to non-negative value
+    number *= isNegative ? -1 : 1;
 
-        number *= this.multiplier_;
-        this.useExponentialNotation_ ?
+    number *= this.multiplier_;
+    this.useExponentialNotation_ ?
         this.subformatExponential_(number, parts) :
         this.subformatFixed_(number, this.minimumIntegerDigits_, parts);
-    }
+  }
 
-    parts.push(isNegative ? this.negativeSuffix_ : this.positiveSuffix_);
+  parts.push(isNegative ? this.negativeSuffix_ : this.positiveSuffix_);
 
-    return parts.join('');
+  return parts.join('');
 };
 
 
@@ -284,65 +284,65 @@ gadgets.i18n.NumberFormat.prototype.form
 gadgets.i18n.NumberFormat.prototype.subformatFixed_ = function(number,
                                                                minIntDigits,
                                                                parts) {
-    // round the number
-    var power = Math.pow(10, this.maximumFractionDigits_);
-    number = Math.round(number * power);
-    var intValue = Math.floor(number / power);
-    var fracValue = Math.floor(number - intValue * power);
-
-    var fractionPresent = this.minimumFractionDigits_ > 0 || fracValue > 0;
-
-    var intPart = '';
-    var translatableInt = intValue;
-    while (translatableInt > 1E20) {
-        // here it goes beyond double precision, add '0' make it look better
-        intPart = '0' + intPart;
-        translatableInt = Math.round(translatableInt / 10);
-    }
-    intPart = translatableInt + intPart;
-
-    var decimal = this.isCurrencyFormat_ ? this.symbols_.MONETARY_SEP :
-                  this.symbols_.DECIMAL_SEP;
-    var grouping = this.isCurrencyFormat_ ? this.symbols_.MONETARY_GROUP_SEP :
-                   this.symbols_.GROUP_SEP;
-
-    var zeroCode = this.symbols_.ZERO_DIGIT.charCodeAt(0);
-    var digitLen = intPart.length;
-
-    if (intValue > 0 || minIntDigits > 0) {
-        for (var i = digitLen; i < minIntDigits; i++) {
-            parts.push(this.symbols_.ZERO_DIGIT);
-        }
-
-        for (var i = 0; i < digitLen; i++) {
-            parts.push(String.fromCharCode(zeroCode + intPart.charAt(i) * 1));
-
-            if (digitLen - i > 1 && this.groupingSize_ > 0 &&
-                ((digitLen - i) % this.groupingSize_ == 1)) {
-                parts.push(grouping);
-            }
-        }
-    } else if (!fractionPresent) {
-        // If there is no fraction present, and we haven't printed any
-        // integer digits, then print a zero.
-        parts.push(this.symbols_.ZERO_DIGIT);
-    }
+  // round the number
+  var power = Math.pow(10, this.maximumFractionDigits_);
+  number = Math.round(number * power);
+  var intValue = Math.floor(number / power);
+  var fracValue = Math.floor(number - intValue * power);
+
+  var fractionPresent = this.minimumFractionDigits_ > 0 || fracValue > 0;
+
+  var intPart = '';
+  var translatableInt = intValue;
+  while (translatableInt > 1E20) {
+    // here it goes beyond double precision, add '0' make it look better
+    intPart = '0' + intPart;
+    translatableInt = Math.round(translatableInt / 10);
+  }
+  intPart = translatableInt + intPart;
+
+  var decimal = this.isCurrencyFormat_ ? this.symbols_.MONETARY_SEP :
+      this.symbols_.DECIMAL_SEP;
+  var grouping = this.isCurrencyFormat_ ? this.symbols_.MONETARY_GROUP_SEP :
+      this.symbols_.GROUP_SEP;
+
+  var zeroCode = this.symbols_.ZERO_DIGIT.charCodeAt(0);
+  var digitLen = intPart.length;
+
+  if (intValue > 0 || minIntDigits > 0) {
+    for (var i = digitLen; i < minIntDigits; i++) {
+      parts.push(this.symbols_.ZERO_DIGIT);
+    }
+
+    for (var i = 0; i < digitLen; i++) {
+      parts.push(String.fromCharCode(zeroCode + intPart.charAt(i) * 1));
+
+      if (digitLen - i > 1 && this.groupingSize_ > 0 &&
+          ((digitLen - i) % this.groupingSize_ == 1)) {
+        parts.push(grouping);
+      }
+    }
+  } else if (!fractionPresent) {
+    // If there is no fraction present, and we haven't printed any
+    // integer digits, then print a zero.
+    parts.push(this.symbols_.ZERO_DIGIT);
+  }
 
   // Output the decimal separator if we always do so.
-    if (this.decimalSeparatorAlwaysShown_ || fractionPresent) {
-        parts.push(decimal);
-    }
-
-    var fracPart = '' + (fracValue + power);
-    var fracLen = fracPart.length;
-    while (fracPart.charAt(fracLen - 1) == '0' &&
-           fracLen > this.minimumFractionDigits_ + 1) {
-        fracLen--;
-    }
-
-    for (var i = 1; i < fracLen; i++) {
-        parts.push(String.fromCharCode(zeroCode + fracPart.charAt(i) * 1));
-    }
+  if (this.decimalSeparatorAlwaysShown_ || fractionPresent) {
+    parts.push(decimal);
+  }
+
+  var fracPart = '' + (fracValue + power);
+  var fracLen = fracPart.length;
+  while (fracPart.charAt(fracLen - 1) == '0' &&
+      fracLen > this.minimumFractionDigits_ + 1) {
+    fracLen--;
+  }
+
+  for (var i = 1; i < fracLen; i++) {
+    parts.push(String.fromCharCode(zeroCode + fracPart.charAt(i) * 1));
+  }
 };
 
 
@@ -356,18 +356,18 @@ gadgets.i18n.NumberFormat.prototype.subf
  */
 gadgets.i18n.NumberFormat.prototype.addExponentPart_ = function(exponent,
                                                                 parts) {
-    parts.push(this.symbols_.EXP_SYMBOL);
-
-    if (exponent < 0) {
-        exponent = -exponent;
-        parts.push(this.symbols_.MINUS_SIGN);
-    }
+  parts.push(this.symbols_.EXP_SYMBOL);
 
-    var exponentDigits = '' + exponent;
-    for (var i = exponentDigits.length; i < this.minExponentDigits_; i++) {
-        parts.push(this.symbols_.ZERO_DIGIT);
-    }
-    parts.push(exponentDigits);
+  if (exponent < 0) {
+    exponent = -exponent;
+    parts.push(this.symbols_.MINUS_SIGN);
+  }
+
+  var exponentDigits = '' + exponent;
+  for (var i = exponentDigits.length; i < this.minExponentDigits_; i++) {
+    parts.push(this.symbols_.ZERO_DIGIT);
+  }
+  parts.push(exponentDigits);
 };
 
 
@@ -381,40 +381,40 @@ gadgets.i18n.NumberFormat.prototype.addE
  */
 gadgets.i18n.NumberFormat.prototype.subformatExponential_ = function(number,
                                                                      parts) {
-    if (number == 0.0) {
-        this.subformatFixed_(number, this.minimumIntegerDigits_, parts);
-        this.addExponentPart_(0, parts);
-        return;
-    }
-
-    var exponent = Math.floor(Math.log(number) / Math.log(10));
-    number /= Math.pow(10, exponent);
-
-    var minIntDigits = this.minimumIntegerDigits_;
-    if (this.maximumIntegerDigits_ > 1 &&
-        this.maximumIntegerDigits_ > this.minimumIntegerDigits_) {
-        // A repeating range is defined; adjust to it as follows.
-        // If repeat == 3, we have 6,5,4=>3; 3,2,1=>0; 0,-1,-2=>-3;
-        // -3,-4,-5=>-6, etc. This takes into account that the
-        // exponent we have here is off by one from what we expect;
-        // it is for the format 0.MMMMMx10^n.
-        while ((exponent % this.maximumIntegerDigits_) != 0) {
-            number *= 10;
-            exponent--;
-        }
-        minIntDigits = 1;
+  if (number == 0.0) {
+    this.subformatFixed_(number, this.minimumIntegerDigits_, parts);
+    this.addExponentPart_(0, parts);
+    return;
+  }
+
+  var exponent = Math.floor(Math.log(number) / Math.log(10));
+  number /= Math.pow(10, exponent);
+
+  var minIntDigits = this.minimumIntegerDigits_;
+  if (this.maximumIntegerDigits_ > 1 &&
+      this.maximumIntegerDigits_ > this.minimumIntegerDigits_) {
+    // A repeating range is defined; adjust to it as follows.
+    // If repeat == 3, we have 6,5,4=>3; 3,2,1=>0; 0,-1,-2=>-3;
+    // -3,-4,-5=>-6, etc. This takes into account that the
+    // exponent we have here is off by one from what we expect;
+    // it is for the format 0.MMMMMx10^n.
+    while ((exponent % this.maximumIntegerDigits_) != 0) {
+      number *= 10;
+      exponent--;
+    }
+    minIntDigits = 1;
+  } else {
+    // No repeating range is defined; use minimum integer digits.
+    if (this.minimumIntegerDigits_ < 1) {
+      exponent++;
+      number /= 10;
     } else {
-        // No repeating range is defined; use minimum integer digits.
-        if (this.minimumIntegerDigits_ < 1) {
-            exponent++;
-            number /= 10;
-        } else {
-            exponent -= this.minimumIntegerDigits_ - 1;
-            number *= Math.pow(10, this.minimumIntegerDigits_ - 1);
-        }
+      exponent -= this.minimumIntegerDigits_ - 1;
+      number *= Math.pow(10, this.minimumIntegerDigits_ - 1);
     }
-    this.subformatFixed_(number, minIntDigits, parts);
-    this.addExponentPart_(exponent, parts);
+  }
+  this.subformatFixed_(number, minIntDigits, parts);
+  this.addExponentPart_(exponent, parts);
 };
 
 
@@ -427,14 +427,14 @@ gadgets.i18n.NumberFormat.prototype.subf
  * @private
  */
 gadgets.i18n.NumberFormat.prototype.getDigit_ = function(ch) {
-    var code = ch.charCodeAt(0);
+  var code = ch.charCodeAt(0);
   // between '0' to '9'
-    if (48 <= code && code < 58) {
-        return code - 48;
-    } else {
-        var zeroCode = this.symbols_.ZERO_DIGIT.charCodeAt(0);
-        return zeroCode <= code && code < zeroCode + 10 ? code - zeroCode : -1;
-    }
+  if (48 <= code && code < 58) {
+    return code - 48;
+  } else {
+    var zeroCode = this.symbols_.ZERO_DIGIT.charCodeAt(0);
+    return zeroCode <= code && code < zeroCode + 10 ? code - zeroCode : -1;
+  }
 };
 
 
@@ -541,65 +541,65 @@ gadgets.i18n.NumberFormat.QUOTE_ = '\'';
  * @private
  */
 gadgets.i18n.NumberFormat.prototype.parseAffix_ = function(pattern, pos) {
-    var affix = '';
-    var inQuote = false;
-    var len = pattern.length;
-
-    for (; pos[0] < len; pos[0]++) {
-        var ch = pattern.charAt(pos[0]);
-        if (ch == gadgets.i18n.NumberFormat.QUOTE_) {
-            if (pos[0] + 1 < len &&
-                pattern.charAt(pos[0] + 1) == gadgets.i18n.NumberFormat.QUOTE_) {
-                pos[0]++;
-                affix += '\''; // 'don''t'
-            } else {
-                inQuote = !inQuote;
-            }
-            continue;
-        }
+  var affix = '';
+  var inQuote = false;
+  var len = pattern.length;
+
+  for (; pos[0] < len; pos[0]++) {
+    var ch = pattern.charAt(pos[0]);
+    if (ch == gadgets.i18n.NumberFormat.QUOTE_) {
+      if (pos[0] + 1 < len &&
+          pattern.charAt(pos[0] + 1) == gadgets.i18n.NumberFormat.QUOTE_) {
+        pos[0]++;
+        affix += '\''; // 'don''t'
+      } else {
+        inQuote = !inQuote;
+      }
+      continue;
+    }
 
-        if (inQuote) {
-            affix += ch;
-        } else {
-            switch (ch) {
-                case gadgets.i18n.NumberFormat.PATTERN_DIGIT_:
-                case gadgets.i18n.NumberFormat.PATTERN_ZERO_DIGIT_:
-                case gadgets.i18n.NumberFormat.PATTERN_GROUPING_SEPARATOR_:
-                case gadgets.i18n.NumberFormat.PATTERN_DECIMAL_SEPARATOR_:
-                case gadgets.i18n.NumberFormat.PATTERN_SEPARATOR_:
-                    return affix;
-                case gadgets.i18n.NumberFormat.PATTERN_CURRENCY_SIGN_:
-                    this.isCurrencyFormat_ = true;
-                    if ((pos[0] + 1) < len &&
-                        pattern.charAt(pos[0] + 1) ==
-                        gadgets.i18n.NumberFormat.PATTERN_CURRENCY_SIGN_) {
-                        pos[0]++;
-                        affix += this.intlCurrencyCode_;
-                    } else {
-                        affix += this.currencySymbol_;
-                    }
-                    break;
-                case gadgets.i18n.NumberFormat.PATTERN_PERCENT_:
-                    if (this.multiplier_ != 1) {
-                        throw Error('Too many percent/permill');
-                    }
-                    this.multiplier_ = 100;
-                    affix += this.symbols_.PERCENT;
-                    break;
-                case gadgets.i18n.NumberFormat.PATTERN_PER_MILLE_:
-                    if (this.multiplier_ != 1) {
-                        throw Error('Too many percent/permill');
-                    }
-                    this.multiplier_ = 1000;
-                    affix += this.symbols_.PERMILL;
-                    break;
-                default:
-                    affix += ch;
-            }
-        }
+    if (inQuote) {
+      affix += ch;
+    } else {
+      switch (ch) {
+        case gadgets.i18n.NumberFormat.PATTERN_DIGIT_:
+        case gadgets.i18n.NumberFormat.PATTERN_ZERO_DIGIT_:
+        case gadgets.i18n.NumberFormat.PATTERN_GROUPING_SEPARATOR_:
+        case gadgets.i18n.NumberFormat.PATTERN_DECIMAL_SEPARATOR_:
+        case gadgets.i18n.NumberFormat.PATTERN_SEPARATOR_:
+          return affix;
+        case gadgets.i18n.NumberFormat.PATTERN_CURRENCY_SIGN_:
+          this.isCurrencyFormat_ = true;
+          if ((pos[0] + 1) < len &&
+              pattern.charAt(pos[0] + 1) ==
+              gadgets.i18n.NumberFormat.PATTERN_CURRENCY_SIGN_) {
+            pos[0]++;
+            affix += this.intlCurrencyCode_;
+          } else {
+            affix += this.currencySymbol_;
+          }
+          break;
+        case gadgets.i18n.NumberFormat.PATTERN_PERCENT_:
+          if (this.multiplier_ != 1) {
+            throw Error('Too many percent/permill');
+          }
+          this.multiplier_ = 100;
+          affix += this.symbols_.PERCENT;
+          break;
+        case gadgets.i18n.NumberFormat.PATTERN_PER_MILLE_:
+          if (this.multiplier_ != 1) {
+            throw Error('Too many percent/permill');
+          }
+          this.multiplier_ = 1000;
+          affix += this.symbols_.PERMILL;
+          break;
+        default:
+          affix += ch;
+      }
     }
+  }
 
-    return affix;
+  return affix;
 };
 
 
@@ -612,119 +612,119 @@ gadgets.i18n.NumberFormat.prototype.pars
  * @private
  */
 gadgets.i18n.NumberFormat.prototype.parseTrunk_ = function(pattern, pos) {
-    var decimalPos = -1;
-    var digitLeftCount = 0;
-    var zeroDigitCount = 0;
-    var digitRightCount = 0;
-    var groupingCount = -1;
-
-    var len = pattern.length;
-    for (var loop = true; pos[0] < len && loop; pos[0]++) {
-        var ch = pattern.charAt(pos[0]);
-        switch (ch) {
-            case gadgets.i18n.NumberFormat.PATTERN_DIGIT_:
-                if (zeroDigitCount > 0) {
-                    digitRightCount++;
-                } else {
-                    digitLeftCount++;
-                }
-                if (groupingCount >= 0 && decimalPos < 0) {
-                    groupingCount++;
-                }
-                break;
-            case gadgets.i18n.NumberFormat.PATTERN_ZERO_DIGIT_:
-                if (digitRightCount > 0) {
-                    throw Error('Unexpected "0" in pattern "' + pattern + '"');
-                }
-                zeroDigitCount++;
-                if (groupingCount >= 0 && decimalPos < 0) {
-                    groupingCount++;
-                }
-                break;
-            case gadgets.i18n.NumberFormat.PATTERN_GROUPING_SEPARATOR_:
-                groupingCount = 0;
-                break;
-            case gadgets.i18n.NumberFormat.PATTERN_DECIMAL_SEPARATOR_:
-                if (decimalPos >= 0) {
-                    throw Error('Multiple decimal separators in pattern "'
+  var decimalPos = -1;
+  var digitLeftCount = 0;
+  var zeroDigitCount = 0;
+  var digitRightCount = 0;
+  var groupingCount = -1;
+
+  var len = pattern.length;
+  for (var loop = true; pos[0] < len && loop; pos[0]++) {
+    var ch = pattern.charAt(pos[0]);
+    switch (ch) {
+      case gadgets.i18n.NumberFormat.PATTERN_DIGIT_:
+        if (zeroDigitCount > 0) {
+          digitRightCount++;
+        } else {
+          digitLeftCount++;
+        }
+        if (groupingCount >= 0 && decimalPos < 0) {
+          groupingCount++;
+        }
+        break;
+      case gadgets.i18n.NumberFormat.PATTERN_ZERO_DIGIT_:
+        if (digitRightCount > 0) {
+          throw Error('Unexpected "0" in pattern "' + pattern + '"');
+        }
+        zeroDigitCount++;
+        if (groupingCount >= 0 && decimalPos < 0) {
+          groupingCount++;
+        }
+        break;
+      case gadgets.i18n.NumberFormat.PATTERN_GROUPING_SEPARATOR_:
+        groupingCount = 0;
+        break;
+      case gadgets.i18n.NumberFormat.PATTERN_DECIMAL_SEPARATOR_:
+        if (decimalPos >= 0) {
+          throw Error('Multiple decimal separators in pattern "'
                             + pattern + '"');
-                }
-                decimalPos = digitLeftCount + zeroDigitCount + digitRightCount;
-                break;
-            case gadgets.i18n.NumberFormat.PATTERN_EXPONENT_:
-                if (this.useExponentialNotation_) {
-                    throw Error('Multiple exponential symbols in pattern "'
+        }
+        decimalPos = digitLeftCount + zeroDigitCount + digitRightCount;
+        break;
+      case gadgets.i18n.NumberFormat.PATTERN_EXPONENT_:
+        if (this.useExponentialNotation_) {
+          throw Error('Multiple exponential symbols in pattern "'
                             + pattern + '"');
-                }
-                this.useExponentialNotation_ = true;
-                this.minExponentDigits_ = 0;
-
-            // Use lookahead to parse out the exponential part
-            // of the pattern, then jump into phase 2.
-                while ((pos[0] + 1) < len && pattern.charAt(pos[0] + 1) ==
-                                             this.symbols_.ZERO_DIGIT.charAt(0)) {
-                    pos[0]++;
-                    this.minExponentDigits_++;
-                }
-
-                if ((digitLeftCount + zeroDigitCount) < 1 ||
-                    this.minExponentDigits_ < 1) {
-                    throw Error('Malformed exponential pattern "' + pattern + '"');
-                }
-                loop = false;
-                break;
-            default:
-                pos[0]--;
-                loop = false;
-                break;
         }
-    }
+        this.useExponentialNotation_ = true;
+        this.minExponentDigits_ = 0;
 
-    if (zeroDigitCount == 0 && digitLeftCount > 0 && decimalPos >= 0) {
-        // Handle '###.###' and '###.' and '.###'
-        var n = decimalPos;
-        if (n == 0) { // Handle '.###'
-            n++;
-        }
-        digitRightCount = digitLeftCount - n;
-        digitLeftCount = n - 1;
-        zeroDigitCount = 1;
-    }
+        // Use lookahead to parse out the exponential part
+        // of the pattern, then jump into phase 2.
+        while ((pos[0] + 1) < len && pattern.charAt(pos[0] + 1) ==
+            this.symbols_.ZERO_DIGIT.charAt(0)) {
+          pos[0]++;
+          this.minExponentDigits_++;
+        }
+
+        if ((digitLeftCount + zeroDigitCount) < 1 ||
+            this.minExponentDigits_ < 1) {
+          throw Error('Malformed exponential pattern "' + pattern + '"');
+        }
+        loop = false;
+        break;
+      default:
+        pos[0]--;
+        loop = false;
+        break;
+    }
+  }
+
+  if (zeroDigitCount == 0 && digitLeftCount > 0 && decimalPos >= 0) {
+    // Handle '###.###' and '###.' and '.###'
+    var n = decimalPos;
+    if (n == 0) { // Handle '.###'
+      n++;
+    }
+    digitRightCount = digitLeftCount - n;
+    digitLeftCount = n - 1;
+    zeroDigitCount = 1;
+  }
 
   // Do syntax checking on the digits.
-    if (decimalPos < 0 && digitRightCount > 0 ||
-        decimalPos >= 0 && (decimalPos < digitLeftCount ||
-                            decimalPos > digitLeftCount + zeroDigitCount) ||
-        groupingCount == 0) {
-        throw Error('Malformed pattern "' + pattern + '"');
-    }
-    var totalDigits = digitLeftCount + zeroDigitCount + digitRightCount;
-
-    this.maximumFractionDigits_ = decimalPos >= 0 ? totalDigits - decimalPos : 0;
-    if (decimalPos >= 0) {
-        this.minimumFractionDigits_ = digitLeftCount + zeroDigitCount - decimalPos;
-        if (this.minimumFractionDigits_ < 0) {
-            this.minimumFractionDigits_ = 0;
-        }
+  if (decimalPos < 0 && digitRightCount > 0 ||
+      decimalPos >= 0 && (decimalPos < digitLeftCount ||
+      decimalPos > digitLeftCount + zeroDigitCount) ||
+      groupingCount == 0) {
+    throw Error('Malformed pattern "' + pattern + '"');
+  }
+  var totalDigits = digitLeftCount + zeroDigitCount + digitRightCount;
+
+  this.maximumFractionDigits_ = decimalPos >= 0 ? totalDigits - decimalPos : 0;
+  if (decimalPos >= 0) {
+    this.minimumFractionDigits_ = digitLeftCount + zeroDigitCount - decimalPos;
+    if (this.minimumFractionDigits_ < 0) {
+      this.minimumFractionDigits_ = 0;
     }
+  }
 
   // The effectiveDecimalPos is the position the decimal is at or would be at
-    // if there is no decimal. Note that if decimalPos<0, then digitTotalCount ==
-    // digitLeftCount + zeroDigitCount.
-    var effectiveDecimalPos = decimalPos >= 0 ? decimalPos : totalDigits;
-    this.minimumIntegerDigits_ = effectiveDecimalPos - digitLeftCount;
-    if (this.useExponentialNotation_) {
-        this.maximumIntegerDigits_ = digitLeftCount + this.minimumIntegerDigits_;
+  // if there is no decimal. Note that if decimalPos<0, then digitTotalCount ==
+  // digitLeftCount + zeroDigitCount.
+  var effectiveDecimalPos = decimalPos >= 0 ? decimalPos : totalDigits;
+  this.minimumIntegerDigits_ = effectiveDecimalPos - digitLeftCount;
+  if (this.useExponentialNotation_) {
+    this.maximumIntegerDigits_ = digitLeftCount + this.minimumIntegerDigits_;
 
     // in exponential display, we need to at least show something.
-        if (this.maximumFractionDigits_ == 0 && this.minimumIntegerDigits_ == 0) {
-            this.minimumIntegerDigits_ = 1;
-        }
+    if (this.maximumFractionDigits_ == 0 && this.minimumIntegerDigits_ == 0) {
+      this.minimumIntegerDigits_ = 1;
     }
+  }
 
-    this.groupingSize_ = Math.max(0, groupingCount);
-    this.decimalSeparatorAlwaysShown_ = decimalPos == 0 ||
-                                        decimalPos == totalDigits;
+  this.groupingSize_ = Math.max(0, groupingCount);
+  this.decimalSeparatorAlwaysShown_ = decimalPos == 0 ||
+      decimalPos == totalDigits;
 };
 
 
@@ -735,21 +735,21 @@ gadgets.i18n.NumberFormat.prototype.pars
  * @private
  */
 gadgets.i18n.NumberFormat.prototype.parsePattern_ = function(pattern) {
-    var pos = [0];
+  var pos = [0];
 
-    this.positivePrefix_ = this.parseAffix_(pattern, pos);
-    var trunkStart = pos[0];
-    this.parseTrunk_(pattern, pos);
-    var trunkLen = pos[0] - trunkStart;
-    this.positiveSuffix_ = this.parseAffix_(pattern, pos);
-
-    if (pos[0] < pattern.length &&
-        pattern.charAt(pos[0]) == gadgets.i18n.NumberFormat.PATTERN_SEPARATOR_) {
-        pos[0]++;
-        this.negativePrefix_ = this.parseAffix_(pattern, pos);
+  this.positivePrefix_ = this.parseAffix_(pattern, pos);
+  var trunkStart = pos[0];
+  this.parseTrunk_(pattern, pos);
+  var trunkLen = pos[0] - trunkStart;
+  this.positiveSuffix_ = this.parseAffix_(pattern, pos);
+
+  if (pos[0] < pattern.length &&
+      pattern.charAt(pos[0]) == gadgets.i18n.NumberFormat.PATTERN_SEPARATOR_) {
+    pos[0]++;
+    this.negativePrefix_ = this.parseAffix_(pattern, pos);
     // we assume this part is identical to positive part.
-        // user must make sure the pattern is correctly constructed.
-        pos[0] += trunkLen;
-        this.negativeSuffix_ = this.parseAffix_(pattern, pos);
-    }
+    // user must make sure the pattern is correctly constructed.
+    pos[0] += trunkLen;
+    this.negativeSuffix_ = this.parseAffix_(pattern, pos);
+  }
 };