sk.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. // Slovak [sk]
  2. import dayjs from '../index';
  3. function plural(n) {
  4. return n > 1 && n < 5 && ~~(n / 10) !== 1; // eslint-disable-line
  5. }
  6. /* eslint-disable */
  7. function translate(number, withoutSuffix, key, isFuture) {
  8. var result = number + " ";
  9. switch (key) {
  10. case 's':
  11. // a few seconds / in a few seconds / a few seconds ago
  12. return withoutSuffix || isFuture ? 'pár sekúnd' : 'pár sekundami';
  13. case 'm':
  14. // a minute / in a minute / a minute ago
  15. return withoutSuffix ? 'minúta' : isFuture ? 'minútu' : 'minútou';
  16. case 'mm':
  17. // 9 minutes / in 9 minutes / 9 minutes ago
  18. if (withoutSuffix || isFuture) {
  19. return result + (plural(number) ? 'minúty' : 'minút');
  20. }
  21. return result + "min\xFAtami";
  22. case 'h':
  23. // an hour / in an hour / an hour ago
  24. return withoutSuffix ? 'hodina' : isFuture ? 'hodinu' : 'hodinou';
  25. case 'hh':
  26. // 9 hours / in 9 hours / 9 hours ago
  27. if (withoutSuffix || isFuture) {
  28. return result + (plural(number) ? 'hodiny' : 'hodín');
  29. }
  30. return result + "hodinami";
  31. case 'd':
  32. // a day / in a day / a day ago
  33. return withoutSuffix || isFuture ? 'deň' : 'dňom';
  34. case 'dd':
  35. // 9 days / in 9 days / 9 days ago
  36. if (withoutSuffix || isFuture) {
  37. return result + (plural(number) ? 'dni' : 'dní');
  38. }
  39. return result + "d\u0148ami";
  40. case 'M':
  41. // a month / in a month / a month ago
  42. return withoutSuffix || isFuture ? 'mesiac' : 'mesiacom';
  43. case 'MM':
  44. // 9 months / in 9 months / 9 months ago
  45. if (withoutSuffix || isFuture) {
  46. return result + (plural(number) ? 'mesiace' : 'mesiacov');
  47. }
  48. return result + "mesiacmi";
  49. case 'y':
  50. // a year / in a year / a year ago
  51. return withoutSuffix || isFuture ? 'rok' : 'rokom';
  52. case 'yy':
  53. // 9 years / in 9 years / 9 years ago
  54. if (withoutSuffix || isFuture) {
  55. return result + (plural(number) ? 'roky' : 'rokov');
  56. }
  57. return result + "rokmi";
  58. }
  59. }
  60. /* eslint-enable */
  61. var locale = {
  62. name: 'sk',
  63. weekdays: 'nedeľa_pondelok_utorok_streda_štvrtok_piatok_sobota'.split('_'),
  64. weekdaysShort: 'ne_po_ut_st_št_pi_so'.split('_'),
  65. weekdaysMin: 'ne_po_ut_st_št_pi_so'.split('_'),
  66. months: 'január_február_marec_apríl_máj_jún_júl_august_september_október_november_december'.split('_'),
  67. monthsShort: 'jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec'.split('_'),
  68. weekStart: 1,
  69. yearStart: 4,
  70. ordinal: function ordinal(n) {
  71. return n + ".";
  72. },
  73. formats: {
  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. l: 'D. M. YYYY'
  81. },
  82. relativeTime: {
  83. future: 'za %s',
  84. // Should be `o %s` (change when moment/moment#5408 is fixed)
  85. past: 'pred %s',
  86. s: translate,
  87. m: translate,
  88. mm: translate,
  89. h: translate,
  90. hh: translate,
  91. d: translate,
  92. dd: translate,
  93. M: translate,
  94. MM: translate,
  95. y: translate,
  96. yy: translate
  97. }
  98. };
  99. dayjs.locale(locale, null, true);
  100. export default locale;