Merge "Added ORMIterator interface which can be used for type hinting (in particular...
[lhc/web/wiklou.git] / resources / mediawiki.language / languages / ru.js
1 /**
2 * Russian (Русский) language functions
3 */
4
5 mediaWiki.language.convertPlural = function( count, forms ) {
6 if ( forms.length === 2 ) {
7 return count == 1 ? forms[0] : forms[1];
8 }
9 forms = mediaWiki.language.preConvertPlural( forms, 3 );
10 if ( count > 10 && Math.floor( ( count % 100 ) / 10 ) == 1 ) {
11 return forms[2];
12 }
13 switch ( count % 10 ) {
14 case 1:
15 return forms[0];
16 case 2:
17 case 3:
18 case 4:
19 return forms[1];
20 default:
21 return forms[2];
22 }
23 };
24
25 mediaWiki.language.convertGrammar = function( word, form ) {
26 var grammarForms = mw.language.getData( 'ru', 'grammarForms' );
27 if ( grammarForms && grammarForms[form] ) {
28 return grammarForms[form][word] ;
29 }
30 switch ( form ) {
31 case 'genitive': // родительный падеж
32 if ( ( word.substr( word.length - 4 ) == 'вики' ) || ( word.substr( word.length - 4 ) == 'Вики' ) ) {
33 }
34 else if ( word.substr( word.length - 1 ) == 'ь' )
35 word = word.substr(0, word.length - 1 ) + 'я';
36 else if ( word.substr( word.length - 2 ) == 'ия' )
37 word = word.substr(0, word.length - 2 ) + 'ии';
38 else if ( word.substr( word.length - 2 ) == 'ка' )
39 word = word.substr(0, word.length - 2 ) + 'ки';
40 else if ( word.substr( word.length - 2 ) == 'ти' )
41 word = word.substr(0, word.length - 2 ) + 'тей';
42 else if ( word.substr( word.length - 2 ) == 'ды' )
43 word = word.substr(0, word.length - 2 ) + 'дов';
44 else if ( word.substr( word.length - 3 ) == 'ник' )
45 word = word.substr(0, word.length - 3 ) + 'ника';
46 break;
47 }
48 return word;
49 };