uk.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /**
  2. * Ukrainian (Українська) language functions
  3. */
  4. ( function ( $ ) {
  5. 'use strict';
  6. $.i18n.languages.uk = $.extend( {}, $.i18n.languages[ 'default' ], {
  7. convertGrammar: function ( word, form ) {
  8. switch ( form ) {
  9. case 'genitive': // родовий відмінок
  10. if ( word.slice( -1 ) === 'ь' ) {
  11. word = word.slice( 0, -1 ) + 'я';
  12. } else if ( word.slice( -2 ) === 'ія' ) {
  13. word = word.slice( 0, -2 ) + 'ії';
  14. } else if ( word.slice( -2 ) === 'ка' ) {
  15. word = word.slice( 0, -2 ) + 'ки';
  16. } else if ( word.slice( -2 ) === 'ти' ) {
  17. word = word.slice( 0, -2 ) + 'тей';
  18. } else if ( word.slice( -2 ) === 'ды' ) {
  19. word = word.slice( 0, -2 ) + 'дов';
  20. } else if ( word.slice( -3 ) === 'ник' ) {
  21. word = word.slice( 0, -3 ) + 'ника';
  22. }
  23. break;
  24. case 'accusative': // знахідний відмінок
  25. if ( word.slice( -2 ) === 'ія' ) {
  26. word = word.slice( 0, -2 ) + 'ію';
  27. }
  28. break;
  29. }
  30. return word;
  31. }
  32. } );
  33. }( jQuery ) );