* Updates
[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 # Internationalisation code
73 #--------------------------------------------------------------------------
74
75 class LanguageFi extends LanguageUtf8 {
76 function LanguageFi() {
77 global $wgNamespaceNamesFi, $wgMetaNamespace;
78 LanguageUtf8::LanguageUtf8();
79 $wgNamespaceNamesFi[NS_PROJECT_TALK] = 'Keskustelu_' . $this->convertGrammar( $wgMetaNamespace, 'elative' );
80 }
81
82 function getBookstoreList () {
83 global $wgBookstoreListFi ;
84 return $wgBookstoreListFi ;
85 }
86
87 function getNamespaces() {
88 global $wgNamespaceNamesFi;
89 return $wgNamespaceNamesFi;
90 }
91
92 function getQuickbarSettings() {
93 global $wgQuickbarSettingsFi;
94 return $wgQuickbarSettingsFi;
95 }
96
97 function getSkinNames() {
98 global $wgSkinNamesFi;
99 return $wgSkinNamesFi;
100 }
101
102 function getDateFormats() {
103 global $wgDateFormatsFi;
104 return $wgDateFormatsFi;
105 }
106
107 /**
108 * See Language.php for documentation
109 */
110 function date( $ts, $adj = false, $format = true, $timecorrection = false ) {
111 if ( $adj ) { $ts = $this->userAdjust( $ts, $timecorrection ); }
112
113 $yyyy = substr( $ts, 0, 4 );
114 $mm = substr( $ts, 4, 2 );
115 $m = 0 + $mm;
116 $mmmm = $this->getMonthName( $mm ) . 'ta';
117 $dd = substr( $ts, 6, 2 );
118 $d = 0 + $dd;
119
120 $datePreference = $this->dateFormat($format);
121 switch( $datePreference ) {
122 case '3': return "$d.$m.$yyyy";
123 case MW_DATE_ISO: return "$yyyy-$mm-$dd";
124 default: return "$d. $mmmm $yyyy";
125 }
126 }
127
128 /**
129 * See Language.php for documentation
130 */
131 function time( $ts, $adj = false, $format = true, $timecorrection = false ) {
132 if ( $adj ) { $ts = $this->userAdjust( $ts, $timecorrection ); }
133
134 $hh = substr( $ts, 8, 2 );
135 $mm = substr( $ts, 10, 2 );
136 $ss = substr( $ts, 12, 2 );
137
138 $datePreference = $this->dateFormat($format);
139 switch( $datePreference ) {
140 case '2':
141 case MW_DATE_ISO: return "$hh:$mm:$ss";
142 default: return "$hh.$mm";
143 }
144 }
145
146 /**
147 * See Language.php for documentation
148 */
149 function timeanddate( $ts, $adj = false, $format = true, $timecorrection = false) {
150 $date = $this->date( $ts, $adj, $format, $timecorrection );
151 $time = $this->time( $ts, $adj, $format, $timecorrection );
152
153 $datePreference = $this->dateFormat($format);
154 switch( $datePreference ) {
155 case '3':
156 case MW_DATE_ISO: return "$date $time";
157 default: return "$date kello $time";
158 }
159 }
160
161 function getMessage( $key ) {
162 global $wgAllMessagesFi;
163 if( isset( $wgAllMessagesFi[$key] ) ) {
164 return $wgAllMessagesFi[$key];
165 } else {
166 return parent::getMessage( $key );
167 }
168 }
169
170 /**
171 * Finnish numeric formatting is 123 456,78.
172 */
173 function separatorTransformTable() {
174 return array(',' => "\xc2\xa0", '.' => ',' );
175 }
176
177 /**
178 * Avoid grouping whole numbers between 0 to 9999
179 */
180 function commafy($_) {
181 if (!preg_match('/^\d{1,4}$/',$_)) {
182 return strrev((string)preg_replace('/(\d{3})(?=\d)(?!\d*\.)/','$1,',strrev($_)));
183 } else {
184 return $_;
185 }
186 }
187
188 function linkTrail() {
189 return '/^([a-zäö]+)(.*)$/sDu';
190 }
191
192
193 # Convert from the nominative form of a noun to some other case
194 # Invoked with {{GRAMMAR:case|word}}
195 function convertGrammar( $word, $case ) {
196 # These rules are not perfect, but they are currently only used for site names so it doesn't
197 # matter if they are wrong sometimes. Just add a special case for your site name if necessary.
198 switch ( $case ) {
199 case 'genitive':
200 if ( $word == 'Wikisitaatit' ) {
201 $word = 'Wikisitaattien';
202 } else {
203 $word .= 'n';
204 }
205 break;
206 case 'elative':
207 if ( $word == 'Wikisitaatit' ) {
208 $word = 'Wikisitaateista';
209 } else {
210 if ( mb_substr($word, -1) == 'y' ) {
211 $word .= 'stä';
212 } else {
213 $word .= 'sta';
214 }
215 }
216 break;
217 case 'partitive':
218 if ( $word == 'Wikisitaatit' ) {
219 $word = 'Wikisitaatteja';
220 } else {
221 if ( mb_substr($word, -1) == 'y' ) {
222 $word .= 'ä';
223 } else {
224 $word .= 'a';
225 }
226 }
227 break;
228 case 'illative':
229 # Double the last letter and add 'n'
230 # mb_substr has a compatibility function in GlobalFunctions.php
231 if ( $word == 'Wikisitaatit' ) {
232 $word = 'Wikisitaatteihin';
233 } else {
234 $word = $word . mb_substr($word,-1) . 'n';
235 }
236 break;
237 case 'inessive':
238 if ( $word == 'Wikisitaatit' ) {
239 $word = 'Wikisitaateissa';
240 } else {
241 if ( mb_substr($word, -1) == 'y' ) {
242 $word .= 'ssä';
243 } else {
244 $word .= 'ssa';
245 }
246 }
247 break;
248
249 }
250 return $word;
251 }
252
253 function translateBlockExpiry( $str ) {
254 /*
255 'ago', 'now', 'today', 'this', 'next',
256 'first', 'third', 'fourth', 'fifth', 'sixth', 'seventh', 'eighth', 'ninth', 'tenth', 'eleventh', 'twelfth',
257 'tomorrow', 'yesterday'
258
259 $months = 'january:tammikuu,february:helmikuu,march:maaliskuu,april:huhtikuu,may:toukokuu,june:kesäkuu,' .
260 'july:heinäkuu,august:elokuu,september:syyskuu,october:lokakuu,november:marraskuu,december:joulukuu,' .
261 'jan:tammikuu,feb:helmikuu,mar:maaliskuu,apr:huhtikuu,jun:kesäkuu,jul:heinäkuu,aug:elokuu,sep:syyskuu,'.
262 'oct:lokakuu,nov:marraskuu,dec:joulukuu,sept:syyskuu';
263 */
264 $weekds = array(
265 'monday' => 'maanantai',
266 'tuesday' => 'tiistai',
267 'wednesday' => 'keskiviikko',
268 'thursay' => 'torstai',
269 'friday' => 'perjantai',
270 'saturday' => 'lauantai',
271 'sunday' => 'sunnuntai',
272 'mon' => 'ma',
273 'tue' => 'ti',
274 'tues' => 'ti',
275 'wed' => 'ke',
276 'wednes' => 'ke',
277 'thu' => 'to',
278 'thur' => 'to',
279 'thurs' => 'to',
280 'fri' => 'pe',
281 'sat' => 'la',
282 'sun' => 'su',
283 'next' => 'seuraava',
284 'tomorrow' => 'huomenna',
285 'ago' => 'sitten',
286 'seconds' => 'sekuntia',
287 'second' => 'sekunti',
288 'secs' => 's',
289 'sec' => 's',
290 'minutes' => 'minuuttia',
291 'minute' => 'minuutti',
292 'mins' => 'min',
293 'min' => 'min',
294 'days' => 'päivää',
295 'day' => 'päivä',
296 'hours' => 'tuntia',
297 'hour' => 'tunti',
298 'weeks' => 'viikkoa',
299 'week' => 'viikko',
300 'fortnights' => 'tuplaviikkoa',
301 'fortnight' => 'tuplaviikko',
302 'months' => 'kuukautta',
303 'month' => 'kuukausi',
304 'years' => 'vuotta',
305 'year' => 'vuosi',
306 'infinite' => 'ikuisesti',
307 'indefinite' => 'ikuisesti'
308 );
309
310 $final = '';
311 $tokens = explode ( ' ', $str);
312 foreach( $tokens as $item ) {
313 if ( !is_numeric($item) ) {
314 if ( count ( explode( '-', $item ) ) == 3 && strlen($item) == 10 ) {
315 list( $yyyy, $mm, $dd ) = explode( '-', $item );
316 $final .= ' ' . $this->date( "{$yyyy}{$mm}{$dd}00000000");
317 continue;
318 }
319 if( isset( $weekds[$item] ) ) {
320 $final .= ' ' . $weekds[$item];
321 continue;
322 }
323 }
324
325 $final .= ' ' . $item;
326 }
327 return '<span class="blockexpiry" title="' . htmlspecialchars($str). '">”' . trim( $final ) . '”</span>';
328 }
329
330 }
331
332 ?>