cs.js 6.3 KB

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