MediaWiki  1.32.5
LanguageKsh.php
Go to the documentation of this file.
1 <?php
30 class LanguageKsh extends Language {
31  private static $familygender = [
32  // Do not add male wiki families, since that's the default.
33  // No need add neuter wikis having names ending in -wiki.
34  'wikipedia' => 'f',
35  'wikiversity' => 'f',
36  'wiktionary' => 'n',
37  'wikibooks' => 'n',
38  'wikiquote' => 'n',
39  'wikisource' => 'n',
40  'wikitravel' => 'n',
41  'wikia' => 'f',
42  'translatewiki.net' => 'n',
43  ];
44 
89  function convertGrammar( $word, $case ) {
90  $lord = strtolower( $word );
91  $gender = 'm'; // Nuutnaarel // default
92  if ( preg_match( '/wiki$/', $lord ) ) {
93  $gender = 'n'; // Dat xyz-wiki
94  }
95  if ( isset( self::$familygender[$lord] ) ) {
96  $gender = self::$familygender[$lord];
97  }
98  $case = ' ' . strtolower( $case );
99  if ( preg_match( '/ [is]/', $case ) ) {
100  # däm WikiMaatplaz singe, dä Wikipeedija iere, däm Wikiwööterbooch singe
101  # dem/em WikiMaatplaz singe, de Wikipeedija iere, dem/em Wikiwööterbooch singe
102  # däm WikiMaatplaz sing, dä Wikipeedija ier, däm Wikiwööterbooch sing
103  # dem/em WikiMaatplaz sing, de Wikipeedija ier, dem/em Wikiwööterbooch sing
104  $word = ( preg_match( '/ b/', $case )
105  ? ( $gender == 'f' ? 'dä' : 'däm' )
106  : ( $gender == 'f' ? 'de' : 'dem' )
107  ) . ' ' . $word . ' ' .
108  ( $gender == 'f' ? 'ier' : 'sing' ) .
109  ( preg_match( '/ m/', $case ) ? 'e' : ''
110  );
111  } elseif ( preg_match( '/ e/', $case ) ) {
112  # en dämm WikiMaatPlaz, en dä Wikipeedija, en dämm Wikiwööterbooch
113  # em WikiMaatplaz, en de Wikipeedija, em Wikiwööterbooch
114  if ( preg_match( '/ b/', $case ) ) {
115  $word = 'en ' . ( $gender == 'f' ? 'dä' : 'däm' ) . ' ' . $word;
116  } else {
117  $word = ( $gender == 'f' ? 'en de' : 'em' ) . ' ' . $word;
118  }
119  } elseif ( preg_match( '/ [fv]/', $case ) || preg_match( '/ [2jg]/', $case ) ) {
120  # vun däm WikiMaatplaz, vun dä Wikipeedija, vun däm Wikiwööterbooch
121  # vum WikiMaatplaz, vun de Wikipeedija, vum Wikiwööterbooch
122  if ( preg_match( '/ b/', $case ) ) {
123  $word = 'vun ' . ( $gender == 'f' ? 'dä' : 'däm' ) . ' ' . $word;
124  } else {
125  $word = ( $gender == 'f' ? 'vun de' : 'vum' ) . ' ' . $word;
126  }
127  } elseif ( preg_match( '/ [3d]/', $case ) ) {
128  # dämm WikiMaatPlaz, dä Wikipeedija, dämm Wikiwööterbooch
129  # dem/em WikiMaatplaz, de Wikipeedija, dem/em Wikiwööterbooch
130  if ( preg_match( '/ b/', $case ) ) {
131  $word = ( $gender == 'f' ? 'dää' : 'dämm' ) . ' ' . $word;
132  } else {
133  $word = ( $gender == 'f' ? 'de' : 'dem' ) . ' ' . $word;
134  }
135  } else {
136  # dä WikiMaatPlaz, di Wikipeedija, dat Wikiwööterbooch
137  # der WikiMaatplaz, de Wikipeedija, et Wikiwööterbooch
138  if ( preg_match( '/ b/', $case ) ) {
139  switch ( $gender ) {
140  case 'm':
141  $lord = 'dä';
142  break;
143  case 'f':
144  $lord = 'di';
145  break;
146  default:
147  $lord = 'dat';
148  }
149  } else {
150  switch ( $gender ) {
151  case 'm':
152  $lord = 'der';
153  break;
154  case 'f':
155  $lord = 'de';
156  break;
157  default:
158  $lord = 'et';
159  }
160  }
161  $word = $lord . ' ' . $word;
162  }
163  return $word;
164  }
165 
174  function convertPlural( $count, $forms ) {
175  $forms = $this->handleExplicitPluralForms( $count, $forms );
176  if ( is_string( $forms ) ) {
177  return $forms;
178  }
179  if ( !count( $forms ) ) {
180  return '';
181  }
182  $forms = $this->preConvertPlural( $forms, 3 );
183 
184  if ( $count == 1 ) {
185  return $forms[0];
186  } elseif ( $count == 0 ) {
187  return $forms[2];
188  } else {
189  return $forms[1];
190  }
191  }
192 }
Language\preConvertPlural
preConvertPlural($forms, $count)
Checks that convertPlural was given an array and pads it to requested amount of forms by copying the ...
Definition: Language.php:4098
captcha-old.count
count
Definition: captcha-old.py:249
php
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
LanguageKsh
Ripuarian (Ripoarėsh)
Definition: LanguageKsh.php:30
LanguageKsh\convertPlural
convertPlural( $count, $forms)
Handle cases of (1, other, 0) or (1, other)
Definition: LanguageKsh.php:174
LanguageKsh\convertGrammar
convertGrammar( $word, $case)
Convert from the nominative form of a noun to other cases.
Definition: LanguageKsh.php:89
Language\handleExplicitPluralForms
handleExplicitPluralForms( $count, array $forms)
Handles explicit plural forms for Language::convertPlural()
Definition: Language.php:4077
LanguageKsh\$familygender
static $familygender
Definition: LanguageKsh.php:31
Language
Internationalisation code.
Definition: Language.php:35