sk.js 5.0KB

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