MediaWiki
REL1_20
|
00001 <?php 00029 class LanguageSl extends Language { 00030 # Convert from the nominative form of a noun to some other case 00031 # Invoked with {{GRAMMAR:case|word}} 00032 00040 function convertGrammar( $word, $case ) { 00041 global $wgGrammarForms; 00042 if ( isset( $wgGrammarForms['sl'][$case][$word] ) ) { 00043 return $wgGrammarForms['sl'][$case][$word]; 00044 } 00045 00046 switch ( $case ) { 00047 case 'mestnik': # locative 00048 $word = 'o ' . $word; break; 00049 case 'orodnik': # instrumental 00050 $word = 'z ' . $word; 00051 } 00052 00053 return $word; # this will return the original value for 'imenovalnik' (nominativ) and all undefined case values 00054 } 00055 00062 function convertPlural( $count, $forms ) { 00063 if ( !count( $forms ) ) { return ''; } 00064 $forms = $this->preConvertPlural( $forms, 5 ); 00065 00066 if ( $count % 100 == 1 ) { 00067 $index = 0; 00068 } elseif ( $count % 100 == 2 ) { 00069 $index = 1; 00070 } elseif ( $count % 100 == 3 || $count % 100 == 4 ) { 00071 $index = 2; 00072 } elseif ( $count != 0 ) { 00073 $index = 3; 00074 } else { 00075 $index = 4; 00076 } 00077 return $forms[$index]; 00078 } 00079 }