sk.js 5.4 KB

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