LanguageCu.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /** Old Church Slavonic (Ѩзыкъ словѣньскъ)
  3. *
  4. * @ingroup Language
  5. */
  6. class LanguageCu extends Language {
  7. # Convert from the nominative form of a noun to some other case
  8. # Invoked with {{grammar:case|word}}
  9. function convertGrammar( $word, $case ) {
  10. global $wgGrammarForms;
  11. if ( isset($wgGrammarForms['сu'][$case][$word]) ) {
  12. return $wgGrammarForms['сu'][$case][$word];
  13. }
  14. # These rules are not perfect, but they are currently only used for site names so it doesn't
  15. # matter if they are wrong sometimes. Just add a special case for your site name if necessary.
  16. #join and array_slice instead mb_substr
  17. $ar = array();
  18. preg_match_all( '/./us', $word, $ar );
  19. if (!preg_match("/[a-zA-Z_]/us", $word))
  20. switch ( $case ) {
  21. case 'genitive': #родительный падеж
  22. if ((join('',array_slice($ar[0],-4))=='вики') || (join('',array_slice($ar[0],-4))=='Вики'))
  23. {}
  24. elseif (join('',array_slice($ar[0],-2))=='ї')
  25. $word = join('',array_slice($ar[0],0,-2)).'їѩ';
  26. break;
  27. case 'accusative': #винительный падеж
  28. #stub
  29. break;
  30. }
  31. return $word;
  32. }
  33. function convertPlural( $count, $forms ) {
  34. if ( !count($forms) ) { return ''; }
  35. $forms = $this->preConvertPlural( $forms, 4 );
  36. switch ($count % 10) {
  37. case 1: return $forms[0];
  38. case 2: return $forms[1];
  39. case 3:
  40. case 4: return $forms[2];
  41. default: return $forms[3];
  42. }
  43. }
  44. }