is.js 4.4 KB

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