remove EOL whitespace, and excess empty lines
[lhc/web/wiklou.git] / languages / classes / LanguageFi.php
1 <?php
2 /** Finnish (Suomi)
3 *
4 * @addtogroup Language
5 *
6 * @author Niklas Laxström
7 */
8 class LanguageFi extends Language {
9
10 # Convert from the nominative form of a noun to some other case
11 # Invoked with {{GRAMMAR:case|word}}
12 function convertGrammar( $word, $case ) {
13 global $wgGrammarForms;
14 if ( isset($wgGrammarForms['fi'][$case][$word]) ) {
15 return $wgGrammarForms['fi'][$case][$word];
16 }
17
18 # These rules are not perfect, but they are currently only used for site names so it doesn't
19 # matter if they are wrong sometimes. Just add a special case for your site name if necessary.
20
21 # wovel harmony flag
22 $aou = preg_match( '/[aou][^äöy]*$/i', $word );
23
24 # The flag should be false for compounds where the last word has only neutral vowels (e/i).
25 # The general case cannot be handled without a dictionary, but there's at least one notable
26 # special case we should check for:
27
28 if ( preg_match( '/wiki$/i', $word ) )
29 $aou = false;
30
31 # append i after final consonant
32 if ( preg_match( '/[bcdfghjklmnpqrstvwxz]$/i', $word ) )
33 $word .= 'i';
34
35 switch ( $case ) {
36 case 'genitive':
37 $word .= 'n';
38 break;
39 case 'elative':
40 $word .= ($aou ? 'sta' : 'stä');
41 break;
42 case 'partitive':
43 $word .= ($aou ? 'a' : 'ä');
44 break;
45 case 'illative':
46 # Double the last letter and add 'n'
47 # mb_substr has a compatibility function in GlobalFunctions.php
48 $word = $word . mb_substr($word, -1) . 'n';
49 break;
50 case 'inessive':
51 $word .= ($aou ? 'ssa' : 'ssä');
52 break;
53 }
54 return $word;
55 }
56
57 function translateBlockExpiry( $str, $forContent = false ) {
58 /*
59 'ago', 'now', 'today', 'this', 'next',
60 'first', 'third', 'fourth', 'fifth', 'sixth', 'seventh', 'eighth', 'ninth', 'tenth', 'eleventh', 'twelfth',
61 'tomorrow', 'yesterday'
62
63 $months = 'january:tammikuu,february:helmikuu,march:maaliskuu,april:huhtikuu,may:toukokuu,june:kesäkuu,' .
64 'july:heinäkuu,august:elokuu,september:syyskuu,october:lokakuu,november:marraskuu,december:joulukuu,' .
65 'jan:tammikuu,feb:helmikuu,mar:maaliskuu,apr:huhtikuu,jun:kesäkuu,jul:heinäkuu,aug:elokuu,sep:syyskuu,'.
66 'oct:lokakuu,nov:marraskuu,dec:joulukuu,sept:syyskuu';
67 */
68 $weekds = array(
69 'monday' => 'maanantai',
70 'tuesday' => 'tiistai',
71 'wednesday' => 'keskiviikko',
72 'thursay' => 'torstai',
73 'friday' => 'perjantai',
74 'saturday' => 'lauantai',
75 'sunday' => 'sunnuntai',
76 'mon' => 'ma',
77 'tue' => 'ti',
78 'tues' => 'ti',
79 'wed' => 'ke',
80 'wednes' => 'ke',
81 'thu' => 'to',
82 'thur' => 'to',
83 'thurs' => 'to',
84 'fri' => 'pe',
85 'sat' => 'la',
86 'sun' => 'su',
87 'next' => 'seuraava',
88 'tomorrow' => 'huomenna',
89 'ago' => 'sitten',
90 'seconds' => 'sekuntia',
91 'second' => 'sekunti',
92 'secs' => 's',
93 'sec' => 's',
94 'minutes' => 'minuuttia',
95 'minute' => 'minuutti',
96 'mins' => 'min',
97 'min' => 'min',
98 'days' => 'päivää',
99 'day' => 'päivä',
100 'hours' => 'tuntia',
101 'hour' => 'tunti',
102 'weeks' => 'viikkoa',
103 'week' => 'viikko',
104 'fortnights' => 'tuplaviikkoa',
105 'fortnight' => 'tuplaviikko',
106 'months' => 'kuukautta',
107 'month' => 'kuukausi',
108 'years' => 'vuotta',
109 'year' => 'vuosi',
110 'infinite' => 'ikuisesti',
111 'indefinite' => 'ikuisesti'
112 );
113
114 $final = '';
115 $tokens = explode ( ' ', $str);
116 foreach( $tokens as $item ) {
117 if ( !is_numeric($item) ) {
118 if ( count ( explode( '-', $item ) ) == 3 && strlen($item) == 10 ) {
119 list( $yyyy, $mm, $dd ) = explode( '-', $item );
120 $final .= ' ' . $this->date( "{$yyyy}{$mm}{$dd}00000000");
121 continue;
122 }
123 if( isset( $weekds[$item] ) ) {
124 $final .= ' ' . $weekds[$item];
125 continue;
126 }
127 }
128
129 $final .= ' ' . $item;
130 }
131
132 return htmlspecialchars( trim( $final ) );
133 }
134 }