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