Merge "Revert "Use display name in category page subheadings if provided""
[lhc/web/wiklou.git] / resources / lib / moment / locale / ru.js
1 // moment.js locale configuration
2 // locale : russian (ru)
3 // author : Viktorminator : https://github.com/Viktorminator
4 // Author : Menelion Elensúle : https://github.com/Oire
5
6 (function (factory) {
7 // Comment out broken wrapper, see T145382
8 /*if (typeof define === 'function' && define.amd) {
9 define(['moment'], factory); // AMD
10 } else if (typeof exports === 'object') {
11 module.exports = factory(require('../moment')); // Node
12 } else {
13 factory((typeof global !== 'undefined' ? global : this).moment); // node or other global
14 }*/
15 factory(this.moment);
16 }(function (moment) {
17 function plural(word, num) {
18 var forms = word.split('_');
19 return num % 10 === 1 && num % 100 !== 11 ? forms[0] : (num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2]);
20 }
21
22 function relativeTimeWithPlural(number, withoutSuffix, key) {
23 var format = {
24 'mm': withoutSuffix ? 'минута_минуты_минут' : 'минуту_минуты_минут',
25 'hh': 'час_часа_часов',
26 'dd': 'день_дня_дней',
27 'MM': 'месяц_месяца_месяцев',
28 'yy': 'год_года_лет'
29 };
30 if (key === 'm') {
31 return withoutSuffix ? 'минута' : 'минуту';
32 }
33 else {
34 return number + ' ' + plural(format[key], +number);
35 }
36 }
37
38 function monthsCaseReplace(m, format) {
39 var months = {
40 'nominative': 'январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь'.split('_'),
41 'accusative': 'января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря'.split('_')
42 },
43
44 nounCase = (/D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/).test(format) ?
45 'accusative' :
46 'nominative';
47
48 return months[nounCase][m.month()];
49 }
50
51 function monthsShortCaseReplace(m, format) {
52 var monthsShort = {
53 'nominative': 'янв_фев_март_апр_май_июнь_июль_авг_сен_окт_ноя_дек'.split('_'),
54 'accusative': 'янв_фев_мар_апр_мая_июня_июля_авг_сен_окт_ноя_дек'.split('_')
55 },
56
57 nounCase = (/D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/).test(format) ?
58 'accusative' :
59 'nominative';
60
61 return monthsShort[nounCase][m.month()];
62 }
63
64 function weekdaysCaseReplace(m, format) {
65 var weekdays = {
66 'nominative': 'воскресенье_понедельник_вторник_среда_четверг_пятница_суббота'.split('_'),
67 'accusative': 'воскресенье_понедельник_вторник_среду_четверг_пятницу_субботу'.split('_')
68 },
69
70 nounCase = (/\[ ?[Вв] ?(?:прошлую|следующую|эту)? ?\] ?dddd/).test(format) ?
71 'accusative' :
72 'nominative';
73
74 return weekdays[nounCase][m.day()];
75 }
76
77 return moment.defineLocale('ru', {
78 months : monthsCaseReplace,
79 monthsShort : monthsShortCaseReplace,
80 weekdays : weekdaysCaseReplace,
81 weekdaysShort : 'вс_пн_вт_ср_чт_пт_сб'.split('_'),
82 weekdaysMin : 'вс_пн_вт_ср_чт_пт_сб'.split('_'),
83 monthsParse : [/^янв/i, /^фев/i, /^мар/i, /^апр/i, /^ма[й|я]/i, /^июн/i, /^июл/i, /^авг/i, /^сен/i, /^окт/i, /^ноя/i, /^дек/i],
84 longDateFormat : {
85 LT : 'HH:mm',
86 LTS : 'LT:ss',
87 L : 'DD.MM.YYYY',
88 LL : 'D MMMM YYYY г.',
89 LLL : 'D MMMM YYYY г., LT',
90 LLLL : 'dddd, D MMMM YYYY г., LT'
91 },
92 calendar : {
93 sameDay: '[Сегодня в] LT',
94 nextDay: '[Завтра в] LT',
95 lastDay: '[Вчера в] LT',
96 nextWeek: function () {
97 return this.day() === 2 ? '[Во] dddd [в] LT' : '[В] dddd [в] LT';
98 },
99 lastWeek: function (now) {
100 if (now.week() !== this.week()) {
101 switch (this.day()) {
102 case 0:
103 return '[В прошлое] dddd [в] LT';
104 case 1:
105 case 2:
106 case 4:
107 return '[В прошлый] dddd [в] LT';
108 case 3:
109 case 5:
110 case 6:
111 return '[В прошлую] dddd [в] LT';
112 }
113 } else {
114 if (this.day() === 2) {
115 return '[Во] dddd [в] LT';
116 } else {
117 return '[В] dddd [в] LT';
118 }
119 }
120 },
121 sameElse: 'L'
122 },
123 relativeTime : {
124 future : 'через %s',
125 past : '%s назад',
126 s : 'несколько секунд',
127 m : relativeTimeWithPlural,
128 mm : relativeTimeWithPlural,
129 h : 'час',
130 hh : relativeTimeWithPlural,
131 d : 'день',
132 dd : relativeTimeWithPlural,
133 M : 'месяц',
134 MM : relativeTimeWithPlural,
135 y : 'год',
136 yy : relativeTimeWithPlural
137 },
138
139 meridiemParse: /ночи|утра|дня|вечера/i,
140 isPM : function (input) {
141 return /^(дня|вечера)$/.test(input);
142 },
143
144 meridiem : function (hour, minute, isLower) {
145 if (hour < 4) {
146 return 'ночи';
147 } else if (hour < 12) {
148 return 'утра';
149 } else if (hour < 17) {
150 return 'дня';
151 } else {
152 return 'вечера';
153 }
154 },
155
156 ordinalParse: /\d{1,2}-(й|го|я)/,
157 ordinal: function (number, period) {
158 switch (period) {
159 case 'M':
160 case 'd':
161 case 'DDD':
162 return number + '-й';
163 case 'D':
164 return number + '-го';
165 case 'w':
166 case 'W':
167 return number + '-я';
168 default:
169 return number;
170 }
171 },
172
173 week : {
174 dow : 1, // Monday is the first day of the week.
175 doy : 7 // The week that contains Jan 1st is the first week of the year.
176 }
177 });
178 }));