1 |
|
2 | import dayjs from '../index';
|
3 |
|
4 | function plural(n) {
|
5 | return n % 10 < 5 && n % 10 > 1 && ~~(n / 10) % 10 !== 1;
|
6 | }
|
7 |
|
8 |
|
9 |
|
10 | function translate(number, withoutSuffix, key) {
|
11 | var result = number + " ";
|
12 |
|
13 | switch (key) {
|
14 | case 'm':
|
15 | return withoutSuffix ? 'minuta' : 'minutę';
|
16 |
|
17 | case 'mm':
|
18 | return result + (plural(number) ? 'minuty' : 'minut');
|
19 |
|
20 | case 'h':
|
21 | return withoutSuffix ? 'godzina' : 'godzinę';
|
22 |
|
23 | case 'hh':
|
24 | return result + (plural(number) ? 'godziny' : 'godzin');
|
25 |
|
26 | case 'MM':
|
27 | return result + (plural(number) ? 'miesiące' : 'miesięcy');
|
28 |
|
29 | case 'yy':
|
30 | return result + (plural(number) ? 'lata' : 'lat');
|
31 | }
|
32 | }
|
33 |
|
34 |
|
35 |
|
36 | var monthFormat = 'stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_września_października_listopada_grudnia'.split('_');
|
37 | var monthStandalone = 'styczeń_luty_marzec_kwiecień_maj_czerwiec_lipiec_sierpień_wrzesień_październik_listopad_grudzień'.split('_');
|
38 | var MONTHS_IN_FORMAT = /D MMMM/;
|
39 |
|
40 | var months = function months(dayjsInstance, format) {
|
41 | if (MONTHS_IN_FORMAT.test(format)) {
|
42 | return monthFormat[dayjsInstance.month()];
|
43 | }
|
44 |
|
45 | return monthStandalone[dayjsInstance.month()];
|
46 | };
|
47 |
|
48 | months.s = monthStandalone;
|
49 | months.f = monthFormat;
|
50 | var locale = {
|
51 | name: 'pl',
|
52 | weekdays: 'niedziela_poniedziałek_wtorek_środa_czwartek_piątek_sobota'.split('_'),
|
53 | weekdaysShort: 'ndz_pon_wt_śr_czw_pt_sob'.split('_'),
|
54 | weekdaysMin: 'Nd_Pn_Wt_Śr_Cz_Pt_So'.split('_'),
|
55 | months: months,
|
56 | monthsShort: 'sty_lut_mar_kwi_maj_cze_lip_sie_wrz_paź_lis_gru'.split('_'),
|
57 | ordinal: function ordinal(n) {
|
58 | return n + ".";
|
59 | },
|
60 | weekStart: 1,
|
61 | yearStart: 4,
|
62 | relativeTime: {
|
63 | future: 'za %s',
|
64 | past: '%s temu',
|
65 | s: 'kilka sekund',
|
66 | m: translate,
|
67 | mm: translate,
|
68 | h: translate,
|
69 | hh: translate,
|
70 | d: '1 dzień',
|
71 | dd: '%d dni',
|
72 | M: 'miesiąc',
|
73 | MM: translate,
|
74 | y: 'rok',
|
75 | yy: translate
|
76 | },
|
77 | formats: {
|
78 | LT: 'HH:mm',
|
79 | LTS: 'HH:mm:ss',
|
80 | L: 'DD.MM.YYYY',
|
81 | LL: 'D MMMM YYYY',
|
82 | LLL: 'D MMMM YYYY HH:mm',
|
83 | LLLL: 'dddd, D MMMM YYYY HH:mm'
|
84 | }
|
85 | };
|
86 | dayjs.locale(locale, null, true);
|
87 | export default locale; |
\ | No newline at end of file |