* (bug 5640) Indonesian localisation improvements
[lhc/web/wiklou.git] / languages / LanguageFi.php
1 <?php
2 /** Finnish (Suomi)
3 *
4 * @package MediaWiki
5 * @subpackage Language
6 */
7
8 require_once( 'LanguageUtf8.php' );
9
10 # Revised 2005-12-24 for MediaWiki 1.6dev -- Nikerabbit
11
12 /* private */ $wgNamespaceNamesFi = array(
13 NS_MEDIA => 'Media',
14 NS_SPECIAL => 'Toiminnot',
15 NS_MAIN => '',
16 NS_TALK => 'Keskustelu',
17 NS_USER => 'Käyttäjä',
18 NS_USER_TALK => 'Keskustelu_käyttäjästä',
19 NS_PROJECT => $wgMetaNamespace,
20 NS_PROJECT_TALK => FALSE, # Set in constructor
21 NS_IMAGE => 'Kuva',
22 NS_IMAGE_TALK => 'Keskustelu_kuvasta',
23 NS_MEDIAWIKI => 'MediaWiki',
24 NS_MEDIAWIKI_TALK => 'MediaWiki_talk',
25 NS_TEMPLATE => 'Malline',
26 NS_TEMPLATE_TALK => 'Keskustelu_mallineesta',
27 NS_HELP => 'Ohje',
28 NS_HELP_TALK => 'Keskustelu_ohjeesta',
29 NS_CATEGORY => 'Luokka',
30 NS_CATEGORY_TALK => 'Keskustelu_luokasta'
31
32 ) + $wgNamespaceNamesEn;
33
34 /* private */ $wgQuickbarSettingsFi = array(
35 'Ei mitään', 'Tekstin mukana, vasen', 'Tekstin mukana, oikea', 'Pysyen vasemmalla'
36 );
37
38 /* private */ $wgSkinNamesFi = array(
39 'standard' => 'Perus',
40 'cologneblue' => 'Kölnin sininen',
41 'myskin' => 'Oma tyylisivu'
42 ) + $wgSkinNamesEn;
43
44 /* private */ $wgDateFormatsFi = array(
45 MW_DATE_DEFAULT => 'Ei valintaa',
46 1 => '15. tammikuuta 2001 kello 16.12',
47 2 => '15. tammikuuta 2001 kello 16:12:34',
48 3 => '15.1.2001 16.12',
49 MW_DATE_ISO => '2001-01-15 16:12:34'
50 );
51
52 /* private */ $wgBookstoreListFi = array(
53 'Akateeminen kirjakauppa' => 'http://www.akateeminen.com/search/tuotetieto.asp?tuotenro=$1',
54 'Bookplus' => 'http://www.bookplus.fi/product.php?isbn=$1',
55 'Helsingin yliopiston kirjasto' => 'http://pandora.lib.hel.fi/cgi-bin/mhask/monihask.py?volname=&author=&keyword=&ident=$1&submit=Hae&engine_helka=ON',
56 'Pääkaupunkiseudun kirjastot' => 'http://www.helmet.fi/search*fin/i?SEARCH=$1',
57 'Tampereen seudun kirjastot' => 'http://pandora.lib.hel.fi/cgi-bin/mhask/monihask.py?volname=&author=&keyword=&ident=$1-1&lang=kaikki&mat_type=kaikki&submit=Hae&engine_tampere=ON'
58 ) + $wgBookstoreListEn;
59
60 # Current practices (may be changed if not good ones)
61 # Refer namespaces with the English name or 'Project' in case of project namespace
62 # Avoid any hard coded references to any particular subject which may not apply everywhere, e.g. artikkeli, wikipedia
63 # Don't use participial phrases (lauseenkastikkeita) incorrectly
64 # Avoid unnecessary parenthesis, quotes and html code
65 #
66
67 if (!$wgCachedMessageArrays) {
68 require_once('MessagesFi.php');
69 }
70
71 #-------------------------------------------------------------------
72 # Translated messages
73 #-------------------------------------------------------------------
74
75
76
77 #--------------------------------------------------------------------------
78 # Internationalisation code
79 #--------------------------------------------------------------------------
80
81 class LanguageFi extends LanguageUtf8 {
82 function LanguageFi() {
83 global $wgNamespaceNamesFi, $wgMetaNamespace;
84 LanguageUtf8::LanguageUtf8();
85 $wgNamespaceNamesFi[NS_PROJECT_TALK] = 'Keskustelu_' . $this->convertGrammar( $wgMetaNamespace, 'elative' );
86 }
87
88 function getBookstoreList () {
89 global $wgBookstoreListFi ;
90 return $wgBookstoreListFi ;
91 }
92
93 function getNamespaces() {
94 global $wgNamespaceNamesFi;
95 return $wgNamespaceNamesFi;
96 }
97
98 function getQuickbarSettings() {
99 global $wgQuickbarSettingsFi;
100 return $wgQuickbarSettingsFi;
101 }
102
103 function getSkinNames() {
104 global $wgSkinNamesFi;
105 return $wgSkinNamesFi;
106 }
107
108 function getDateFormats() {
109 global $wgDateFormatsFi;
110 return $wgDateFormatsFi;
111 }
112
113 /**
114 * See Language.php for documentation
115 */
116 function date( $ts, $adj = false, $format = true, $timecorrection = false ) {
117 if ( $adj ) { $ts = $this->userAdjust( $ts, $timecorrection ); }
118
119 $yyyy = substr( $ts, 0, 4 );
120 $mm = substr( $ts, 4, 2 );
121 $m = 0 + $mm;
122 $mmmm = $this->getMonthName( $mm ) . 'ta';
123 $dd = substr( $ts, 6, 2 );
124 $d = 0 + $dd;
125
126 $datePreference = $this->dateFormat($format);
127 switch( $datePreference ) {
128 case '3': return "$d.$m.$yyyy";
129 case MW_DATE_ISO: return "$yyyy-$mm-$dd";
130 default: return "$d. $mmmm $yyyy";
131 }
132 }
133
134 /**
135 * See Language.php for documentation
136 */
137 function time( $ts, $adj = false, $format = true, $timecorrection = false ) {
138 if ( $adj ) { $ts = $this->userAdjust( $ts, $timecorrection ); }
139
140 $hh = substr( $ts, 8, 2 );
141 $mm = substr( $ts, 10, 2 );
142 $ss = substr( $ts, 12, 2 );
143
144 $datePreference = $this->dateFormat($format);
145 switch( $datePreference ) {
146 case '2':
147 case MW_DATE_ISO: return "$hh:$mm:$ss";
148 default: return "$hh.$mm";
149 }
150 }
151
152 /**
153 * See Language.php for documentation
154 */
155 function timeanddate( $ts, $adj = false, $format = true, $timecorrection = false) {
156 $date = $this->date( $ts, $adj, $format, $timecorrection );
157 $time = $this->time( $ts, $adj, $format, $timecorrection );
158
159 $datePreference = $this->dateFormat($format);
160 switch( $datePreference ) {
161 case '3':
162 case MW_DATE_ISO: return "$date $time";
163 default: return "$date kello $time";
164 }
165 }
166
167 function getMessage( $key ) {
168 global $wgAllMessagesFi;
169 if( isset( $wgAllMessagesFi[$key] ) ) {
170 return $wgAllMessagesFi[$key];
171 } else {
172 return parent::getMessage( $key );
173 }
174 }
175
176 /**
177 * Finnish numeric formatting is 123 456,78.
178 * Notice that the space is non-breaking.
179 */
180 function formatNum( $number, $year = false ) {
181 return $year ? $number : strtr($this->commafy($number), '.,', ", " );
182 }
183
184 /**
185 * Avoid grouping whole numbers between 0 to 9999
186 */
187 function commafy($_) {
188 if (!preg_match('/^\d{1,4}$/',$_)) {
189 return strrev((string)preg_replace('/(\d{3})(?=\d)(?!\d*\.)/','$1,',strrev($_)));
190 } else {
191 return $_;
192 }
193 }
194
195 # Convert from the nominative form of a noun to some other case
196 # Invoked with {{GRAMMAR:case|word}}
197 function convertGrammar( $word, $case ) {
198 # These rules are not perfect, but they are currently only used for site names so it doesn't
199 # matter if they are wrong sometimes. Just add a special case for your site name if necessary.
200 switch ( $case ) {
201 case 'genitive':
202 if ( $word == 'Wikisitaatit' ) {
203 $word = 'Wikisitaattien';
204 } else {
205 $word .= 'n';
206 }
207 break;
208 case 'elative':
209 if ( $word == 'Wikisitaatit' ) {
210 $word = 'Wikisitaateista';
211 } else {
212 if ( mb_substr($word, -1) == 'y' ) {
213 $word .= 'stä';
214 } else {
215 $word .= 'sta';
216 }
217 }
218 break;
219 case 'partitive':
220 if ( $word == 'Wikisitaatit' ) {
221 $word = 'Wikisitaatteja';
222 } else {
223 if ( mb_substr($word, -1) == 'y' ) {
224 $word .= 'ä';
225 } else {
226 $word .= 'a';
227 }
228 }
229 break;
230 case 'illative':
231 # Double the last letter and add 'n'
232 # mb_substr has a compatibility function in GlobalFunctions.php
233 if ( $word == 'Wikisitaatit' ) {
234 $word = 'Wikisitaatteihin';
235 } else {
236 $word = $word . mb_substr($word,-1) . 'n';
237 }
238 break;
239 case 'inessive':
240 if ( $word == 'Wikisitaatit' ) {
241 $word = 'Wikisitaateissa';
242 } else {
243 if ( mb_substr($word, -1) == 'y' ) {
244 $word .= 'ssä';
245 } else {
246 $word .= 'ssa';
247 }
248 }
249 break;
250
251 }
252 return $word;
253 }
254
255 function translateBlockExpiry( $str ) {
256 /*
257 'ago', 'now', 'today', 'this', 'next',
258 'first', 'third', 'fourth', 'fifth', 'sixth', 'seventh', 'eighth', 'ninth', 'tenth', 'eleventh', 'twelfth',
259 'tomorrow', 'yesterday'
260
261 $months = 'january:tammikuu,february:helmikuu,march:maaliskuu,april:huhtikuu,may:toukokuu,june:kesäkuu,' .
262 'july:heinäkuu,august:elokuu,september:syyskuu,october:lokakuu,november:marraskuu,december:joulukuu,' .
263 'jan:tammikuu,feb:helmikuu,mar:maaliskuu,apr:huhtikuu,jun:kesäkuu,jul:heinäkuu,aug:elokuu,sep:syyskuu,'.
264 'oct:lokakuu,nov:marraskuu,dec:joulukuu,sept:syyskuu';
265 */
266 $weekds = array(
267 'monday' => 'maanantai',
268 'tuesday' => 'tiistai',
269 'wednesday' => 'keskiviikko',
270 'thursay' => 'torstai',
271 'friday' => 'perjantai',
272 'saturday' => 'lauantai',
273 'sunday' => 'sunnuntai',
274 'mon' => 'ma',
275 'tue' => 'ti',
276 'tues' => 'ti',
277 'wed' => 'ke',
278 'wednes' => 'ke',
279 'thu' => 'to',
280 'thur' => 'to',
281 'thurs' => 'to',
282 'fri' => 'pe',
283 'sat' => 'la',
284 'sun' => 'su',
285 'next' => 'seuraava',
286 'tomorrow' => 'huomenna',
287 'ago' => 'sitten',
288 'seconds' => 'sekuntia',
289 'second' => 'sekunti',
290 'secs' => 's',
291 'sec' => 's',
292 'minutes' => 'minuuttia',
293 'minute' => 'minuutti',
294 'mins' => 'min',
295 'min' => 'min',
296 'days' => 'päivää',
297 'day' => 'päivä',
298 'hours' => 'tuntia',
299 'hour' => 'tunti',
300 'weeks' => 'viikkoa',
301 'week' => 'viikko',
302 'fortnights' => 'tuplaviikkoa',
303 'fortnight' => 'tuplaviikko',
304 'months' => 'kuukautta',
305 'month' => 'kuukausi',
306 'years' => 'vuotta',
307 'year' => 'vuosi',
308 'infinite' => 'ikuisesti',
309 'indefinite' => 'ikuisesti'
310 );
311
312 $final = '';
313 $tokens = explode ( ' ', $str);
314 foreach( $tokens as $item ) {
315 if ( !is_numeric($item) ) {
316 if ( count ( explode( '-', $item ) ) == 3 && strlen($item) == 10 ) {
317 list( $yyyy, $mm, $dd ) = explode( '-', $item );
318 $final .= ' ' . $this->date( "{$yyyy}{$mm}{$dd}00000000");
319 continue;
320 }
321 if( isset( $weekds[$item] ) ) {
322 $final .= ' ' . $weekds[$item];
323 continue;
324 }
325 }
326
327 $final .= ' ' . $item;
328 }
329 return '<span class="blockexpiry" title="' . htmlspecialchars($str). '">”' . trim( $final ) . '”</span>';
330 }
331 }
332
333 ?>