2 * Ossetian (Ирон) language functions
3 * @author Santhosh Thottingal
6 mw.language.convertGrammar = function ( word, form ) {
7 const grammarForms = mw.language.getData( 'os', 'grammarForms' );
8 // Ending for allative case
9 let endAllative = 'мæ',
10 // Variable for 'j' beetwen vowels
12 // Variable for "-" for not Ossetic words
14 // Variable for ending
17 if ( grammarForms && grammarForms[ form ] ) {
18 return grammarForms[ form ][ word ];
20 // Checking if the $word is in plural form
21 if ( /тæ$/i.test( word ) ) {
22 word = word.slice( 0, -1 );
24 } else if ( /[аæеёиоыэюя]$/i.test( word ) ) {
25 // Works if word is in singular form.
26 // Checking if word ends on one of the vowels: е, ё, и, о, ы, э, ю, я.
28 } else if ( /у$/i.test( word ) ) {
29 // Checking if word ends on 'у'. 'У' can be either consonant 'W' or vowel 'U' in Cyrillic Ossetic.
30 // Examples: {{grammar:genitive|аунеу}} = аунеуы, {{grammar:genitive|лæппу}} = лæппуйы.
32 if ( !word.slice( -2, -1 ).match( /[аæеёиоыэюя]$/i ) ) {
35 } else if ( !/[бвгджзйклмнопрстфхцчшщьъ]$/i.test( word ) ) {
41 ending = hyphen + jot + 'ы';
44 ending = hyphen + jot + 'æн';
47 ending = hyphen + endAllative;
51 ending = hyphen + jot + 'æ';
53 ending = hyphen + jot + 'æй';
57 ending = hyphen + jot + 'ыл';
60 ending = hyphen + jot + 'ау';
63 ending = hyphen + 'имæ';