2 * Russian (Русский) language functions
5 // These tests were originally made for names of Wikimedia
6 // websites, so they don't currently cover all the possible
9 mediaWiki.language.convertGrammar = function ( word, form ) {
12 var grammarForms = mediaWiki.language.getData( 'ru', 'grammarForms' );
13 if ( grammarForms && grammarForms[form] ) {
14 return grammarForms[form][word];
17 case 'genitive': // родительный падеж
18 if ( word.slice( -1 ) === 'ь' ) {
19 word = word.slice( 0, -1 ) + 'я';
20 } else if ( word.slice( -2 ) === 'ия' ) {
21 word = word.slice( 0, -2 ) + 'ии';
22 } else if ( word.slice( -2 ) === 'ка' ) {
23 word = word.slice( 0, -2 ) + 'ки';
24 } else if ( word.slice( -2 ) === 'ти' ) {
25 word = word.slice( 0, -2 ) + 'тей';
26 } else if ( word.slice( -2 ) === 'ды' ) {
27 word = word.slice( 0, -2 ) + 'дов';
28 } else if ( word.slice( -1 ) === 'д' ) {
29 word = word.slice( 0, -1 ) + 'да';
30 } else if ( word.slice( -3 ) === 'ные' ) {
31 word = word.slice( 0, -3 ) + 'ных';
32 } else if ( word.slice( -3 ) === 'ник' ) {
33 word = word.slice( 0, -3 ) + 'ника';
36 case 'prepositional': // предложный падеж
37 if ( word.slice( -1 ) === 'ь' ) {
38 word = word.slice( 0, -1 ) + 'е';
39 } else if ( word.slice( -2 ) === 'ия' ) {
40 word = word.slice( 0, -2 ) + 'ии';
41 } else if ( word.slice( -2 ) === 'ка' ) {
42 word = word.slice( 0, -2 ) + 'ке';
43 } else if ( word.slice( -2 ) === 'ти' ) {
44 word = word.slice( 0, -2 ) + 'тях';
45 } else if ( word.slice( -2 ) === 'ды' ) {
46 word = word.slice( 0, -2 ) + 'дах';
47 } else if ( word.slice( -1 ) === 'д' ) {
48 word = word.slice( 0, -1 ) + 'де';
49 } else if ( word.slice( -3 ) === 'ные' ) {
50 word = word.slice( 0, -3 ) + 'ных';
51 } else if ( word.slice( -3 ) === 'ник' ) {
52 word = word.slice( 0, -3 ) + 'нике';