cs.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. // Czech [cs]
  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 sekund' : 'pár sekundami';
  13. case 'm':
  14. // a minute / in a minute / a minute ago
  15. return withoutSuffix ? 'minuta' : isFuture ? 'minutu' : 'minutou';
  16. case 'mm':
  17. // 9 minutes / in 9 minutes / 9 minutes ago
  18. if (withoutSuffix || isFuture) {
  19. return result + (plural(number) ? 'minuty' : 'minut');
  20. }
  21. return result + "minutami";
  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' : 'hodin');
  29. }
  30. return result + "hodinami";
  31. case 'd':
  32. // a day / in a day / a day ago
  33. return withoutSuffix || isFuture ? 'den' : 'dnem';
  34. case 'dd':
  35. // 9 days / in 9 days / 9 days ago
  36. if (withoutSuffix || isFuture) {
  37. return result + (plural(number) ? 'dny' : 'dní');
  38. }
  39. return result + "dny";
  40. case 'M':
  41. // a month / in a month / a month ago
  42. return withoutSuffix || isFuture ? 'měsíc' : 'měsícem';
  43. case 'MM':
  44. // 9 months / in 9 months / 9 months ago
  45. if (withoutSuffix || isFuture) {
  46. return result + (plural(number) ? 'měsíce' : 'měsíců');
  47. }
  48. return result + "m\u011Bs\xEDci";
  49. case 'y':
  50. // a year / in a year / a year ago
  51. return withoutSuffix || isFuture ? 'rok' : 'rokem';
  52. case 'yy':
  53. // 9 years / in 9 years / 9 years ago
  54. if (withoutSuffix || isFuture) {
  55. return result + (plural(number) ? 'roky' : 'let');
  56. }
  57. return result + "lety";
  58. }
  59. }
  60. /* eslint-enable */
  61. var locale = {
  62. name: 'cs',
  63. weekdays: 'neděle_pondělí_úterý_středa_čtvrtek_pátek_sobota'.split('_'),
  64. weekdaysShort: 'ne_po_út_st_čt_pá_so'.split('_'),
  65. weekdaysMin: 'ne_po_út_st_čt_pá_so'.split('_'),
  66. months: 'leden_únor_březen_duben_květen_červen_červenec_srpen_září_říjen_listopad_prosinec'.split('_'),
  67. monthsShort: 'led_úno_bře_dub_kvě_čvn_čvc_srp_zář_říj_lis_pro'.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. past: 'před %s',
  85. s: translate,
  86. m: translate,
  87. mm: translate,
  88. h: translate,
  89. hh: translate,
  90. d: translate,
  91. dd: translate,
  92. M: translate,
  93. MM: translate,
  94. y: translate,
  95. yy: translate
  96. }
  97. };
  98. dayjs.locale(locale, null, true);
  99. export default locale;