MediaWiki REL1_28
LanguageOs.php
Go to the documentation of this file.
1<?php
30class LanguageOs extends Language {
31
56 function convertGrammar( $word, $case ) {
58 if ( isset( $wgGrammarForms['os'][$case][$word] ) ) {
59 return $wgGrammarForms['os'][$case][$word];
60 }
61 # Ending for allative case
62 $end_allative = 'мæ';
63 # Variable for 'j' beetwen vowels
64 $jot = '';
65 # Variable for "-" for not Ossetic words
66 $hyphen = '';
67 # Variable for ending
68 $ending = '';
69
70 # CHecking if the $word is in plural form
71 if ( preg_match( '/тæ$/u', $word ) ) {
72 $word = mb_substr( $word, 0, -1 );
73 $end_allative = 'æм';
74 } elseif ( preg_match( "/[аæеёиоыэюя]$/u", $word ) ) {
75 # Works if $word is in singular form.
76 # Checking if $word ends on one of the vowels: е, ё, и, о, ы, э, ю, я.
77 $jot = 'й';
78 } elseif ( preg_match( "/у$/u", $word ) ) {
79 # Checking if $word ends on 'у'. 'У'
80 # can be either consonant 'W' or vowel 'U' in cyrillic Ossetic.
81 # Examples: {{grammar:genitive|аунеу}} = аунеуы, {{grammar:genitive|лæппу}} = лæппуйы.
82 if ( !preg_match( "/[аæеёиоыэюя]$/u", mb_substr( $word, -2, 1 ) ) ) {
83 $jot = 'й';
84 }
85 } elseif ( !preg_match( "/[бвгджзйклмнопрстфхцчшщьъ]$/u", $word ) ) {
86 $hyphen = '-';
87 }
88
89 switch ( $case ) {
90 case 'genitive':
91 $ending = $hyphen . $jot . 'ы';
92 break;
93 case 'dative':
94 $ending = $hyphen . $jot . 'æн';
95 break;
96 case 'allative':
97 $ending = $hyphen . $end_allative;
98 break;
99 case 'ablative':
100 if ( $jot == 'й' ) {
101 $ending = $hyphen . $jot . 'æ';
102 } else {
103 $ending = $hyphen . $jot . 'æй';
104 }
105 break;
106 case 'inessive':
107 break;
108 case 'superessive':
109 $ending = $hyphen . $jot . 'ыл';
110 break;
111 case 'equative':
112 $ending = $hyphen . $jot . 'ау';
113 break;
114 case 'comitative':
115 $ending = $hyphen . 'имæ';
116 break;
117 }
118 return $word . $ending;
119 }
120}
$wgGrammarForms
Some languages need different word forms, usually for different cases.
Ossetian (Ирон)
convertGrammar( $word, $case)
Convert from the nominative form of a noun to other cases Invoked with {{grammar:case|word}}.
Internationalisation code.
Definition Language.php:35
when a variable name is used in a it is silently declared as a new local masking the global
Definition design.txt:95
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