is.js 4.3KB

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