|
| 1 | +// moment.js locale configuration |
| 2 | +// locale : Czech [cs] |
| 3 | +// author : petrbela : https://github.com/petrbela |
| 4 | +// ported by: Frantisek Jandos : https://github.com/frantisekjandos |
| 5 | + |
| 6 | +import { LocaleData } from '../locale/locale.class'; |
| 7 | + |
| 8 | +function plural(n: number): boolean { |
| 9 | + return (n % 10 < 5) && (n % 10 > 1) && ((~~(n / 10) % 10) !== 1); |
| 10 | +} |
| 11 | + |
| 12 | +function translate(num: number, withoutSuffix: boolean, key: string, isFuture: boolean): string { |
| 13 | + let result = num + ' '; |
| 14 | + switch (key) { |
| 15 | + case 's': // a few seconds / in a few seconds / a few seconds ago |
| 16 | + return (withoutSuffix || isFuture) ? 'pár sekund' : 'pár sekundami'; |
| 17 | + case 'm': // a minute / in a minute / a minute ago |
| 18 | + return withoutSuffix ? 'minuta' : (isFuture ? 'minutu' : 'minutou'); |
| 19 | + case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago |
| 20 | + if (withoutSuffix || isFuture) { |
| 21 | + return result + (plural(num) ? 'minuty' : 'minut'); |
| 22 | + } |
| 23 | + return result + 'minutami'; |
| 24 | + case 'h': // an hour / in an hour / an hour ago |
| 25 | + return withoutSuffix ? 'hodina' : (isFuture ? 'hodinu' : 'hodinou'); |
| 26 | + case 'hh': // 9 hours / in 9 hours / 9 hours ago |
| 27 | + if (withoutSuffix || isFuture) { |
| 28 | + return result + (plural(num) ? 'hodiny' : 'hodin'); |
| 29 | + } |
| 30 | + return result + 'hodinami'; |
| 31 | + case 'd': // a day / in a day / a day ago |
| 32 | + return (withoutSuffix || isFuture) ? 'den' : 'dnem'; |
| 33 | + case 'dd': // 9 days / in 9 days / 9 days ago |
| 34 | + if (withoutSuffix || isFuture) { |
| 35 | + return result + (plural(num) ? 'dny' : 'dní'); |
| 36 | + } |
| 37 | + return result + 'dny'; |
| 38 | + case 'M': // a month / in a month / a month ago |
| 39 | + return (withoutSuffix || isFuture) ? 'měsíc' : 'měsícem'; |
| 40 | + case 'MM': // 9 months / in 9 months / 9 months ago |
| 41 | + if (withoutSuffix || isFuture) { |
| 42 | + return result + (plural(num) ? 'měsíce' : 'měsíců'); |
| 43 | + } |
| 44 | + return result + 'měsíci'; |
| 45 | + case 'y': // a year / in a year / a year ago |
| 46 | + return (withoutSuffix || isFuture) ? 'rok' : 'rokem'; |
| 47 | + case 'yy': // 9 years / in 9 years / 9 years ago |
| 48 | + if (withoutSuffix || isFuture) { |
| 49 | + return result + (plural(num) ? 'roky' : 'let'); |
| 50 | + } |
| 51 | + return result + 'lety'; |
| 52 | + } |
| 53 | +} |
| 54 | + |
| 55 | +export const cs: LocaleData = { |
| 56 | + abbr: 'cs', |
| 57 | + months: 'leden_únor_březen_duben_květen_červen_červenec_srpen_září_říjen_listopad_prosinec'.split('_'), |
| 58 | + monthsShort: 'led_úno_bře_dub_kvě_čvn_čvc_srp_zář_říj_lis_pro'.split('_'), |
| 59 | + weekdays: 'neděle_pondělí_úterý_středa_čtvrtek_pátek_sobota'.split('_'), |
| 60 | + weekdaysShort: 'ne_po_út_st_čt_pá_so'.split('_'), |
| 61 | + weekdaysMin: 'ne_po_út_st_čt_pá_so'.split('_'), |
| 62 | + longDateFormat: { |
| 63 | + LT: 'HH:mm', |
| 64 | + LTS: 'HH:mm:ss', |
| 65 | + L: 'DD.MM.YYYY', |
| 66 | + LL: 'D. MMMM YYYY', |
| 67 | + LLL: 'D. MMMM YYYY HH:mm', |
| 68 | + LLLL: 'dddd, D. MMMM YYYY HH:mm', |
| 69 | + l : 'D. M. YYYY' |
| 70 | + }, |
| 71 | + calendar: { |
| 72 | + sameDay: '[dnes v] LT', |
| 73 | + nextDay: '[zítra v] LT', |
| 74 | + nextWeek: '[příští] dddd [v] LT', |
| 75 | + lastDay: '[včera v] LT', |
| 76 | + lastWeek: '[minulý] dddd [v] LT', |
| 77 | + sameElse: 'L' |
| 78 | + }, |
| 79 | + relativeTime: { |
| 80 | + future: 'za %s', |
| 81 | + past: 'před %s', |
| 82 | + s: translate, |
| 83 | + m: translate, |
| 84 | + mm: translate, |
| 85 | + h: translate, |
| 86 | + hh: translate, |
| 87 | + d: translate, |
| 88 | + dd: translate, |
| 89 | + M: translate, |
| 90 | + MM: translate, |
| 91 | + y: translate, |
| 92 | + yy: translate |
| 93 | + }, |
| 94 | + dayOfMonthOrdinalParse : /\d{1,2}\./, |
| 95 | + ordinal(num: number): string { return `${num}.`; }, |
| 96 | + week: { |
| 97 | + dow: 1, // Monday is the first day of the week. |
| 98 | + doy: 4 // The week that contains Jan 4th is the first week of the year. |
| 99 | + } |
| 100 | +}; |
0 commit comments