MediaWiki
REL1_19
|
00001 <?php 00002 00007 class LanguageSl extends Language { 00008 # Convert from the nominative form of a noun to some other case 00009 # Invoked with {{GRAMMAR:case|word}} 00010 00018 function convertGrammar( $word, $case ) { 00019 global $wgGrammarForms; 00020 if ( isset( $wgGrammarForms['sl'][$case][$word] ) ) { 00021 return $wgGrammarForms['sl'][$case][$word]; 00022 } 00023 00024 switch ( $case ) { 00025 case 'mestnik': # locative 00026 $word = 'o ' . $word; break; 00027 case 'orodnik': # instrumental 00028 $word = 'z ' . $word; 00029 } 00030 00031 return $word; # this will return the original value for 'imenovalnik' (nominativ) and all undefined case values 00032 } 00033 00040 function convertPlural( $count, $forms ) { 00041 if ( !count( $forms ) ) { return ''; } 00042 $forms = $this->preConvertPlural( $forms, 5 ); 00043 00044 if ( $count % 100 == 1 ) { 00045 $index = 0; 00046 } elseif ( $count % 100 == 2 ) { 00047 $index = 1; 00048 } elseif ( $count % 100 == 3 || $count % 100 == 4 ) { 00049 $index = 2; 00050 } elseif ( $count != 0 ) { 00051 $index = 3; 00052 } else { 00053 $index = 4; 00054 } 00055 return $forms[$index]; 00056 } 00057 }