Merge "Make validation for page more strict on djvu to take only numbers"
[mediawiki.git] / resources / lib / moment / lang / ru.js
blobac5400da8a90ba586dd78f59c0733c135c85fdb0
1 // moment.js language configuration
2 // language : russian (ru)
3 // author : Viktorminator : https://github.com/Viktorminator
4 // Author : Menelion Elensúle : https://github.com/Oire
6 (function (factory) {
7     if (typeof define === 'function' && define.amd) {
8         define(['moment'], factory); // AMD
9     } else if (typeof exports === 'object') {
10         module.exports = factory(require('../moment')); // Node
11     } else {
12         factory(window.moment); // Browser global
13     }
14 }(function (moment) {
15     function plural(word, num) {
16         var forms = word.split('_');
17         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]);
18     }
20     function relativeTimeWithPlural(number, withoutSuffix, key) {
21         var format = {
22             'mm': withoutSuffix ? 'минута_минуты_минут' : 'минуту_минуты_минут',
23             'hh': 'час_часа_часов',
24             'dd': 'день_дня_дней',
25             'MM': 'месяц_месяца_месяцев',
26             'yy': 'год_года_лет'
27         };
28         if (key === 'm') {
29             return withoutSuffix ? 'минута' : 'минуту';
30         }
31         else {
32             return number + ' ' + plural(format[key], +number);
33         }
34     }
36     function monthsCaseReplace(m, format) {
37         var months = {
38             'nominative': 'январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь'.split('_'),
39             'accusative': 'января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря'.split('_')
40         },
42         nounCase = (/D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/).test(format) ?
43             'accusative' :
44             'nominative';
46         return months[nounCase][m.month()];
47     }
49     function monthsShortCaseReplace(m, format) {
50         var monthsShort = {
51             'nominative': 'янв_фев_мар_апр_май_июнь_июль_авг_сен_окт_ноя_дек'.split('_'),
52             'accusative': 'янв_фев_мар_апр_мая_июня_июля_авг_сен_окт_ноя_дек'.split('_')
53         },
55         nounCase = (/D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/).test(format) ?
56             'accusative' :
57             'nominative';
59         return monthsShort[nounCase][m.month()];
60     }
62     function weekdaysCaseReplace(m, format) {
63         var weekdays = {
64             'nominative': 'воскресенье_понедельник_вторник_среда_четверг_пятница_суббота'.split('_'),
65             'accusative': 'воскресенье_понедельник_вторник_среду_четверг_пятницу_субботу'.split('_')
66         },
68         nounCase = (/\[ ?[Вв] ?(?:прошлую|следующую)? ?\] ?dddd/).test(format) ?
69             'accusative' :
70             'nominative';
72         return weekdays[nounCase][m.day()];
73     }
75     return moment.lang('ru', {
76         months : monthsCaseReplace,
77         monthsShort : monthsShortCaseReplace,
78         weekdays : weekdaysCaseReplace,
79         weekdaysShort : "вс_пн_вт_ср_чт_пт_сб".split("_"),
80         weekdaysMin : "вс_пн_вт_ср_чт_пт_сб".split("_"),
81         monthsParse : [/^янв/i, /^фев/i, /^мар/i, /^апр/i, /^ма[й|я]/i, /^июн/i, /^июл/i, /^авг/i, /^сен/i, /^окт/i, /^ноя/i, /^дек/i],
82         longDateFormat : {
83             LT : "HH:mm",
84             L : "DD.MM.YYYY",
85             LL : "D MMMM YYYY г.",
86             LLL : "D MMMM YYYY г., LT",
87             LLLL : "dddd, D MMMM YYYY г., LT"
88         },
89         calendar : {
90             sameDay: '[Сегодня в] LT',
91             nextDay: '[Завтра в] LT',
92             lastDay: '[Вчера в] LT',
93             nextWeek: function () {
94                 return this.day() === 2 ? '[Во] dddd [в] LT' : '[В] dddd [в] LT';
95             },
96             lastWeek: function () {
97                 switch (this.day()) {
98                 case 0:
99                     return '[В прошлое] dddd [в] LT';
100                 case 1:
101                 case 2:
102                 case 4:
103                     return '[В прошлый] dddd [в] LT';
104                 case 3:
105                 case 5:
106                 case 6:
107                     return '[В прошлую] dddd [в] LT';
108                 }
109             },
110             sameElse: 'L'
111         },
112         relativeTime : {
113             future : "через %s",
114             past : "%s назад",
115             s : "несколько секунд",
116             m : relativeTimeWithPlural,
117             mm : relativeTimeWithPlural,
118             h : "час",
119             hh : relativeTimeWithPlural,
120             d : "день",
121             dd : relativeTimeWithPlural,
122             M : "месяц",
123             MM : relativeTimeWithPlural,
124             y : "год",
125             yy : relativeTimeWithPlural
126         },
128         // M. E.: those two are virtually unused but a user might want to implement them for his/her website for some reason
130         meridiem : function (hour, minute, isLower) {
131             if (hour < 4) {
132                 return "ночи";
133             } else if (hour < 12) {
134                 return "утра";
135             } else if (hour < 17) {
136                 return "дня";
137             } else {
138                 return "вечера";
139             }
140         },
142         ordinal: function (number, period) {
143             switch (period) {
144             case 'M':
145             case 'd':
146             case 'DDD':
147                 return number + '-й';
148             case 'D':
149                 return number + '-го';
150             case 'w':
151             case 'W':
152                 return number + '-я';
153             default:
154                 return number;
155             }
156         },
158         week : {
159             dow : 1, // Monday is the first day of the week.
160             doy : 7  // The week that contains Jan 1st is the first week of the year.
161         }
162     });
163 }));