MediaWiki
REL1_24
|
00001 <?php 00030 class LanguageFi extends Language { 00039 function convertGrammar( $word, $case ) { 00040 global $wgGrammarForms; 00041 if ( isset( $wgGrammarForms['fi'][$case][$word] ) ) { 00042 return $wgGrammarForms['fi'][$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 # wovel harmony flag 00049 $aou = preg_match( '/[aou][^äöy]*$/i', $word ); 00050 00051 # The flag should be false for compounds where the last word has only neutral vowels (e/i). 00052 # The general case cannot be handled without a dictionary, but there's at least one notable 00053 # special case we should check for: 00054 00055 if ( preg_match( '/wiki$/i', $word ) ) { 00056 $aou = false; 00057 } 00058 00059 # append i after final consonant 00060 if ( preg_match( '/[bcdfghjklmnpqrstvwxz]$/i', $word ) ) { 00061 $word .= 'i'; 00062 } 00063 00064 switch ( $case ) { 00065 case 'genitive': 00066 $word .= 'n'; 00067 break; 00068 case 'elative': 00069 $word .= ( $aou ? 'sta' : 'stä' ); 00070 break; 00071 case 'partitive': 00072 $word .= ( $aou ? 'a' : 'ä' ); 00073 break; 00074 case 'illative': 00075 # Double the last letter and add 'n' 00076 # mb_substr has a compatibility function in GlobalFunctions.php 00077 $word = $word . mb_substr( $word, -1 ) . 'n'; 00078 break; 00079 case 'inessive': 00080 $word .= ( $aou ? 'ssa' : 'ssä' ); 00081 break; 00082 } 00083 return $word; 00084 } 00085 00091 function translateBlockExpiry( $str, $forContent = false ) { 00092 /* 00093 'ago', 'now', 'today', 'this', 'next', 00094 'first', 'third', 'fourth', 'fifth', 'sixth', 'seventh', 'eighth', 'ninth', 00095 'tenth', 'eleventh', 'twelfth', 00096 'tomorrow', 'yesterday' 00097 00098 $months = 'january:tammikuu,february:helmikuu,march:maaliskuu,april:huhtikuu,' . 00099 'may:toukokuu,june:kesäkuu,july:heinäkuu,august:elokuu,september:syyskuu,' . 00100 'october:lokakuu,november:marraskuu,december:joulukuu,' . 00101 'jan:tammikuu,feb:helmikuu,mar:maaliskuu,apr:huhtikuu,jun:kesäkuu,' . 00102 'jul:heinäkuu,aug:elokuu,sep:syyskuu,oct:lokakuu,nov:marraskuu,' . 00103 dec:joulukuu,sept:syyskuu'; 00104 */ 00105 $weekds = array( 00106 'monday' => 'maanantai', 00107 'tuesday' => 'tiistai', 00108 'wednesday' => 'keskiviikko', 00109 'thursday' => 'torstai', 00110 'friday' => 'perjantai', 00111 'saturday' => 'lauantai', 00112 'sunday' => 'sunnuntai', 00113 'mon' => 'ma', 00114 'tue' => 'ti', 00115 'tues' => 'ti', 00116 'wed' => 'ke', 00117 'wednes' => 'ke', 00118 'thu' => 'to', 00119 'thur' => 'to', 00120 'thurs' => 'to', 00121 'fri' => 'pe', 00122 'sat' => 'la', 00123 'sun' => 'su', 00124 'next' => 'seuraava', 00125 'tomorrow' => 'huomenna', 00126 'ago' => 'sitten', 00127 'seconds' => 'sekuntia', 00128 'second' => 'sekunti', 00129 'secs' => 's', 00130 'sec' => 's', 00131 'minutes' => 'minuuttia', 00132 'minute' => 'minuutti', 00133 'mins' => 'min', 00134 'min' => 'min', 00135 'days' => 'päivää', 00136 'day' => 'päivä', 00137 'hours' => 'tuntia', 00138 'hour' => 'tunti', 00139 'weeks' => 'viikkoa', 00140 'week' => 'viikko', 00141 'fortnights' => 'tuplaviikkoa', 00142 'fortnight' => 'tuplaviikko', 00143 'months' => 'kuukautta', 00144 'month' => 'kuukausi', 00145 'years' => 'vuotta', 00146 'year' => 'vuosi', 00147 'infinite' => 'ikuisesti', 00148 'indefinite' => 'ikuisesti' 00149 ); 00150 00151 $final = ''; 00152 $tokens = explode ( ' ', $str ); 00153 foreach ( $tokens as $item ) { 00154 if ( !is_numeric( $item ) ) { 00155 if ( count ( explode( '-', $item ) ) == 3 && strlen( $item ) == 10 ) { 00156 list( $yyyy, $mm, $dd ) = explode( '-', $item ); 00157 $final .= ' ' . $this->date( "{$yyyy}{$mm}{$dd}000000" ); 00158 continue; 00159 } 00160 if ( isset( $weekds[$item] ) ) { 00161 $final .= ' ' . $weekds[$item]; 00162 continue; 00163 } 00164 } 00165 00166 $final .= ' ' . $item; 00167 } 00168 00169 return htmlspecialchars( trim( $final ) ); 00170 } 00171 }