3 * Finnish (Suomi) specific code.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
21 * @author Niklas Laxström
30 class LanguageFi
extends Language
{
33 * Convert from the nominative form of a noun to some other case
34 * Invoked with {{grammar:case|word}}
40 function convertGrammar( $word, $case ) {
41 global $wgGrammarForms;
42 if ( isset( $wgGrammarForms['fi'][$case][$word] ) ) {
43 return $wgGrammarForms['fi'][$case][$word];
46 # These rules are not perfect, but they are currently only used for site names so it doesn't
47 # matter if they are wrong sometimes. Just add a special case for your site name if necessary.
50 $aou = preg_match( '/[aou][^äöy]*$/i', $word );
52 # The flag should be false for compounds where the last word has only neutral vowels (e/i).
53 # The general case cannot be handled without a dictionary, but there's at least one notable
54 # special case we should check for:
56 if ( preg_match( '/wiki$/i', $word ) ) {
60 # append i after final consonant
61 if ( preg_match( '/[bcdfghjklmnpqrstvwxz]$/i', $word ) ) {
70 $word .= ( $aou ?
'sta' : 'stä' );
73 $word .= ( $aou ?
'a' : 'ä' );
76 # Double the last letter and add 'n'
77 # mb_substr has a compatibility function in GlobalFunctions.php
78 $word = $word . mb_substr( $word, -1 ) . 'n';
81 $word .= ( $aou ?
'ssa' : 'ssä' );
89 * @param $forContent bool
92 function translateBlockExpiry( $str, $forContent = false ) {
94 'ago', 'now', 'today', 'this', 'next',
95 'first', 'third', 'fourth', 'fifth', 'sixth', 'seventh', 'eighth', 'ninth', 'tenth', 'eleventh', 'twelfth',
96 'tomorrow', 'yesterday'
98 $months = 'january:tammikuu,february:helmikuu,march:maaliskuu,april:huhtikuu,may:toukokuu,june:kesäkuu,' .
99 'july:heinäkuu,august:elokuu,september:syyskuu,october:lokakuu,november:marraskuu,december:joulukuu,' .
100 'jan:tammikuu,feb:helmikuu,mar:maaliskuu,apr:huhtikuu,jun:kesäkuu,jul:heinäkuu,aug:elokuu,sep:syyskuu,'.
101 'oct:lokakuu,nov:marraskuu,dec:joulukuu,sept:syyskuu';
104 'monday' => 'maanantai',
105 'tuesday' => 'tiistai',
106 'wednesday' => 'keskiviikko',
107 'thursday' => 'torstai',
108 'friday' => 'perjantai',
109 'saturday' => 'lauantai',
110 'sunday' => 'sunnuntai',
122 'next' => 'seuraava',
123 'tomorrow' => 'huomenna',
125 'seconds' => 'sekuntia',
126 'second' => 'sekunti',
129 'minutes' => 'minuuttia',
130 'minute' => 'minuutti',
137 'weeks' => 'viikkoa',
139 'fortnights' => 'tuplaviikkoa',
140 'fortnight' => 'tuplaviikko',
141 'months' => 'kuukautta',
142 'month' => 'kuukausi',
145 'infinite' => 'ikuisesti',
146 'indefinite' => 'ikuisesti'
150 $tokens = explode ( ' ', $str );
151 foreach ( $tokens as $item ) {
152 if ( !is_numeric( $item ) ) {
153 if ( count ( explode( '-', $item ) ) == 3 && strlen( $item ) == 10 ) {
154 list( $yyyy, $mm, $dd ) = explode( '-', $item );
155 $final .= ' ' . $this->date( "{$yyyy}{$mm}{$dd}000000" );
158 if ( isset( $weekds[$item] ) ) {
159 $final .= ' ' . $weekds[$item];
164 $final .= ' ' . $item;
167 return htmlspecialchars( trim( $final ) );