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