MediaWiki  1.28.0
LanguageFi.php
Go to the documentation of this file.
1 <?php
30 class LanguageFi extends Language {
39  function convertGrammar( $word, $case ) {
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 
90  function translateBlockExpiry( $str, User $user = null ) {
91  /*
92  'ago', 'now', 'today', 'this', 'next',
93  'first', 'third', 'fourth', 'fifth', 'sixth', 'seventh', 'eighth', 'ninth',
94  'tenth', 'eleventh', 'twelfth',
95  'tomorrow', 'yesterday'
96 
97  $months = 'january:tammikuu,february:helmikuu,march:maaliskuu,april:huhtikuu,' .
98  'may:toukokuu,june:kesäkuu,july:heinäkuu,august:elokuu,september:syyskuu,' .
99  'october:lokakuu,november:marraskuu,december:joulukuu,' .
100  'jan:tammikuu,feb:helmikuu,mar:maaliskuu,apr:huhtikuu,jun:kesäkuu,' .
101  'jul:heinäkuu,aug:elokuu,sep:syyskuu,oct:lokakuu,nov:marraskuu,' .
102  dec:joulukuu,sept:syyskuu';
103  */
104  $weekds = [
105  'monday' => 'maanantai',
106  'tuesday' => 'tiistai',
107  'wednesday' => 'keskiviikko',
108  'thursday' => 'torstai',
109  'friday' => 'perjantai',
110  'saturday' => 'lauantai',
111  'sunday' => 'sunnuntai',
112  'mon' => 'ma',
113  'tue' => 'ti',
114  'tues' => 'ti',
115  'wed' => 'ke',
116  'wednes' => 'ke',
117  'thu' => 'to',
118  'thur' => 'to',
119  'thurs' => 'to',
120  'fri' => 'pe',
121  'sat' => 'la',
122  'sun' => 'su',
123  'next' => 'seuraava',
124  'tomorrow' => 'huomenna',
125  'ago' => 'sitten',
126  'seconds' => 'sekuntia',
127  'second' => 'sekunti',
128  'secs' => 's',
129  'sec' => 's',
130  'minutes' => 'minuuttia',
131  'minute' => 'minuutti',
132  'mins' => 'min',
133  'min' => 'min',
134  'days' => 'päivää',
135  'day' => 'päivä',
136  'hours' => 'tuntia',
137  'hour' => 'tunti',
138  'weeks' => 'viikkoa',
139  'week' => 'viikko',
140  'fortnights' => 'tuplaviikkoa',
141  'fortnight' => 'tuplaviikko',
142  'months' => 'kuukautta',
143  'month' => 'kuukausi',
144  'years' => 'vuotta',
145  'year' => 'vuosi',
146  'infinite' => 'ikuisesti',
147  'indefinite' => 'ikuisesti'
148  ];
149 
150  $final = '';
151  $tokens = explode( ' ', $str );
152  foreach ( $tokens as $item ) {
153  if ( !is_numeric( $item ) ) {
154  if ( count( explode( '-', $item ) ) == 3 && strlen( $item ) == 10 ) {
155  list( $yyyy, $mm, $dd ) = explode( '-', $item );
156  $final .= ' ' . $this->date( "{$yyyy}{$mm}{$dd}000000" );
157  continue;
158  }
159  if ( isset( $weekds[$item] ) ) {
160  $final .= ' ' . $weekds[$item];
161  continue;
162  }
163  }
164 
165  $final .= ' ' . $item;
166  }
167 
168  return htmlspecialchars( trim( $final ) );
169  }
170 }
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
date($ts, $adj=false, $format=true, $timecorrection=false)
Definition: Language.php:2237
when a variable name is used in a it is silently declared as a new local masking the global
Definition: design.txt:93
$tokens
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
Definition: distributors.txt:9
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a local account $user
Definition: hooks.txt:242
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:35
$wgGrammarForms
Some languages need different word forms, usually for different cases.
Finnish (Suomi)
Definition: LanguageFi.php:30
translateBlockExpiry($str, User $user=null)
Definition: LanguageFi.php:90
convertGrammar($word, $case)
Convert from the nominative form of a noun to some other case Invoked with {{grammar:case|word}}.
Definition: LanguageFi.php:39