Pasting lines typo in r80025
[lhc/web/wiklou.git] / languages / classes / LanguageCu.php
1 <?php
2
3 /** Old Church Slavonic (Ѩзыкъ словѣньскъ)
4 *
5 * @ingroup Language
6 */
7 class LanguageCu extends Language {
8 # Convert from the nominative form of a noun to some other case
9 # Invoked with {{grammar:case|word}}
10 function convertGrammar( $word, $case ) {
11 global $wgGrammarForms;
12 if ( isset( $wgGrammarForms['сu'][$case][$word] ) ) {
13 return $wgGrammarForms['сu'][$case][$word];
14 }
15
16 # These rules are not perfect, but they are currently only used for site names so it doesn't
17 # matter if they are wrong sometimes. Just add a special case for your site name if necessary.
18
19 # join and array_slice instead mb_substr
20 $ar = array();
21 preg_match_all( '/./us', $word, $ar );
22 if ( !preg_match( "/[a-zA-Z_]/us", $word ) )
23 switch ( $case ) {
24 case 'genitive': # родительный падеж
25 if ( ( join( '', array_slice( $ar[0], -4 ) ) == 'вики' ) || ( join( '', array_slice( $ar[0], -4 ) ) == 'Вики' ) )
26 { }
27 elseif ( join( '', array_slice( $ar[0], -2 ) ) == 'ї' )
28 $word = join( '', array_slice( $ar[0], 0, -2 ) ) . 'їѩ';
29 break;
30 case 'accusative': # винительный падеж
31 # stub
32 break;
33 }
34 return $word;
35 }
36
37 function convertPlural( $count, $forms ) {
38 if ( !count( $forms ) ) { return ''; }
39 $forms = $this->preConvertPlural( $forms, 4 );
40
41 switch ( $count % 10 ) {
42 case 1: return $forms[0];
43 case 2: return $forms[1];
44 case 3:
45 case 4: return $forms[2];
46 default: return $forms[3];
47 }
48 }
49 }