LanguageSl.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /** Slovenian (Slovenščina)
  3. *
  4. * @ingroup Language
  5. */
  6. class LanguageSl extends Language {
  7. # Convert from the nominative form of a noun to some other case
  8. # Invoked with {{GRAMMAR:case|word}}
  9. /**
  10. * Cases: rodilnik, dajalnik, tožilnik, mestnik, orodnik
  11. */
  12. function convertGrammar( $word, $case ) {
  13. global $wgGrammarForms;
  14. if ( isset($wgGrammarForms['sl'][$case][$word]) ) {
  15. return $wgGrammarForms['sl'][$case][$word];
  16. }
  17. switch ( $case ) {
  18. case 'mestnik': # locative
  19. $word = 'o ' . $word; break;
  20. case 'orodnik': # instrumental
  21. $word = 'z ' . $word;
  22. }
  23. return $word; # this will return the original value for 'imenovalnik' (nominativ) and all undefined case values
  24. }
  25. function convertPlural( $count, $forms ) {
  26. if ( !count($forms) ) { return ''; }
  27. $forms = $this->preConvertPlural( $forms, 5 );
  28. if ( $count % 100 == 1 ) {
  29. $index = 0;
  30. } elseif ( $count % 100 == 2 ) {
  31. $index = 1;
  32. } elseif ( $count % 100 == 3 || $count % 100 == 4 ) {
  33. $index = 2;
  34. } elseif ( $count != 0 ) {
  35. $index = 3;
  36. } else {
  37. $index = 4;
  38. }
  39. return $forms[$index];
  40. }
  41. }