is.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. // moment.js language configuration
  2. // language : icelandic (is)
  3. // author : Hinrik Örn Sigurðsson : https://github.com/hinrik
  4. (function (factory) {
  5. if (typeof define === 'function' && define.amd) {
  6. define(['moment'], factory); // AMD
  7. } else if (typeof exports === 'object') {
  8. module.exports = factory(require('../moment')); // Node
  9. } else {
  10. factory(window.moment); // Browser global
  11. }
  12. }(function (moment) {
  13. function plural(n) {
  14. if (n % 100 === 11) {
  15. return true;
  16. } else if (n % 10 === 1) {
  17. return false;
  18. }
  19. return true;
  20. }
  21. function translate(number, withoutSuffix, key, isFuture) {
  22. var result = number + " ";
  23. switch (key) {
  24. case 's':
  25. return withoutSuffix || isFuture ? 'nokkrar sekúndur' : 'nokkrum sekúndum';
  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. return moment.lang('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. L : "DD/MM/YYYY",
  88. LL : "D. MMMM YYYY",
  89. LLL : "D. MMMM YYYY [kl.] LT",
  90. LLLL : "dddd, D. MMMM YYYY [kl.] LT"
  91. },
  92. calendar : {
  93. sameDay : '[í dag kl.] LT',
  94. nextDay : '[á morgun kl.] LT',
  95. nextWeek : 'dddd [kl.] LT',
  96. lastDay : '[í gær kl.] LT',
  97. lastWeek : '[síðasta] dddd [kl.] LT',
  98. sameElse : 'L'
  99. },
  100. relativeTime : {
  101. future : "eftir %s",
  102. past : "fyrir %s síðan",
  103. s : translate,
  104. m : translate,
  105. mm : translate,
  106. h : "klukkustund",
  107. hh : translate,
  108. d : translate,
  109. dd : translate,
  110. M : translate,
  111. MM : translate,
  112. y : translate,
  113. yy : translate
  114. },
  115. ordinal : '%d.',
  116. week : {
  117. dow : 1, // Monday is the first day of the week.
  118. doy : 4 // The week that contains Jan 4th is the first week of the year.
  119. }
  120. });
  121. }));