cs.js 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. // moment.js locale configuration
  2. // locale : czech (cs)
  3. // author : petrbela : https://github.com/petrbela
  4. (function (factory) {
  5. if (typeof define === 'function' && define.amd) {
  6. define(['moment'], factory); // AMD
  7. } else if (typeof exports === 'object') {
  8. module.exports = factory(require('../moment')); // Node
  9. } else {
  10. factory((typeof global !== 'undefined' ? global : this).moment); // node or other global
  11. }
  12. }(function (moment) {
  13. var months = 'leden_únor_březen_duben_květen_červen_červenec_srpen_září_říjen_listopad_prosinec'.split('_'),
  14. monthsShort = 'led_úno_bře_dub_kvě_čvn_čvc_srp_zář_říj_lis_pro'.split('_');
  15. function plural(n) {
  16. return (n > 1) && (n < 5) && (~~(n / 10) !== 1);
  17. }
  18. function translate(number, withoutSuffix, key, isFuture) {
  19. var result = number + ' ';
  20. switch (key) {
  21. case 's': // a few seconds / in a few seconds / a few seconds ago
  22. return (withoutSuffix || isFuture) ? 'pár sekund' : 'pár sekundami';
  23. case 'm': // a minute / in a minute / a minute ago
  24. return withoutSuffix ? 'minuta' : (isFuture ? 'minutu' : 'minutou');
  25. case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago
  26. if (withoutSuffix || isFuture) {
  27. return result + (plural(number) ? 'minuty' : 'minut');
  28. } else {
  29. return result + 'minutami';
  30. }
  31. break;
  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' : 'hodin');
  37. } else {
  38. return result + 'hodinami';
  39. }
  40. break;
  41. case 'd': // a day / in a day / a day ago
  42. return (withoutSuffix || isFuture) ? 'den' : 'dnem';
  43. case 'dd': // 9 days / in 9 days / 9 days ago
  44. if (withoutSuffix || isFuture) {
  45. return result + (plural(number) ? 'dny' : 'dní');
  46. } else {
  47. return result + 'dny';
  48. }
  49. break;
  50. case 'M': // a month / in a month / a month ago
  51. return (withoutSuffix || isFuture) ? 'měsíc' : 'měsícem';
  52. case 'MM': // 9 months / in 9 months / 9 months ago
  53. if (withoutSuffix || isFuture) {
  54. return result + (plural(number) ? 'měsíce' : 'měsíců');
  55. } else {
  56. return result + 'měsíci';
  57. }
  58. break;
  59. case 'y': // a year / in a year / a year ago
  60. return (withoutSuffix || isFuture) ? 'rok' : 'rokem';
  61. case 'yy': // 9 years / in 9 years / 9 years ago
  62. if (withoutSuffix || isFuture) {
  63. return result + (plural(number) ? 'roky' : 'let');
  64. } else {
  65. return result + 'lety';
  66. }
  67. break;
  68. }
  69. }
  70. return moment.defineLocale('cs', {
  71. months : months,
  72. monthsShort : monthsShort,
  73. monthsParse : (function (months, monthsShort) {
  74. var i, _monthsParse = [];
  75. for (i = 0; i < 12; i++) {
  76. // use custom parser to solve problem with July (červenec)
  77. _monthsParse[i] = new RegExp('^' + months[i] + '$|^' + monthsShort[i] + '$', 'i');
  78. }
  79. return _monthsParse;
  80. }(months, monthsShort)),
  81. weekdays : 'neděle_pondělí_úterý_středa_čtvrtek_pátek_sobota'.split('_'),
  82. weekdaysShort : 'ne_po_út_st_čt_pá_so'.split('_'),
  83. weekdaysMin : 'ne_po_út_st_čt_pá_so'.split('_'),
  84. longDateFormat : {
  85. LT: 'H:mm',
  86. LTS : 'LT:ss',
  87. L : 'DD.MM.YYYY',
  88. LL : 'D. MMMM YYYY',
  89. LLL : 'D. MMMM YYYY LT',
  90. LLLL : 'dddd D. MMMM YYYY LT'
  91. },
  92. calendar : {
  93. sameDay: '[dnes v] LT',
  94. nextDay: '[zítra v] LT',
  95. nextWeek: function () {
  96. switch (this.day()) {
  97. case 0:
  98. return '[v neděli v] LT';
  99. case 1:
  100. case 2:
  101. return '[v] dddd [v] LT';
  102. case 3:
  103. return '[ve středu v] LT';
  104. case 4:
  105. return '[ve čtvrtek v] LT';
  106. case 5:
  107. return '[v pátek v] LT';
  108. case 6:
  109. return '[v sobotu v] LT';
  110. }
  111. },
  112. lastDay: '[včera v] LT',
  113. lastWeek: function () {
  114. switch (this.day()) {
  115. case 0:
  116. return '[minulou neděli v] LT';
  117. case 1:
  118. case 2:
  119. return '[minulé] dddd [v] LT';
  120. case 3:
  121. return '[minulou středu v] LT';
  122. case 4:
  123. case 5:
  124. return '[minulý] dddd [v] LT';
  125. case 6:
  126. return '[minulou sobotu v] LT';
  127. }
  128. },
  129. sameElse: 'L'
  130. },
  131. relativeTime : {
  132. future : 'za %s',
  133. past : 'před %s',
  134. s : translate,
  135. m : translate,
  136. mm : translate,
  137. h : translate,
  138. hh : translate,
  139. d : translate,
  140. dd : translate,
  141. M : translate,
  142. MM : translate,
  143. y : translate,
  144. yy : translate
  145. },
  146. ordinalParse : /\d{1,2}\./,
  147. ordinal : '%d.',
  148. week : {
  149. dow : 1, // Monday is the first day of the week.
  150. doy : 4 // The week that contains Jan 4th is the first week of the year.
  151. }
  152. });
  153. }));