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