7 * @author Niklas Laxström
9 class LanguageFi
extends Language
{
12 * Convert from the nominative form of a noun to some other case
13 * Invoked with {{grammar:case|word}}
19 function convertGrammar( $word, $case ) {
20 global $wgGrammarForms;
21 if ( isset( $wgGrammarForms['fi'][$case][$word] ) ) {
22 return $wgGrammarForms['fi'][$case][$word];
25 # These rules are not perfect, but they are currently only used for site names so it doesn't
26 # matter if they are wrong sometimes. Just add a special case for your site name if necessary.
29 $aou = preg_match( '/[aou][^äöy]*$/i', $word );
31 # The flag should be false for compounds where the last word has only neutral vowels (e/i).
32 # The general case cannot be handled without a dictionary, but there's at least one notable
33 # special case we should check for:
35 if ( preg_match( '/wiki$/i', $word ) )
38 # append i after final consonant
39 if ( preg_match( '/[bcdfghjklmnpqrstvwxz]$/i', $word ) )
47 $word .= ( $aou ?
'sta' : 'stä' );
50 $word .= ( $aou ?
'a' : 'ä' );
53 # Double the last letter and add 'n'
54 # mb_substr has a compatibility function in GlobalFunctions.php
55 $word = $word . mb_substr( $word, -1 ) . 'n';
58 $word .= ( $aou ?
'ssa' : 'ssä' );
66 * @param $forContent bool
69 function translateBlockExpiry( $str, $forContent = false ) {
71 'ago', 'now', 'today', 'this', 'next',
72 'first', 'third', 'fourth', 'fifth', 'sixth', 'seventh', 'eighth', 'ninth', 'tenth', 'eleventh', 'twelfth',
73 'tomorrow', 'yesterday'
75 $months = 'january:tammikuu,february:helmikuu,march:maaliskuu,april:huhtikuu,may:toukokuu,june:kesäkuu,' .
76 'july:heinäkuu,august:elokuu,september:syyskuu,october:lokakuu,november:marraskuu,december:joulukuu,' .
77 'jan:tammikuu,feb:helmikuu,mar:maaliskuu,apr:huhtikuu,jun:kesäkuu,jul:heinäkuu,aug:elokuu,sep:syyskuu,'.
78 'oct:lokakuu,nov:marraskuu,dec:joulukuu,sept:syyskuu';
81 'monday' => 'maanantai',
82 'tuesday' => 'tiistai',
83 'wednesday' => 'keskiviikko',
84 'thursay' => 'torstai',
85 'friday' => 'perjantai',
86 'saturday' => 'lauantai',
87 'sunday' => 'sunnuntai',
100 'tomorrow' => 'huomenna',
102 'seconds' => 'sekuntia',
103 'second' => 'sekunti',
106 'minutes' => 'minuuttia',
107 'minute' => 'minuutti',
114 'weeks' => 'viikkoa',
116 'fortnights' => 'tuplaviikkoa',
117 'fortnight' => 'tuplaviikko',
118 'months' => 'kuukautta',
119 'month' => 'kuukausi',
122 'infinite' => 'ikuisesti',
123 'indefinite' => 'ikuisesti'
127 $tokens = explode ( ' ', $str );
128 foreach ( $tokens as $item ) {
129 if ( !is_numeric( $item ) ) {
130 if ( count ( explode( '-', $item ) ) == 3 && strlen( $item ) == 10 ) {
131 list( $yyyy, $mm, $dd ) = explode( '-', $item );
132 $final .= ' ' . $this->date( "{$yyyy}{$mm}{$dd}000000" );
135 if ( isset( $weekds[$item] ) ) {
136 $final .= ' ' . $weekds[$item];
141 $final .= ' ' . $item;
144 return htmlspecialchars( trim( $final ) );