is.js 4.4 KB

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:
  94. 'sunnudagur_mánudagur_þriðjudagur_miðvikudagur_fimmtudagur_föstudagur_laugardagur'.split(
  95. '_'
  96. ),
  97. weekdaysShort: 'sun_mán_þri_mið_fim_fös_lau'.split('_'),
  98. weekdaysMin: 'Su_Má_Þr_Mi_Fi_Fö_La'.split('_'),
  99. longDateFormat: {
  100. LT: 'H:mm',
  101. LTS: 'H:mm:ss',
  102. L: 'DD.MM.YYYY',
  103. LL: 'D. MMMM YYYY',
  104. LLL: 'D. MMMM YYYY [kl.] H:mm',
  105. LLLL: 'dddd, D. MMMM YYYY [kl.] H:mm',
  106. },
  107. calendar: {
  108. sameDay: '[í dag kl.] LT',
  109. nextDay: '[á morgun kl.] LT',
  110. nextWeek: 'dddd [kl.] LT',
  111. lastDay: '[í gær kl.] LT',
  112. lastWeek: '[síðasta] dddd [kl.] LT',
  113. sameElse: 'L',
  114. },
  115. relativeTime: {
  116. future: 'eftir %s',
  117. past: 'fyrir %s síðan',
  118. s: translate,
  119. ss: translate,
  120. m: translate,
  121. mm: translate,
  122. h: 'klukkustund',
  123. hh: translate,
  124. d: translate,
  125. dd: translate,
  126. M: translate,
  127. MM: translate,
  128. y: translate,
  129. yy: translate,
  130. },
  131. dayOfMonthOrdinalParse: /\d{1,2}\./,
  132. ordinal: '%d.',
  133. week: {
  134. dow: 1, // Monday is the first day of the week.
  135. doy: 4, // The week that contains Jan 4th is the first week of the year.
  136. },
  137. });