MediaWiki master
LanguageHy.php
Go to the documentation of this file.
1<?php
8namespace MediaWiki\Languages;
9
13
19class LanguageHy extends Language {
20
22 public function convertGrammar( $word, $case ) {
23 $grammarForms =
25 if ( isset( $grammarForms['hy'][$case][$word] ) ) {
26 return $grammarForms['hy'][$case][$word];
27 }
28
29 # These rules are not perfect, but they are currently only used for site names so it doesn't
30 # matter if they are wrong sometimes. Just add a special case for your site name if necessary.
31
32 # join and array_slice instead mb_substr
33 $ar = [];
34 preg_match_all( '/./us', $word, $ar );
35 if ( !preg_match( "/[a-zA-Z_]/u", $word ) ) {
36 switch ( $case ) {
37 case 'genitive': # սեռական հոլով
38 if ( implode( '', array_slice( $ar[0], -1 ) ) == 'ա' ) {
39 $word = implode( '', array_slice( $ar[0], 0, -1 ) ) . 'այի';
40 } elseif ( implode( '', array_slice( $ar[0], -1 ) ) == 'ո' ) {
41 $word = implode( '', array_slice( $ar[0], 0, -1 ) ) . 'ոյի';
42 } elseif ( implode( '', array_slice( $ar[0], -4 ) ) == 'գիրք' ) {
43 $word = implode( '', array_slice( $ar[0], 0, -4 ) ) . 'գրքի';
44 } else {
45 $word .= 'ի';
46 }
47 break;
48 case 'dative': # Տրական հոլով
49 # stub
50 break;
51 case 'accusative': # Հայցական հոլով
52 # stub
53 break;
54 case 'instrumental':
55 # stub
56 break;
57 case 'prepositional':
58 # stub
59 break;
60 }
61 }
62 return $word;
63 }
64}
65
67class_alias( LanguageHy::class, 'LanguageHy' );
Base class for language-specific code.
Definition Language.php:69
Armenian (Հայերեն)
convertGrammar( $word, $case)
Grammatical transformations, needed for inflected languages Invoked by putting {{grammar:case|word}} ...
A class containing constants representing the names of configuration variables.
const GrammarForms
Name constant for the GrammarForms setting, for use with Config::get()
Service locator for MediaWiki core services.
static getInstance()
Returns the global default instance of the top level service locator.