| 1 |
|
| 2 |
ions |
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
mw.language.convertGrammar = function ( word, form ) { |
| 7 |
const grammarForms = mw.language.getData( 'os', 'grammarForms' ); |
| 8 |
|
| 9 |
let endAllative = 'мæ', |
| 10 |
|
| 11 |
jot = '', |
| 12 |
|
| 13 |
hyphen = '', |
| 14 |
|
| 15 |
ending = ''; |
| 16 |
|
| 17 |
if ( grammarForms && grammarForms[ form ] ) { |
| 18 |
return grammarForms[ form ][ word ]; |
| 19 |
} |
| 20 |
|
| 21 |
if ( /тæ$/i.test( word ) ) { |
| 22 |
word = word.slice( 0, -1 ); |
| 23 |
endAllative = 'æм'; |
| 24 |
} else if ( /[аæеёиоыэюя]$/i.test( word ) ) { |
| 25 |
|
| 26 |
ю, я. |
| 27 |
jot = 'й'; |
| 28 |
} else if ( /у$/i.test( word ) ) { |
| 29 |
c. |
| 30 |
пу}} = лæппуйы. |
| 31 |
|
| 32 |
if ( !word.slice( -2, -1 ).match( /[аæеёиоыэюя]$/i ) ) { |
| 33 |
jot = 'й'; |
| 34 |
} |
| 35 |
} else if ( !/[бвгджзйклмнопрстфхцчшщьъ]$/i.test( word ) ) { |
| 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 |
}; |