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.substr( word.length - 1 ) === 'ь' ) {
19 word = word.substr(0, word.length - 1 ) + 'я';
20 } else if ( word.substr( word.length - 2 ) === 'ия' ) {
21 word = word.substr(0, word.length - 2 ) + 'ии';
22 } else if ( word.substr( word.length - 2 ) === 'ка' ) {
23 word = word.substr(0, word.length - 2 ) + 'ки';
24 } else if ( word.substr( word.length - 2 ) === 'ти' ) {
25 word = word.substr(0, word.length - 2 ) + 'тей';
26 } else if ( word.substr( word.length - 2 ) === 'ды' ) {
27 word = word.substr(0, word.length - 2 ) + 'дов';
28 } else if ( word.substr( word.length - 1 ) === 'д' ) {
29 word = word.substr(0, word.length - 1 ) + 'да';
30 } else if ( word.substr( word.length - 3 ) === 'ные' ) {
31 word = word.substr(0, word.length - 3 ) + 'ных';
32 } else if ( word.substr( word.length - 3 ) === 'ник' ) {
33 word = word.substr(0, word.length - 3 ) + 'ника';
36 case 'prepositional': // предложный падеж
37 if ( word.substr( word.length - 1 ) === 'ь' ) {
38 word = word.substr(0, word.length - 1 ) + 'е';
39 } else if ( word.substr( word.length - 2 ) === 'ия' ) {
40 word = word.substr(0, word.length - 2 ) + 'ии';
41 } else if ( word.substr( word.length - 2 ) === 'ка' ) {
42 word = word.substr(0, word.length - 2 ) + 'ке';
43 } else if ( word.substr( word.length - 2 ) === 'ти' ) {
44 word = word.substr(0, word.length - 2 ) + 'тях';
45 } else if ( word.substr( word.length - 2 ) === 'ды' ) {
46 word = word.substr(0, word.length - 2 ) + 'дах';
47 } else if ( word.substr( word.length - 1 ) === 'д' ) {
48 word = word.substr(0, word.length - 1 ) + 'де';
49 } else if ( word.substr( word.length - 3 ) === 'ные' ) {
50 word = word.substr(0, word.length - 3 ) + 'ных';
51 } else if ( word.substr( word.length - 3 ) === 'ник' ) {
52 word = word.substr(0, word.length - 3 ) + 'нике';