MediaWiki
REL1_19
|
00001 <?php 00002 00007 class LanguageCu extends Language { 00008 00017 function convertGrammar( $word, $case ) { 00018 global $wgGrammarForms; 00019 if ( isset( $wgGrammarForms['сu'][$case][$word] ) ) { 00020 return $wgGrammarForms['сu'][$case][$word]; 00021 } 00022 00023 # These rules are not perfect, but they are currently only used for site names so it doesn't 00024 # matter if they are wrong sometimes. Just add a special case for your site name if necessary. 00025 00026 # join and array_slice instead mb_substr 00027 $ar = array(); 00028 preg_match_all( '/./us', $word, $ar ); 00029 if ( !preg_match( "/[a-zA-Z_]/us", $word ) ) 00030 switch ( $case ) { 00031 case 'genitive': # родительный падеж 00032 if ( ( join( '', array_slice( $ar[0], -4 ) ) == 'вики' ) || ( join( '', array_slice( $ar[0], -4 ) ) == 'Вики' ) ) 00033 { } 00034 elseif ( join( '', array_slice( $ar[0], -2 ) ) == 'ї' ) 00035 $word = join( '', array_slice( $ar[0], 0, -2 ) ) . 'їѩ'; 00036 break; 00037 case 'accusative': # винительный падеж 00038 # stub 00039 break; 00040 } 00041 return $word; 00042 } 00043 00049 function convertPlural( $count, $forms ) { 00050 if ( !count( $forms ) ) { return ''; } 00051 $forms = $this->preConvertPlural( $forms, 4 ); 00052 00053 switch ( $count % 10 ) { 00054 case 1: return $forms[0]; 00055 case 2: return $forms[1]; 00056 case 3: 00057 case 4: return $forms[2]; 00058 default: return $forms[3]; 00059 } 00060 } 00061 }