sk.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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. import moment from '../moment';
  6. var months =
  7. 'január_február_marec_apríl_máj_jún_júl_august_september_október_november_december'.split(
  8. '_'
  9. ),
  10. monthsShort = 'jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec'.split('_');
  11. function plural(n) {
  12. return n > 1 && n < 5;
  13. }
  14. function translate(number, withoutSuffix, key, isFuture) {
  15. var result = number + ' ';
  16. switch (key) {
  17. case 's': // a few seconds / in a few seconds / a few seconds ago
  18. return withoutSuffix || isFuture ? 'pár sekúnd' : 'pár sekundami';
  19. case 'ss': // 9 seconds / in 9 seconds / 9 seconds ago
  20. if (withoutSuffix || isFuture) {
  21. return result + (plural(number) ? 'sekundy' : 'sekúnd');
  22. } else {
  23. return result + 'sekundami';
  24. }
  25. case 'm': // a minute / in a minute / a minute ago
  26. return withoutSuffix ? 'minúta' : isFuture ? 'minútu' : 'minútou';
  27. case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago
  28. if (withoutSuffix || isFuture) {
  29. return result + (plural(number) ? 'minúty' : 'minút');
  30. } else {
  31. return result + 'minútami';
  32. }
  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. case 'd': // a day / in a day / a day ago
  42. return withoutSuffix || isFuture ? 'deň' : 'dňom';
  43. case 'dd': // 9 days / in 9 days / 9 days ago
  44. if (withoutSuffix || isFuture) {
  45. return result + (plural(number) ? 'dni' : 'dní');
  46. } else {
  47. return result + 'dňami';
  48. }
  49. case 'M': // a month / in a month / a month ago
  50. return withoutSuffix || isFuture ? 'mesiac' : 'mesiacom';
  51. case 'MM': // 9 months / in 9 months / 9 months ago
  52. if (withoutSuffix || isFuture) {
  53. return result + (plural(number) ? 'mesiace' : 'mesiacov');
  54. } else {
  55. return result + 'mesiacmi';
  56. }
  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. }
  66. }
  67. export default moment.defineLocale('sk', {
  68. months: months,
  69. monthsShort: monthsShort,
  70. weekdays: 'nedeľa_pondelok_utorok_streda_štvrtok_piatok_sobota'.split('_'),
  71. weekdaysShort: 'ne_po_ut_st_št_pi_so'.split('_'),
  72. weekdaysMin: 'ne_po_ut_st_št_pi_so'.split('_'),
  73. longDateFormat: {
  74. LT: 'H:mm',
  75. LTS: 'H:mm:ss',
  76. L: 'DD.MM.YYYY',
  77. LL: 'D. MMMM YYYY',
  78. LLL: 'D. MMMM YYYY H:mm',
  79. LLLL: 'dddd D. MMMM YYYY H:mm',
  80. },
  81. calendar: {
  82. sameDay: '[dnes o] LT',
  83. nextDay: '[zajtra o] LT',
  84. nextWeek: function () {
  85. switch (this.day()) {
  86. case 0:
  87. return '[v nedeľu o] LT';
  88. case 1:
  89. case 2:
  90. return '[v] dddd [o] LT';
  91. case 3:
  92. return '[v stredu o] LT';
  93. case 4:
  94. return '[vo štvrtok o] LT';
  95. case 5:
  96. return '[v piatok o] LT';
  97. case 6:
  98. return '[v sobotu o] LT';
  99. }
  100. },
  101. lastDay: '[včera o] LT',
  102. lastWeek: function () {
  103. switch (this.day()) {
  104. case 0:
  105. return '[minulú nedeľu o] LT';
  106. case 1:
  107. case 2:
  108. return '[minulý] dddd [o] LT';
  109. case 3:
  110. return '[minulú stredu o] LT';
  111. case 4:
  112. case 5:
  113. return '[minulý] dddd [o] LT';
  114. case 6:
  115. return '[minulú sobotu o] LT';
  116. }
  117. },
  118. sameElse: 'L',
  119. },
  120. relativeTime: {
  121. future: 'za %s',
  122. past: 'pred %s',
  123. s: translate,
  124. ss: 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. dayOfMonthOrdinalParse: /\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. });