sk.js 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. // moment.js language configuration
  2. // language : slovak (sk)
  3. // author : Martin Minka : https://github.com/k2s
  4. // based on work of petrbela : https://github.com/petrbela
  5. (function (factory) {
  6. if (typeof define === 'function' && define.amd) {
  7. define(['moment'], factory); // AMD
  8. } else if (typeof exports === 'object') {
  9. module.exports = factory(require('../moment')); // Node
  10. } else {
  11. factory(window.moment); // Browser global
  12. }
  13. }(function (moment) {
  14. var months = "január_február_marec_apríl_máj_jún_júl_august_september_október_november_december".split("_"),
  15. monthsShort = "jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec".split("_");
  16. function plural(n) {
  17. return (n > 1) && (n < 5);
  18. }
  19. function translate(number, withoutSuffix, key, isFuture) {
  20. var result = number + " ";
  21. switch (key) {
  22. case 's': // a few seconds / in a few seconds / a few seconds ago
  23. return (withoutSuffix || isFuture) ? 'pár sekúnd' : 'pár sekundami';
  24. case 'm': // a minute / in a minute / a minute ago
  25. return withoutSuffix ? 'minúta' : (isFuture ? 'minútu' : 'minútou');
  26. case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago
  27. if (withoutSuffix || isFuture) {
  28. return result + (plural(number) ? 'minúty' : 'minút');
  29. } else {
  30. return result + 'minútami';
  31. }
  32. break;
  33. case 'h': // an hour / in an hour / an hour ago
  34. return withoutSuffix ? 'hodina' : (isFuture ? 'hodinu' : 'hodinou');
  35. case 'hh': // 9 hours / in 9 hours / 9 hours ago
  36. if (withoutSuffix || isFuture) {
  37. return result + (plural(number) ? 'hodiny' : 'hodín');
  38. } else {
  39. return result + 'hodinami';
  40. }
  41. break;
  42. case 'd': // a day / in a day / a day ago
  43. return (withoutSuffix || isFuture) ? 'deň' : 'dňom';
  44. case 'dd': // 9 days / in 9 days / 9 days ago
  45. if (withoutSuffix || isFuture) {
  46. return result + (plural(number) ? 'dni' : 'dní');
  47. } else {
  48. return result + 'dňami';
  49. }
  50. break;
  51. case 'M': // a month / in a month / a month ago
  52. return (withoutSuffix || isFuture) ? 'mesiac' : 'mesiacom';
  53. case 'MM': // 9 months / in 9 months / 9 months ago
  54. if (withoutSuffix || isFuture) {
  55. return result + (plural(number) ? 'mesiace' : 'mesiacov');
  56. } else {
  57. return result + 'mesiacmi';
  58. }
  59. break;
  60. case 'y': // a year / in a year / a year ago
  61. return (withoutSuffix || isFuture) ? 'rok' : 'rokom';
  62. case 'yy': // 9 years / in 9 years / 9 years ago
  63. if (withoutSuffix || isFuture) {
  64. return result + (plural(number) ? 'roky' : 'rokov');
  65. } else {
  66. return result + 'rokmi';
  67. }
  68. break;
  69. }
  70. }
  71. return moment.lang('sk', {
  72. months : months,
  73. monthsShort : monthsShort,
  74. monthsParse : (function (months, monthsShort) {
  75. var i, _monthsParse = [];
  76. for (i = 0; i < 12; i++) {
  77. // use custom parser to solve problem with July (červenec)
  78. _monthsParse[i] = new RegExp('^' + months[i] + '$|^' + monthsShort[i] + '$', 'i');
  79. }
  80. return _monthsParse;
  81. }(months, monthsShort)),
  82. weekdays : "nedeľa_pondelok_utorok_streda_štvrtok_piatok_sobota".split("_"),
  83. weekdaysShort : "ne_po_ut_st_št_pi_so".split("_"),
  84. weekdaysMin : "ne_po_ut_st_št_pi_so".split("_"),
  85. longDateFormat : {
  86. LT: "H:mm",
  87. L : "DD.MM.YYYY",
  88. LL : "D. MMMM YYYY",
  89. LLL : "D. MMMM YYYY LT",
  90. LLLL : "dddd D. MMMM YYYY LT"
  91. },
  92. calendar : {
  93. sameDay: "[dnes o] LT",
  94. nextDay: '[zajtra o] LT',
  95. nextWeek: function () {
  96. switch (this.day()) {
  97. case 0:
  98. return '[v nedeľu o] LT';
  99. case 1:
  100. case 2:
  101. return '[v] dddd [o] LT';
  102. case 3:
  103. return '[v stredu o] LT';
  104. case 4:
  105. return '[vo štvrtok o] LT';
  106. case 5:
  107. return '[v piatok o] LT';
  108. case 6:
  109. return '[v sobotu o] LT';
  110. }
  111. },
  112. lastDay: '[včera o] LT',
  113. lastWeek: function () {
  114. switch (this.day()) {
  115. case 0:
  116. return '[minulú nedeľu o] LT';
  117. case 1:
  118. case 2:
  119. return '[minulý] dddd [o] LT';
  120. case 3:
  121. return '[minulú stredu o] LT';
  122. case 4:
  123. case 5:
  124. return '[minulý] dddd [o] LT';
  125. case 6:
  126. return '[minulú sobotu o] LT';
  127. }
  128. },
  129. sameElse: "L"
  130. },
  131. relativeTime : {
  132. future : "za %s",
  133. past : "pred %s",
  134. s : translate,
  135. m : translate,
  136. mm : translate,
  137. h : translate,
  138. hh : translate,
  139. d : translate,
  140. dd : translate,
  141. M : translate,
  142. MM : translate,
  143. y : translate,
  144. yy : translate
  145. },
  146. ordinal : '%d.',
  147. week : {
  148. dow : 1, // Monday is the first day of the week.
  149. doy : 4 // The week that contains Jan 4th is the first week of the year.
  150. }
  151. });
  152. }));