[ Index ] |
PHP Cross Reference of MediaWiki-1.24.0 |
[Summary view] [Print] [Text view]
1 /*! 2 * Russian (Русский) language functions 3 */ 4 5 // These tests were originally made for names of Wikimedia 6 // websites, so they don't currently cover all the possible 7 // cases. 8 9 mediaWiki.language.convertGrammar = function ( word, form ) { 10 'use strict'; 11 12 var grammarForms = mediaWiki.language.getData( 'ru', 'grammarForms' ); 13 if ( grammarForms && grammarForms[form] ) { 14 return grammarForms[form][word]; 15 } 16 switch ( form ) { 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 ) + 'ника'; 34 } 35 break; 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 ) + 'нике'; 53 } 54 break; 55 } 56 return word; 57 };
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 14:03:12 2014 | Cross-referenced by PHPXref 0.7.1 |