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