MediaWiki REL1_32
LanguageFi.php
Go to the documentation of this file.
1<?php
30class LanguageFi extends Language {
39 function convertGrammar( $word, $case ) {
40 global $wgGrammarForms;
41 if ( isset( $wgGrammarForms['fi'][$case][$word] ) ) {
42 return $wgGrammarForms['fi'][$case][$word];
43 }
44
45 # These rules don't cover the whole language.
46 # They are used only for site names.
47
48 # wovel harmony flag
49 $aou = preg_match( '/[aou][^äöy]*$/i', $word );
50
51 # The flag should be false for compounds where the last word has only neutral vowels (e/i).
52 # The general case cannot be handled without a dictionary, but there's at least one notable
53 # special case we should check for:
54
55 if ( preg_match( '/wiki$/i', $word ) ) {
56 $aou = false;
57 }
58
59 # append i after final consonant
60 if ( preg_match( '/[bcdfghjklmnpqrstvwxz]$/i', $word ) ) {
61 $word .= 'i';
62 }
63
64 switch ( $case ) {
65 case 'genitive':
66 $word .= 'n';
67 break;
68 case 'elative':
69 $word .= ( $aou ? 'sta' : 'stä' );
70 break;
71 case 'partitive':
72 $word .= ( $aou ? 'a' : 'ä' );
73 break;
74 case 'illative':
75 # Double the last letter and add 'n'
76 $word = $word . mb_substr( $word, -1 ) . 'n';
77 break;
78 case 'inessive':
79 $word .= ( $aou ? 'ssa' : 'ssä' );
80 break;
81 }
82 return $word;
83 }
84
91 function translateBlockExpiry( $str, User $user = null, $now = 0 ) {
92 /*
93 'ago', 'now', 'today', 'this', 'next',
94 'first', 'third', 'fourth', 'fifth', 'sixth', 'seventh', 'eighth', 'ninth',
95 'tenth', 'eleventh', 'twelfth',
96 'tomorrow', 'yesterday'
97
98 $months = 'january:tammikuu,february:helmikuu,march:maaliskuu,april:huhtikuu,' .
99 'may:toukokuu,june:kesäkuu,july:heinäkuu,august:elokuu,september:syyskuu,' .
100 'october:lokakuu,november:marraskuu,december:joulukuu,' .
101 'jan:tammikuu,feb:helmikuu,mar:maaliskuu,apr:huhtikuu,jun:kesäkuu,' .
102 'jul:heinäkuu,aug:elokuu,sep:syyskuu,oct:lokakuu,nov:marraskuu,' .
103 dec:joulukuu,sept:syyskuu';
104 */
105 $weekds = [
106 'monday' => 'maanantai',
107 'tuesday' => 'tiistai',
108 'wednesday' => 'keskiviikko',
109 'thursday' => 'torstai',
110 'friday' => 'perjantai',
111 'saturday' => 'lauantai',
112 'sunday' => 'sunnuntai',
113 'mon' => 'ma',
114 'tue' => 'ti',
115 'tues' => 'ti',
116 'wed' => 'ke',
117 'wednes' => 'ke',
118 'thu' => 'to',
119 'thur' => 'to',
120 'thurs' => 'to',
121 'fri' => 'pe',
122 'sat' => 'la',
123 'sun' => 'su',
124 'next' => 'seuraava',
125 'tomorrow' => 'huomenna',
126 'ago' => 'sitten',
127 'seconds' => 'sekuntia',
128 'second' => 'sekunti',
129 'secs' => 's',
130 'sec' => 's',
131 'minutes' => 'minuuttia',
132 'minute' => 'minuutti',
133 'mins' => 'min',
134 'min' => 'min',
135 'days' => 'päivää',
136 'day' => 'päivä',
137 'hours' => 'tuntia',
138 'hour' => 'tunti',
139 'weeks' => 'viikkoa',
140 'week' => 'viikko',
141 'fortnights' => 'tuplaviikkoa',
142 'fortnight' => 'tuplaviikko',
143 'months' => 'kuukautta',
144 'month' => 'kuukausi',
145 'years' => 'vuotta',
146 'year' => 'vuosi',
147 'infinite' => 'ikuisesti',
148 'indefinite' => 'ikuisesti'
149 ];
150
151 $final = '';
152 $tokens = explode( ' ', $str );
153 foreach ( $tokens as $item ) {
154 if ( !is_numeric( $item ) ) {
155 if ( count( explode( '-', $item ) ) == 3 && strlen( $item ) == 10 ) {
156 list( $yyyy, $mm, $dd ) = explode( '-', $item );
157 $final .= ' ' . $this->date( "{$yyyy}{$mm}{$dd}000000" );
158 continue;
159 }
160 if ( isset( $weekds[$item] ) ) {
161 $final .= ' ' . $weekds[$item];
162 continue;
163 }
164 }
165
166 $final .= ' ' . $item;
167 }
168
169 return htmlspecialchars( trim( $final ) );
170 }
171}
$wgGrammarForms
Some languages need different word forms, usually for different cases.
Finnish (Suomi)
convertGrammar( $word, $case)
Convert from the nominative form of a noun to some other case Invoked with {{grammar:case|word}}.
translateBlockExpiry( $str, User $user=null, $now=0)
Internationalisation code.
Definition Language.php:35
date( $ts, $adj=false, $format=true, $timecorrection=false)
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition User.php:47
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
Definition deferred.txt:11
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition injection.txt:37
$tokens