sk.js 5.9 KB

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