MediaWiki  master
LanguageCu.php
Go to the documentation of this file.
1 <?php
23 
29 class LanguageCu extends Language {
30  public function convertGrammar( $word, $case ) {
31  $grammarForms =
32  MediaWikiServices::getInstance()->getMainConfig()->get( MainConfigNames::GrammarForms );
33 
34  if ( isset( $grammarForms['сu'][$case][$word] ) ) {
35  return $grammarForms['сu'][$case][$word];
36  }
37 
38  # These rules are not perfect, but they are currently only used for
39  # site names, so it doesn't matter if they are wrong sometimes.
40  # Just add a special case for your site name if necessary.
41 
42  # join and array_slice instead mb_substr
43  $ar = [];
44  preg_match_all( '/./us', $word, $ar );
45  if ( !preg_match( "/[a-zA-Z_]/u", $word ) ) {
46  switch ( $case ) {
47  case 'genitive': # родительный падеж
48  // if ( ( implode( '', array_slice( $ar[0], -4 ) ) == 'вики' )
49  // || ( implode( '', array_slice( $ar[0], -4 ) ) == 'Вики' )
50  // ) {
51  // }
52 
53  if ( implode( '', array_slice( $ar[0], -2 ) ) == 'ї' ) {
54  return implode( '', array_slice( $ar[0], 0, -2 ) ) . 'їѩ';
55  }
56  break;
57  case 'accusative': # винительный падеж
58  # stub
59  break;
60  }
61  }
62 
63  return $word;
64  }
65 }
Old Church Slavonic (Ѩзыкъ словѣньскъ)
Definition: LanguageCu.php:29
convertGrammar( $word, $case)
Grammatical transformations, needed for inflected languages Invoked by putting {{grammar:case|word}} ...
Definition: LanguageCu.php:30
Base class for language-specific code.
Definition: Language.php:63
A class containing constants representing the names of configuration variables.
Service locator for MediaWiki core services.