MediaWiki  REL1_22
LanguageCu.php
Go to the documentation of this file.
00001 <?php
00029 class LanguageCu extends Language {
00030 
00039     function convertGrammar( $word, $case ) {
00040         global $wgGrammarForms;
00041         if ( isset( $wgGrammarForms['сu'][$case][$word] ) ) {
00042             return $wgGrammarForms['сu'][$case][$word];
00043         }
00044 
00045         # These rules are not perfect, but they are currently only used for site names so it doesn't
00046         # matter if they are wrong sometimes. Just add a special case for your site name if necessary.
00047 
00048         # join and array_slice instead mb_substr
00049         $ar = array();
00050         preg_match_all( '/./us', $word, $ar );
00051         if ( !preg_match( "/[a-zA-Z_]/us", $word ) ) {
00052             switch ( $case ) {
00053                 case 'genitive': # родительный падеж
00054                     if ( ( join( '', array_slice( $ar[0], -4 ) ) == 'вики' ) || ( join( '', array_slice( $ar[0], -4 ) ) == 'Вики' ) ) {
00055                     } elseif ( join( '', array_slice( $ar[0], -2 ) ) == 'ї' ) {
00056                         $word = join( '', array_slice( $ar[0], 0, -2 ) ) . 'їѩ';
00057                     }
00058                     break;
00059                 case 'accusative': # винительный падеж
00060                     # stub
00061                     break;
00062             }
00063         }
00064         return $word;
00065     }
00066 }