Merge "Update documentation for MediaHandler::getPageDimensions()"
[mediawiki.git] / resources / mediawiki.language / languages / os.js
blob682b39031142dce4d99a66889203d6e326cff584
1 /**
2  * Ossetian (Ирон) language functions
3  * @author Santhosh Thottingal
4  */
7 mediaWiki.language.convertGrammar = function ( word, form ) {
8         var grammarForms = mediaWiki.language.getData( 'os', 'grammarForms' ),
9                 // Ending for allative case
10                 endAllative = 'мæ',
11                 // Variable for 'j' beetwen vowels
12                 jot = '',
13                 // Variable for "-" for not Ossetic words
14                 hyphen = '',
15                 // Variable for ending
16                 ending = '';
18         if ( grammarForms && grammarForms[form] ) {
19                 return grammarForms[form][word];
20         }
21         // Checking if the $word is in plural form
22         if ( word.match( /тæ$/i ) ) {
23                 word = word.substring( 0, word.length - 1 );
24                 endAllative = 'æм';
25         }
26         // Works if word is in singular form.
27         // Checking if word ends on one of the vowels: е, ё, и, о, ы, э, ю, я.
28         else if ( word.match( /[аæеёиоыэюя]$/i ) ) {
29                 jot = 'й';
30         }
31         // Checking if word ends on 'у'. 'У' can be either consonant 'W' or vowel 'U' in cyrillic Ossetic.
32         // Examples: {{grammar:genitive|аунеу}} = аунеуы, {{grammar:genitive|лæппу}} = лæппуйы.
33         else if ( word.match( /у$/i ) ) {
34                 if ( ! word.substring( word.length-2, word.length-1 ).match( /[аæеёиоыэюя]$/i ) ) {
35                         jot = 'й';
36                 }
37         } else if ( !word.match( /[бвгджзйклмнопрстфхцчшщьъ]$/i ) ) {
38                 hyphen = '-';
39         }
41         switch ( form ) {
42                 case 'genitive':
43                         ending = hyphen + jot + 'ы';
44                         break;
45                 case 'dative':
46                         ending = hyphen + jot + 'æн';
47                         break;
48                 case 'allative':
49                         ending = hyphen + endAllative;
50                         break;
51                 case 'ablative':
52                         if ( jot === 'й' ) {
53                                 ending = hyphen + jot + 'æ';
54                         }
55                         else {
56                                 ending = hyphen + jot + 'æй';
57                         }
58                         break;
59                 case 'superessive':
60                         ending = hyphen + jot + 'ыл';
61                         break;
62                 case 'equative':
63                         ending = hyphen + jot + 'ау';
64                         break;
65                 case 'comitative':
66                         ending = hyphen + 'имæ';
67                         break;
68         }
69         return word + ending;