forked from moment/moment
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/czech' into develop
- Loading branch information
Showing
2 changed files
with
428 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
// moment.js language configuration | ||
// language : czech (cs) | ||
// author : petrbela : https://github.com/petrbela | ||
(function () { | ||
var plural = function (n) { | ||
return (n > 1) && (n < 5) && (~~(n / 10) !== 1); | ||
}, | ||
|
||
translate = function (number, withoutSuffix, key, isFuture) { | ||
var result = number + " "; | ||
switch (key) { | ||
case 's': // a few seconds / in a few seconds / a few seconds ago | ||
return (withoutSuffix || isFuture) ? 'pár vteřin' : 'pár vteřinami'; | ||
case 'm': // a minute / in a minute / a minute ago | ||
return withoutSuffix ? 'minuta' : (isFuture ? 'minutu' : 'minutou'); | ||
case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago | ||
if (withoutSuffix || isFuture) return result + (plural(number) ? 'minuty' : 'minut'); | ||
else return result + 'minutami'; | ||
case 'h': // an hour / in an hour / an hour ago | ||
return withoutSuffix ? 'hodina' : (isFuture ? 'hodinu' : 'hodinou'); | ||
case 'hh': // 9 hours / in 9 hours / 9 hours ago | ||
if (withoutSuffix || isFuture) return result + (plural(number) ? 'hodiny' : 'hodin'); | ||
else return result + 'hodinami'; | ||
case 'd': // a day / in a day / a day ago | ||
return (withoutSuffix || isFuture) ? 'den' : 'dnem'; | ||
case 'dd': // 9 days / in 9 days / 9 days ago | ||
if (withoutSuffix || isFuture) return result + (plural(number) ? 'dny' : 'dní'); | ||
else return result + 'dny'; | ||
case 'M': // a month / in a month / a month ago | ||
return (withoutSuffix || isFuture) ? 'měsíc' : 'měsícem'; | ||
case 'MM': // 9 months / in 9 months / 9 months ago | ||
if (withoutSuffix || isFuture) return result + (plural(number) ? 'měsíce' : 'měsíců'); | ||
else return result + 'měsíci'; | ||
case 'y': // a year / in a year / a year ago | ||
return (withoutSuffix || isFuture) ? 'rok' : 'rokem'; | ||
case 'yy': // 9 years / in 9 years / 9 years ago | ||
if (withoutSuffix || isFuture) return result + (plural(number) ? 'roky' : 'let'); | ||
else return result + 'lety'; | ||
} | ||
}, | ||
|
||
months = "leden_únor_březen_duben_květen_červen_červenec_srpen_září_říjen_listopad_prosinec".split("_"), | ||
monthsShort = "led_úno_bře_dub_kvě_čvn_čvc_srp_zář_říj_lis_pro".split("_"), | ||
lang = { | ||
months : months, | ||
monthsShort : monthsShort, | ||
monthsParse : (function(months, monthsShort) { | ||
_monthsParse = []; | ||
for (i = 0; i < 12; i++) { | ||
// use custom parser to solve problem with July (červenec) | ||
_monthsParse[i] = new RegExp('^' + months[i] + '$|^' + monthsShort[i] + '$', 'i'); | ||
} | ||
return _monthsParse; | ||
}(months, monthsShort)), | ||
weekdays : "neděle_pondělí_úterý_středa_čtvrtek_pátek_sobota".split("_"), | ||
weekdaysShort : "ne_po_út_st_čt_pá_so".split("_"), | ||
weekdaysMin : "ne_po_út_st_čt_pá_so".split("_"), | ||
longDateFormat : { | ||
LT: "H:mm", | ||
L : "DD.MM.YYYY", | ||
LL : "D. MMMM YYYY", | ||
LLL : "D. MMMM YYYY LT", | ||
LLLL : "dddd D. MMMM YYYY LT" | ||
}, | ||
calendar : { | ||
sameDay: "[dnes v] LT", | ||
nextDay: '[zítra v] LT', | ||
nextWeek: function () { | ||
switch (this.day()) { | ||
case 0: return '[v neděli v] LT'; break; | ||
case 1: case 2: return '[v] dddd [v] LT'; break; | ||
case 3: return '[ve středu v] LT'; break; | ||
case 4: return '[ve čtvrtek v] LT'; break; | ||
case 5: return '[v pátek v] LT'; break; | ||
case 6: return '[v sobotu v] LT'; break; | ||
} | ||
}, | ||
lastDay: '[včera v] LT', | ||
lastWeek: function () { | ||
switch (this.day()) { | ||
case 0: return '[minulou neděli v] LT'; break; | ||
case 1: case 2: return '[minulé] dddd [v] LT'; break; | ||
case 3: return '[minulou středu v] LT'; break; | ||
case 4: case 5: return '[minulý] dddd [v] LT'; break; | ||
case 6: return '[minulou sobotu v] LT'; break; | ||
} | ||
}, | ||
sameElse: "L" | ||
}, | ||
relativeTime : { | ||
future : "za %s", | ||
past : "před %s", | ||
s : translate, | ||
m : translate, | ||
mm : translate, | ||
h : translate, | ||
hh : translate, | ||
d : translate, | ||
dd : translate, | ||
M : translate, | ||
MM : translate, | ||
y : translate, | ||
yy : translate | ||
}, | ||
ordinal : function (number) { | ||
return '.'; | ||
} | ||
}; | ||
|
||
// Node | ||
if (typeof module !== 'undefined' && module.exports) { | ||
module.exports = lang; | ||
} | ||
// Browser | ||
if (typeof window !== 'undefined' && this.moment && this.moment.lang) { | ||
this.moment.lang('cs', lang); | ||
} | ||
}()); |
Oops, something went wrong.