os.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /**
  2. * Ossetian (Ирон) language functions
  3. *
  4. * @author Santhosh Thottingal
  5. */
  6. ( function ( $ ) {
  7. 'use strict';
  8. $.i18n.languages.os = $.extend( {}, $.i18n.languages[ 'default' ], {
  9. convertGrammar: function ( word, form ) {
  10. var endAllative, jot, hyphen, ending;
  11. // Ending for allative case
  12. endAllative = 'мæ';
  13. // Variable for 'j' beetwen vowels
  14. jot = '';
  15. // Variable for "-" for not Ossetic words
  16. hyphen = '';
  17. // Variable for ending
  18. ending = '';
  19. if ( word.match( /тæ$/i ) ) {
  20. // Checking if the $word is in plural form
  21. word = word.slice( 0, -1 );
  22. endAllative = 'æм';
  23. } else if ( word.match( /[аæеёиоыэюя]$/i ) ) {
  24. // Works if word is in singular form.
  25. // Checking if word ends on one of the vowels: е, ё, и, о, ы, э, ю,
  26. // я.
  27. jot = 'й';
  28. } else if ( word.match( /у$/i ) ) {
  29. // Checking if word ends on 'у'. 'У' can be either consonant 'W' or
  30. // vowel 'U' in cyrillic Ossetic.
  31. // Examples: {{grammar:genitive|аунеу}} = аунеуы,
  32. // {{grammar:genitive|лæппу}} = лæппуйы.
  33. if ( !word.slice( -2, -1 ).match( /[аæеёиоыэюя]$/i ) ) {
  34. jot = 'й';
  35. }
  36. } else if ( !word.match( /[бвгджзйклмнопрстфхцчшщьъ]$/i ) ) {
  37. hyphen = '-';
  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. }
  68. } );
  69. }( jQuery ) );