1 |
|
2 | import dayjs from '../index';
|
3 | var translator = {
|
4 | words: {
|
5 | m: ['jedan minut', 'jednog minuta'],
|
6 | mm: ['%d minut', '%d minuta', '%d minuta'],
|
7 | h: ['jedan sat', 'jednog sata'],
|
8 | hh: ['%d sat', '%d sata', '%d sati'],
|
9 | d: ['jedan dan', 'jednog dana'],
|
10 | dd: ['%d dan', '%d dana', '%d dana'],
|
11 | M: ['jedan mesec', 'jednog meseca'],
|
12 | MM: ['%d mesec', '%d meseca', '%d meseci'],
|
13 | y: ['jednu godinu', 'jedne godine'],
|
14 | yy: ['%d godinu', '%d godine', '%d godina']
|
15 | },
|
16 | correctGrammarCase: function correctGrammarCase(number, wordKey) {
|
17 | if (number % 10 >= 1 && number % 10 <= 4 && (number % 100 < 10 || number % 100 >= 20)) {
|
18 | return number % 10 === 1 ? wordKey[0] : wordKey[1];
|
19 | }
|
20 |
|
21 | return wordKey[2];
|
22 | },
|
23 | relativeTimeFormatter: function relativeTimeFormatter(number, withoutSuffix, key, isFuture) {
|
24 | var wordKey = translator.words[key];
|
25 |
|
26 | if (key.length === 1) {
|
27 |
|
28 | if (key === 'y' && withoutSuffix) return 'jedna godina';
|
29 | return isFuture || withoutSuffix ? wordKey[0] : wordKey[1];
|
30 | }
|
31 |
|
32 | var word = translator.correctGrammarCase(number, wordKey);
|
33 |
|
34 | if (key === 'yy' && withoutSuffix && word === '%d godinu') return number + " godina";
|
35 | return word.replace('%d', number);
|
36 | }
|
37 | };
|
38 | var locale = {
|
39 | name: 'sr',
|
40 | weekdays: 'Nedelja_Ponedeljak_Utorak_Sreda_Četvrtak_Petak_Subota'.split('_'),
|
41 | weekdaysShort: 'Ned._Pon._Uto._Sre._Čet._Pet._Sub.'.split('_'),
|
42 | weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'),
|
43 | months: 'Januar_Februar_Mart_April_Maj_Jun_Jul_Avgust_Septembar_Oktobar_Novembar_Decembar'.split('_'),
|
44 | monthsShort: 'Jan._Feb._Mar._Apr._Maj_Jun_Jul_Avg._Sep._Okt._Nov._Dec.'.split('_'),
|
45 | weekStart: 1,
|
46 | relativeTime: {
|
47 | future: 'za %s',
|
48 | past: 'pre %s',
|
49 | s: 'nekoliko sekundi',
|
50 | m: translator.relativeTimeFormatter,
|
51 | mm: translator.relativeTimeFormatter,
|
52 | h: translator.relativeTimeFormatter,
|
53 | hh: translator.relativeTimeFormatter,
|
54 | d: translator.relativeTimeFormatter,
|
55 | dd: translator.relativeTimeFormatter,
|
56 | M: translator.relativeTimeFormatter,
|
57 | MM: translator.relativeTimeFormatter,
|
58 | y: translator.relativeTimeFormatter,
|
59 | yy: translator.relativeTimeFormatter
|
60 | },
|
61 | ordinal: function ordinal(n) {
|
62 | return n + ".";
|
63 | },
|
64 | formats: {
|
65 | LT: 'H:mm',
|
66 | LTS: 'H:mm:ss',
|
67 | L: 'D. M. YYYY.',
|
68 | LL: 'D. MMMM YYYY.',
|
69 | LLL: 'D. MMMM YYYY. H:mm',
|
70 | LLLL: 'dddd, D. MMMM YYYY. H:mm'
|
71 | }
|
72 | };
|
73 | dayjs.locale(locale, null, true);
|
74 | export default locale; |
\ | No newline at end of file |