is.js 4.4 KB

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