is.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. //! moment.js locale configuration
  2. ;(function (global, factory) {
  3. typeof exports === 'object' && typeof module !== 'undefined'
  4. && typeof require === 'function' ? factory(require('../moment')) :
  5. typeof define === 'function' && define.amd ? define(['../moment'], factory) :
  6. factory(global.moment)
  7. }(this, (function (moment) { 'use strict';
  8. function plural(n) {
  9. if (n % 100 === 11) {
  10. return true;
  11. } else if (n % 10 === 1) {
  12. return false;
  13. }
  14. return true;
  15. }
  16. function translate(number, withoutSuffix, key, isFuture) {
  17. var result = number + ' ';
  18. switch (key) {
  19. case 's':
  20. return withoutSuffix || isFuture ? 'nokkrar sekúndur' : 'nokkrum sekúndum';
  21. case 'ss':
  22. if (plural(number)) {
  23. return result + (withoutSuffix || isFuture ? 'sekúndur' : 'sekúndum');
  24. }
  25. return result + 'sekúnda';
  26. case 'm':
  27. return withoutSuffix ? 'mínúta' : 'mínútu';
  28. case 'mm':
  29. if (plural(number)) {
  30. return result + (withoutSuffix || isFuture ? 'mínútur' : 'mínútum');
  31. } else if (withoutSuffix) {
  32. return result + 'mínúta';
  33. }
  34. return result + 'mínútu';
  35. case 'hh':
  36. if (plural(number)) {
  37. return result + (withoutSuffix || isFuture ? 'klukkustundir' : 'klukkustundum');
  38. }
  39. return result + 'klukkustund';
  40. case 'd':
  41. if (withoutSuffix) {
  42. return 'dagur';
  43. }
  44. return isFuture ? 'dag' : 'degi';
  45. case 'dd':
  46. if (plural(number)) {
  47. if (withoutSuffix) {
  48. return result + 'dagar';
  49. }
  50. return result + (isFuture ? 'daga' : 'dögum');
  51. } else if (withoutSuffix) {
  52. return result + 'dagur';
  53. }
  54. return result + (isFuture ? 'dag' : 'degi');
  55. case 'M':
  56. if (withoutSuffix) {
  57. return 'mánuður';
  58. }
  59. return isFuture ? 'mánuð' : 'mánuði';
  60. case 'MM':
  61. if (plural(number)) {
  62. if (withoutSuffix) {
  63. return result + 'mánuðir';
  64. }
  65. return result + (isFuture ? 'mánuði' : 'mánuðum');
  66. } else if (withoutSuffix) {
  67. return result + 'mánuður';
  68. }
  69. return result + (isFuture ? 'mánuð' : 'mánuði');
  70. case 'y':
  71. return withoutSuffix || isFuture ? 'ár' : 'ári';
  72. case 'yy':
  73. if (plural(number)) {
  74. return result + (withoutSuffix || isFuture ? 'ár' : 'árum');
  75. }
  76. return result + (withoutSuffix || isFuture ? 'ár' : 'ári');
  77. }
  78. }
  79. var is = moment.defineLocale('is', {
  80. months : 'janúar_febrúar_mars_apríl_maí_júní_júlí_ágúst_september_október_nóvember_desember'.split('_'),
  81. monthsShort : 'jan_feb_mar_apr_maí_jún_júl_ágú_sep_okt_nóv_des'.split('_'),
  82. weekdays : 'sunnudagur_mánudagur_þriðjudagur_miðvikudagur_fimmtudagur_föstudagur_laugardagur'.split('_'),
  83. weekdaysShort : 'sun_mán_þri_mið_fim_fös_lau'.split('_'),
  84. weekdaysMin : 'Su_Má_Þr_Mi_Fi_Fö_La'.split('_'),
  85. longDateFormat : {
  86. LT : 'H:mm',
  87. LTS : 'H:mm:ss',
  88. L : 'DD.MM.YYYY',
  89. LL : 'D. MMMM YYYY',
  90. LLL : 'D. MMMM YYYY [kl.] H:mm',
  91. LLLL : 'dddd, D. MMMM YYYY [kl.] H:mm'
  92. },
  93. calendar : {
  94. sameDay : '[í dag kl.] LT',
  95. nextDay : '[á morgun kl.] LT',
  96. nextWeek : 'dddd [kl.] LT',
  97. lastDay : '[í gær kl.] LT',
  98. lastWeek : '[síðasta] dddd [kl.] LT',
  99. sameElse : 'L'
  100. },
  101. relativeTime : {
  102. future : 'eftir %s',
  103. past : 'fyrir %s síðan',
  104. s : translate,
  105. ss : translate,
  106. m : translate,
  107. mm : translate,
  108. h : 'klukkustund',
  109. hh : translate,
  110. d : translate,
  111. dd : translate,
  112. M : translate,
  113. MM : translate,
  114. y : translate,
  115. yy : translate
  116. },
  117. dayOfMonthOrdinalParse: /\d{1,2}\./,
  118. ordinal : '%d.',
  119. week : {
  120. dow : 1, // Monday is the first day of the week.
  121. doy : 4 // The week that contains Jan 4th is the first week of the year.
  122. }
  123. });
  124. return is;
  125. })));