ml.js 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /**
  2. * Malayalam language functions
  3. *
  4. * @author Santhosh Thottingal
  5. */
  6. ( function ( $ ) {
  7. 'use strict';
  8. $.i18n.languages.ml = $.extend( {}, $.i18n.languages[ 'default' ], {
  9. convertGrammar: function ( word, form ) {
  10. form = form.toLowerCase();
  11. switch ( form ) {
  12. case 'ഉദ്ദേശിക':
  13. case 'dative':
  14. if ( word.slice( -1 ) === 'ു' ||
  15. word.slice( -1 ) === 'ൂ' ||
  16. word.slice( -1 ) === 'ൗ' ||
  17. word.slice( -1 ) === 'ൌ'
  18. ) {
  19. word += 'വിന്';
  20. } else if ( word.slice( -1 ) === 'ം' ) {
  21. word = word.slice( 0, -1 ) + 'ത്തിന്';
  22. } else if ( word.slice( -1 ) === 'ൻ' ) {
  23. // Atomic chillu n. അവൻ -> അവന്
  24. word = word.slice( 0, -1 ) + 'ന്';
  25. } else if ( word.slice( -3 ) === 'ന്\u200d' ) {
  26. // chillu n. അവൻ -> അവന്
  27. word = word.slice( 0, -1 );
  28. } else if ( word.slice( -1 ) === 'ൾ' || word.slice( -3 ) === 'ള്\u200d' ) {
  29. word += 'ക്ക്';
  30. } else if ( word.slice( -1 ) === 'ർ' || word.slice( -3 ) === 'ര്\u200d' ) {
  31. word += 'ക്ക്';
  32. } else if ( word.slice( -1 ) === 'ൽ' ) {
  33. // Atomic chillu ൽ , ഫയൽ -> ഫയലിന്
  34. word = word.slice( 0, -1 ) + 'ലിന്';
  35. } else if ( word.slice( -3 ) === 'ല്\u200d' ) {
  36. // chillu ല്\u200d , ഫയല്\u200d -> ഫയലിന്
  37. word = word.slice( 0, -2 ) + 'ിന്';
  38. } else if ( word.slice( -2 ) === 'ു്' ) {
  39. word = word.slice( 0, -2 ) + 'ിന്';
  40. } else if ( word.slice( -1 ) === '്' ) {
  41. word = word.slice( 0, -1 ) + 'ിന്';
  42. } else {
  43. // കാവ്യ -> കാവ്യയ്ക്ക്, ഹരി -> ഹരിയ്ക്ക്, മല -> മലയ്ക്ക്
  44. word += 'യ്ക്ക്';
  45. }
  46. break;
  47. case 'സംബന്ധിക':
  48. case 'genitive':
  49. if ( word.slice( -1 ) === 'ം' ) {
  50. word = word.slice( 0, -1 ) + 'ത്തിന്റെ';
  51. } else if ( word.slice( -2 ) === 'ു്' ) {
  52. word = word.slice( 0, -2 ) + 'ിന്റെ';
  53. } else if ( word.slice( -1 ) === '്' ) {
  54. word = word.slice( 0, -1 ) + 'ിന്റെ';
  55. } else if ( word.slice( -1 ) === 'ു' ||
  56. word.slice( -1 ) === 'ൂ' ||
  57. word.slice( -1 ) === 'ൗ' ||
  58. word.slice( -1 ) === 'ൌ'
  59. ) {
  60. word += 'വിന്റെ';
  61. } else if ( word.slice( -1 ) === 'ൻ' ) {
  62. // Atomic chillu n. അവൻ -> അവന്റെ
  63. word = word.slice( 0, -1 ) + 'ന്റെ';
  64. } else if ( word.slice( -3 ) === 'ന്\u200d' ) {
  65. // chillu n. അവൻ -> അവന്റെ
  66. word = word.slice( 0, -1 ) + 'റെ';
  67. } else if ( word.slice( -3 ) === 'ള്\u200d' ) {
  68. // chillu n. അവൾ -> അവളുടെ
  69. word = word.slice( 0, -2 ) + 'ുടെ';
  70. } else if ( word.slice( -1 ) === 'ൾ' ) {
  71. // Atomic chillu n. അവള്\u200d -> അവളുടെ
  72. word = word.slice( 0, -1 ) + 'ളുടെ';
  73. } else if ( word.slice( -1 ) === 'ൽ' ) {
  74. // Atomic l. മുയല്\u200d -> മുയലിന്റെ
  75. word = word.slice( 0, -1 ) + 'ലിന്റെ';
  76. } else if ( word.slice( -3 ) === 'ല്\u200d' ) {
  77. // chillu l. മുയല്\u200d -> അവളുടെ
  78. word = word.slice( 0, -2 ) + 'ിന്റെ';
  79. } else if ( word.slice( -3 ) === 'ര്\u200d' ) {
  80. // chillu r. അവര്\u200d -> അവരുടെ
  81. word = word.slice( 0, -2 ) + 'ുടെ';
  82. } else if ( word.slice( -1 ) === 'ർ' ) {
  83. // Atomic chillu r. അവർ -> അവരുടെ
  84. word = word.slice( 0, -1 ) + 'രുടെ';
  85. } else {
  86. word += 'യുടെ';
  87. }
  88. break;
  89. }
  90. return word;
  91. }
  92. } );
  93. }( jQuery ) );