5 * @author Ruben Vardanyan (Me@RubenVardanyan.com)
8 /* Please, see Language.php for general function comments */
9 class LanguageHy
extends Language
{
10 # Convert from the nominative form of a noun to some other case
11 # Invoked with {{grammar:case|word}}
12 function convertGrammar( $word, $case ) {
13 global $wgGrammarForms;
14 if ( isset($wgGrammarForms['hy'][$case][$word]) ) {
15 return $wgGrammarForms['hy'][$case][$word];
18 # These rules are not perfect, but they are currently only used for site names so it doesn't
19 # matter if they are wrong sometimes. Just add a special case for your site name if necessary.
21 #join and array_slice instead mb_substr
23 preg_match_all( '/./us', $word, $ar );
24 if (!preg_match("/[a-zA-Z_]/us", $word))
26 case 'genitive': #սեռական հոլով
27 if (join('',array_slice($ar[0],-1))=='ա')
28 $word = join('',array_slice($ar[0],0,-1)).'այի';
29 elseif (join('',array_slice($ar[0],-1))=='ո')
30 $word=join('',array_slice($ar[0],0,-1)).'ոյի';
31 elseif (join('',array_slice($ar[0],-4))=='գիրք')
32 $word=join('',array_slice($ar[0],0,-4)).'գրքի';
36 case 'dative': #Տրական հոլով
39 case 'accusative': #Հայցական հոլով
42 case 'instrumental': #
45 case 'prepositional': #
52 function convertPlural( $count, $wordform1, $wordform2) {
53 $count = str_replace (' ', '', $count);
54 if (abs($count) <= 1) {
62 * Armenian numeric format is "12 345,67" but "1234,56"
65 function commafy($_) {
66 if (!preg_match('/^\d{1,4}$/',$_)) {
67 return strrev((string)preg_replace('/(\d{3})(?=\d)(?!\d*\.)/','$1,',strrev($_)));