sk.js 5.7 KB

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