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