cs.js 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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. var 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. l : 'D. M. YYYY'
  103. },
  104. calendar : {
  105. sameDay: '[dnes v] LT',
  106. nextDay: '[zítra v] LT',
  107. nextWeek: function () {
  108. switch (this.day()) {
  109. case 0:
  110. return '[v neděli v] LT';
  111. case 1:
  112. case 2:
  113. return '[v] dddd [v] LT';
  114. case 3:
  115. return '[ve středu v] LT';
  116. case 4:
  117. return '[ve čtvrtek v] LT';
  118. case 5:
  119. return '[v pátek v] LT';
  120. case 6:
  121. return '[v sobotu v] LT';
  122. }
  123. },
  124. lastDay: '[včera v] LT',
  125. lastWeek: function () {
  126. switch (this.day()) {
  127. case 0:
  128. return '[minulou neděli v] LT';
  129. case 1:
  130. case 2:
  131. return '[minulé] dddd [v] LT';
  132. case 3:
  133. return '[minulou středu v] LT';
  134. case 4:
  135. case 5:
  136. return '[minulý] dddd [v] LT';
  137. case 6:
  138. return '[minulou sobotu v] LT';
  139. }
  140. },
  141. sameElse: 'L'
  142. },
  143. relativeTime : {
  144. future : 'za %s',
  145. past : 'před %s',
  146. s : translate,
  147. m : translate,
  148. mm : translate,
  149. h : translate,
  150. hh : translate,
  151. d : translate,
  152. dd : translate,
  153. M : translate,
  154. MM : translate,
  155. y : translate,
  156. yy : translate
  157. },
  158. dayOfMonthOrdinalParse : /\d{1,2}\./,
  159. ordinal : '%d.',
  160. week : {
  161. dow : 1, // Monday is the first day of the week.
  162. doy : 4 // The week that contains Jan 4th is the first week of the year.
  163. }
  164. });
  165. return cs;
  166. })));