You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

155 lines
5.9 KiB

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