7 * @author Niklas Laxström
10 require_once( 'LanguageUtf8.php' );
12 if (!$wgCachedMessageArrays) {
13 require_once('MessagesFi.php');
16 class LanguageFi
extends LanguageUtf8
{
17 private $mMessagesFi, $mNamespaceNamesFi = null;
19 private $mSkinNamesFi = array(
20 'standard' => 'Perus',
21 'cologneblue' => 'Kölnin sininen',
22 'myskin' => 'Oma tyylisivu'
25 private $mQuickbarSettingsFi = array(
26 'Ei mitään', 'Tekstin mukana, vasen', 'Tekstin mukana, oikea', 'Pysyen vasemmalla', 'Pysyen oikealla'
29 private $mDateFormatsFi = array(
30 MW_DATE_DEFAULT
=> 'Ei valintaa',
31 1 => '15. tammikuuta 2001 kello 16.12',
32 2 => '15. tammikuuta 2001 kello 16:12:34',
33 3 => '15.1.2001 16.12',
34 MW_DATE_ISO
=> '2001-01-15 16:12:34'
37 private $mBookstoreListFi = array(
38 'Bookplus' => 'http://www.bookplus.fi/product.php?isbn=$1',
39 'Helsingin yliopiston kirjasto' => 'http://pandora.lib.hel.fi/cgi-bin/mhask/monihask.py?volname=&author=&keyword=&ident=$1&submit=Hae&engine_helka=ON',
40 'Pääkaupunkiseudun kirjastot' => 'http://www.helmet.fi/search*fin/i?SEARCH=$1',
41 'Tampereen seudun kirjastot' => 'http://kirjasto.tampere.fi/Piki?formid=fullt&typ0=6&dat0=$1'
44 function __construct() {
45 parent
::__construct();
47 global $wgAllMessagesFi;
48 $this->mMessagesFi
=& $wgAllMessagesFi;
50 global $wgMetaNamespace;
51 $this->mNamespaceNamesFi
= array(
53 NS_SPECIAL
=> 'Toiminnot',
55 NS_TALK
=> 'Keskustelu',
56 NS_USER
=> 'Käyttäjä',
57 NS_USER_TALK
=> 'Keskustelu_käyttäjästä',
58 NS_PROJECT
=> $wgMetaNamespace,
59 NS_PROJECT_TALK
=> 'Keskustelu_' . $this->convertGrammar( $wgMetaNamespace, 'elative' ),
61 NS_IMAGE_TALK
=> 'Keskustelu_kuvasta',
62 NS_MEDIAWIKI
=> 'MediaWiki',
63 NS_MEDIAWIKI_TALK
=> 'MediaWiki_talk',
64 NS_TEMPLATE
=> 'Malline',
65 NS_TEMPLATE_TALK
=> 'Keskustelu_mallineesta',
67 NS_HELP_TALK
=> 'Keskustelu_ohjeesta',
68 NS_CATEGORY
=> 'Luokka',
69 NS_CATEGORY_TALK
=> 'Keskustelu_luokasta'
74 function getBookstoreList () {
75 return $this->mBookstoreListFi
;
78 function getNamespaces() {
79 return $this->mNamespaceNamesFi + parent
::getNamespaces();
82 function getQuickbarSettings() {
83 return $this->mQuickbarSettingsFi
;
86 function getSkinNames() {
87 return $this->mSkinNamesFi + parent
::getSkinNames();
90 function getDateFormats() {
91 return $this->mDateFormatsFi
;
94 function getMessage( $key ) {
95 if( isset( $this->mMessagesFi
[$key] ) ) {
96 return $this->mMessagesFi
[$key];
98 return parent
::getMessage( $key );
102 function getAllMessages() {
103 return $this->mMessagesFi
;
107 * See Language.php for documentation
109 function date( $ts, $adj = false, $format = true, $timecorrection = false ) {
110 if ( $adj ) { $ts = $this->userAdjust( $ts, $timecorrection ); }
112 $yyyy = substr( $ts, 0, 4 );
113 $mm = substr( $ts, 4, 2 );
115 $mmmm = $this->getMonthName( $mm ) . 'ta';
116 $dd = substr( $ts, 6, 2 );
119 $datePreference = $this->dateFormat($format);
120 switch( $datePreference ) {
121 case '3': return "$d.$m.$yyyy";
122 case MW_DATE_ISO
: return "$yyyy-$mm-$dd";
123 default: return "$d. $mmmm $yyyy";
128 * See Language.php for documentation
130 function time( $ts, $adj = false, $format = true, $timecorrection = false ) {
131 if ( $adj ) { $ts = $this->userAdjust( $ts, $timecorrection ); }
133 $hh = substr( $ts, 8, 2 );
134 $mm = substr( $ts, 10, 2 );
135 $ss = substr( $ts, 12, 2 );
137 $datePreference = $this->dateFormat($format);
138 switch( $datePreference ) {
140 case MW_DATE_ISO
: return "$hh:$mm:$ss";
141 default: return "$hh.$mm";
146 * See Language.php for documentation
148 function timeanddate( $ts, $adj = false, $format = true, $timecorrection = false) {
149 $date = $this->date( $ts, $adj, $format, $timecorrection );
150 $time = $this->time( $ts, $adj, $format, $timecorrection );
152 $datePreference = $this->dateFormat($format);
153 switch( $datePreference ) {
155 case MW_DATE_ISO
: return "$date $time";
156 default: return "$date kello $time";
161 * Finnish numeric formatting is 123 456,78.
163 function separatorTransformTable() {
164 return array(',' => "\xc2\xa0", '.' => ',' );
168 * Avoid grouping whole numbers between 0 to 9999
170 function commafy($_) {
171 if (!preg_match('/^\d{1,4}$/',$_)) {
172 return strrev((string)preg_replace('/(\d{3})(?=\d)(?!\d*\.)/','$1,',strrev($_)));
178 function linkTrail() {
179 return '/^([a-zäö]+)(.*)$/sDu';
183 # Convert from the nominative form of a noun to some other case
184 # Invoked with {{GRAMMAR:case|word}}
185 function convertGrammar( $word, $case ) {
186 global $wgGrammarForms;
187 if ( isset($wgGrammarForms['fi'][$case][$word]) ) {
188 return $wgGrammarForms['fi'][$case][$word];
191 # These rules are not perfect, but they are currently only used for site names so it doesn't
192 # matter if they are wrong sometimes. Just add a special case for your site name if necessary.
195 if ( $word == 'Wikisitaatit' ) {
196 $word = 'Wikisitaattien';
202 if ( $word == 'Wikisitaatit' ) {
203 $word = 'Wikisitaateista';
205 if ( mb_substr($word, -1) == 'y' ) {
213 if ( $word == 'Wikisitaatit' ) {
214 $word = 'Wikisitaatteja';
216 if ( mb_substr($word, -1) == 'y' ) {
224 # Double the last letter and add 'n'
225 # mb_substr has a compatibility function in GlobalFunctions.php
226 if ( $word == 'Wikisitaatit' ) {
227 $word = 'Wikisitaatteihin';
229 $word = $word . mb_substr($word,-1) . 'n';
233 if ( $word == 'Wikisitaatit' ) {
234 $word = 'Wikisitaateissa';
236 if ( mb_substr($word, -1) == 'y' ) {
248 function translateBlockExpiry( $str ) {
250 'ago', 'now', 'today', 'this', 'next',
251 'first', 'third', 'fourth', 'fifth', 'sixth', 'seventh', 'eighth', 'ninth', 'tenth', 'eleventh', 'twelfth',
252 'tomorrow', 'yesterday'
254 $months = 'january:tammikuu,february:helmikuu,march:maaliskuu,april:huhtikuu,may:toukokuu,june:kesäkuu,' .
255 'july:heinäkuu,august:elokuu,september:syyskuu,october:lokakuu,november:marraskuu,december:joulukuu,' .
256 'jan:tammikuu,feb:helmikuu,mar:maaliskuu,apr:huhtikuu,jun:kesäkuu,jul:heinäkuu,aug:elokuu,sep:syyskuu,'.
257 'oct:lokakuu,nov:marraskuu,dec:joulukuu,sept:syyskuu';
260 'monday' => 'maanantai',
261 'tuesday' => 'tiistai',
262 'wednesday' => 'keskiviikko',
263 'thursay' => 'torstai',
264 'friday' => 'perjantai',
265 'saturday' => 'lauantai',
266 'sunday' => 'sunnuntai',
278 'next' => 'seuraava',
279 'tomorrow' => 'huomenna',
281 'seconds' => 'sekuntia',
282 'second' => 'sekunti',
285 'minutes' => 'minuuttia',
286 'minute' => 'minuutti',
293 'weeks' => 'viikkoa',
295 'fortnights' => 'tuplaviikkoa',
296 'fortnight' => 'tuplaviikko',
297 'months' => 'kuukautta',
298 'month' => 'kuukausi',
301 'infinite' => 'ikuisesti',
302 'indefinite' => 'ikuisesti'
306 $tokens = explode ( ' ', $str);
307 foreach( $tokens as $item ) {
308 if ( !is_numeric($item) ) {
309 if ( count ( explode( '-', $item ) ) == 3 && strlen($item) == 10 ) {
310 list( $yyyy, $mm, $dd ) = explode( '-', $item );
311 $final .= ' ' . $this->date( "{$yyyy}{$mm}{$dd}00000000");
314 if( isset( $weekds[$item] ) ) {
315 $final .= ' ' . $weekds[$item];
320 $final .= ' ' . $item;
322 return '<span class="blockexpiry" title="' . htmlspecialchars($str). '">”' . trim( $final ) . '”</span>';