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