[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/resources/src/mediawiki.language/languages/ -> os.js (source)

   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      }
  25      // Works if word is in singular form.
  26      // Checking if word ends on one of the vowels: е, ё, и, о, ы, э, ю, я.
  27      else if ( word.match( /[аæеёиоыэюя]$/i ) ) {
  28          jot = 'й';
  29      }
  30      // Checking if word ends on 'у'. 'У' can be either consonant 'W' or vowel 'U' in cyrillic Ossetic.
  31      // Examples: {{grammar:genitive|аунеу}} = аунеуы, {{grammar:genitive|лæппу}} = лæппуйы.
  32      else if ( word.match( /у$/i ) ) {
  33          if ( !word.slice( -2, -1 ).match( /[аæеёиоыэюя]$/i ) ) {
  34              jot = 'й';
  35          }
  36      } else if ( !word.match( /[бвгджзйклмнопрстфхцчшщьъ]$/i ) ) {
  37          hyphen = '-';
  38      }
  39  
  40      switch ( form ) {
  41          case 'genitive':
  42              ending = hyphen + jot + 'ы';
  43              break;
  44          case 'dative':
  45              ending = hyphen + jot + 'æн';
  46              break;
  47          case 'allative':
  48              ending = hyphen + endAllative;
  49              break;
  50          case 'ablative':
  51              if ( jot === 'й' ) {
  52                  ending = hyphen + jot + 'æ';
  53              }
  54              else {
  55                  ending = hyphen + jot + 'æй';
  56              }
  57              break;
  58          case 'superessive':
  59              ending = hyphen + jot + 'ыл';
  60              break;
  61          case 'equative':
  62              ending = hyphen + jot + 'ау';
  63              break;
  64          case 'comitative':
  65              ending = hyphen + 'имæ';
  66              break;
  67      }
  68      return word + ending;
  69  };


Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1