/packages/jquery-globalize.0.1.0/Content/Scripts/jquery.globalize/cultures/globalize.culture.dv.js

https://bitbucket.org/chief7/asp.net-mvc-3-localization-issue · JavaScript · 164 lines · 129 code · 5 blank · 30 comment · 14 complexity · 5ce0de87692c085588faea8df891e2fc MD5 · raw file

  1. /*
  2. * Globalize Culture dv
  3. *
  4. * http://github.com/jquery/globalize
  5. *
  6. * Copyright Software Freedom Conservancy, Inc.
  7. * Dual licensed under the MIT or GPL Version 2 licenses.
  8. * http://jquery.org/license
  9. *
  10. * This file was generated by the Globalize Culture Generator
  11. * Translation: bugs found in this file need to be fixed in the generator
  12. */
  13. (function( window, undefined ) {
  14. var Globalize;
  15. if ( typeof require !== "undefined"
  16. && typeof exports !== "undefined"
  17. && typeof module !== "undefined" ) {
  18. // Assume CommonJS
  19. Globalize = require( "globalize" );
  20. } else {
  21. // Global variable
  22. Globalize = window.Globalize;
  23. }
  24. Globalize.addCultureInfo( "dv", "default", {
  25. name: "dv",
  26. englishName: "Divehi",
  27. nativeName: "ދިވެހިބަސް",
  28. language: "dv",
  29. isRTL: true,
  30. numberFormat: {
  31. currency: {
  32. pattern: ["n $-","n $"],
  33. symbol: "ރ."
  34. }
  35. },
  36. calendars: {
  37. standard: {
  38. name: "Hijri",
  39. days: {
  40. names: ["އާދީއްތަ","ހޯމަ","އަންގާރަ","ބުދަ","ބުރާސްފަތި","ހުކުރު","ހޮނިހިރު"],
  41. namesAbbr: ["އާދީއްތަ","ހޯމަ","އަންގާރަ","ބުދަ","ބުރާސްފަތި","ހުކުރު","ހޮނިހިރު"],
  42. namesShort: ["އާ","ހޯ","އަ","ބު","ބު","ހު","ހޮ"]
  43. },
  44. months: {
  45. names: ["މުޙައްރަމް","ޞަފަރު","ރަބީޢުލްއައްވަލް","ރަބީޢުލްއާޚިރު","ޖުމާދަލްއޫލާ","ޖުމާދަލްއާޚިރާ","ރަޖަބް","ޝަޢްބާން","ރަމަޟާން","ޝައްވާލް","ޛުލްޤަޢިދާ","ޛުލްޙިއްޖާ",""],
  46. namesAbbr: ["މުޙައްރަމް","ޞަފަރު","ރަބީޢުލްއައްވަލް","ރަބީޢުލްއާޚިރު","ޖުމާދަލްއޫލާ","ޖުމާދަލްއާޚިރާ","ރަޖަބް","ޝަޢްބާން","ރަމަޟާން","ޝައްވާލް","ޛުލްޤަޢިދާ","ޛުލްޙިއްޖާ",""]
  47. },
  48. AM: ["މކ","މކ","މކ"],
  49. PM: ["މފ","މފ","މފ"],
  50. eras: [{"name":"بعد الهجرة","start":null,"offset":0}],
  51. twoDigitYearMax: 1451,
  52. patterns: {
  53. d: "dd/MM/yy",
  54. D: "dd/MM/yyyy",
  55. t: "HH:mm",
  56. T: "HH:mm:ss",
  57. f: "dd/MM/yyyy HH:mm",
  58. F: "dd/MM/yyyy HH:mm:ss",
  59. M: "dd MMMM"
  60. },
  61. convert: {
  62. // Adapted to Script from System.Globalization.HijriCalendar
  63. ticks1970: 62135596800000,
  64. // number of days leading up to each month
  65. monthDays: [0, 30, 59, 89, 118, 148, 177, 207, 236, 266, 295, 325, 355],
  66. minDate: -42521673600000,
  67. maxDate: 253402300799999,
  68. // The number of days to add or subtract from the calendar to accommodate the variances
  69. // in the start and the end of Ramadan and to accommodate the date difference between
  70. // countries/regions. May be dynamically adjusted based on user preference, but should
  71. // remain in the range of -2 to 2, inclusive.
  72. hijriAdjustment: 0,
  73. toGregorian: function(hyear, hmonth, hday) {
  74. var daysSinceJan0101 = this.daysToYear(hyear) + this.monthDays[hmonth] + hday - 1 - this.hijriAdjustment;
  75. // 86400000 = ticks per day
  76. var gdate = new Date(daysSinceJan0101 * 86400000 - this.ticks1970);
  77. // adjust for timezone, because we are interested in the gregorian date for the same timezone
  78. // but ticks in javascript is always from GMT, unlike the server were ticks counts from the base
  79. // date in the current timezone.
  80. gdate.setMinutes(gdate.getMinutes() + gdate.getTimezoneOffset());
  81. return gdate;
  82. },
  83. fromGregorian: function(gdate) {
  84. if ((gdate < this.minDate) || (gdate > this.maxDate)) return null;
  85. var ticks = this.ticks1970 + (gdate-0) - gdate.getTimezoneOffset() * 60000,
  86. daysSinceJan0101 = Math.floor(ticks / 86400000) + 1 + this.hijriAdjustment;
  87. // very particular formula determined by someone smart, adapted from the server-side implementation.
  88. // it approximates the hijri year.
  89. var hday, hmonth, hyear = Math.floor(((daysSinceJan0101 - 227013) * 30) / 10631) + 1,
  90. absDays = this.daysToYear(hyear),
  91. daysInYear = this.isLeapYear(hyear) ? 355 : 354;
  92. // hyear is just approximate, it may need adjustment up or down by 1.
  93. if (daysSinceJan0101 < absDays) {
  94. hyear--;
  95. absDays -= daysInYear;
  96. }
  97. else if (daysSinceJan0101 === absDays) {
  98. hyear--;
  99. absDays = this.daysToYear(hyear);
  100. }
  101. else {
  102. if (daysSinceJan0101 > (absDays + daysInYear)) {
  103. absDays += daysInYear;
  104. hyear++;
  105. }
  106. }
  107. // determine month by looking at how many days into the hyear we are
  108. // monthDays contains the number of days up to each month.
  109. hmonth = 0;
  110. var daysIntoYear = daysSinceJan0101 - absDays;
  111. while (hmonth <= 11 && daysIntoYear > this.monthDays[hmonth]) {
  112. hmonth++;
  113. }
  114. hmonth--;
  115. hday = daysIntoYear - this.monthDays[hmonth];
  116. return [hyear, hmonth, hday];
  117. },
  118. daysToYear: function(year) {
  119. // calculates how many days since Jan 1, 0001
  120. var yearsToYear30 = Math.floor((year - 1) / 30) * 30,
  121. yearsInto30 = year - yearsToYear30 - 1,
  122. days = Math.floor((yearsToYear30 * 10631) / 30) + 227013;
  123. while (yearsInto30 > 0) {
  124. days += (this.isLeapYear(yearsInto30) ? 355 : 354);
  125. yearsInto30--;
  126. }
  127. return days;
  128. },
  129. isLeapYear: function(year) {
  130. return ((((year * 11) + 14) % 30) < 11);
  131. }
  132. }
  133. },
  134. Gregorian_Localized: {
  135. days: {
  136. names: ["އާދީއްތަ","ހޯމަ","އަންގާރަ","ބުދަ","ބުރާސްފަތި","ހުކުރު","ހޮނިހިރު"],
  137. namesAbbr: ["އާދީއްތަ","ހޯމަ","އަންގާރަ","ބުދަ","ބުރާސްފަތި","ހުކުރު","ހޮނިހިރު"],
  138. namesShort: ["އާ","ހޯ","އަ","ބު","ބު","ހު","ހޮ"]
  139. },
  140. months: {
  141. names: ["ޖަނަވަރީ","ފެބްރުއަރީ","މާޗް","އޭޕްރިލް","މެއި","ޖޫން","ޖުލައި","އޯގަސްޓް","ސެޕްޓެމްބަރ","އޮކްޓޯބަރ","ނޮވެމްބަރ","ޑިސެމްބަރ",""],
  142. namesAbbr: ["ޖަނަވަރީ","ފެބްރުއަރީ","މާޗް","އޭޕްރިލް","މެއި","ޖޫން","ޖުލައި","އޯގަސްޓް","ސެޕްޓެމްބަރ","އޮކްޓޯބަރ","ނޮވެމްބަރ","ޑިސެމްބަރ",""]
  143. },
  144. AM: ["މކ","މކ","މކ"],
  145. PM: ["މފ","މފ","މފ"],
  146. eras: [{"name":"މީލާދީ","start":null,"offset":0}],
  147. patterns: {
  148. d: "dd/MM/yy",
  149. D: "ddd, yyyy MMMM dd",
  150. t: "HH:mm",
  151. T: "HH:mm:ss",
  152. f: "ddd, yyyy MMMM dd HH:mm",
  153. F: "ddd, yyyy MMMM dd HH:mm:ss",
  154. Y: "yyyy, MMMM"
  155. }
  156. }
  157. }
  158. });
  159. }( this ));