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