LanguageBe_tarask.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /** Belarusian in Taraškievica orthography (Беларуская тарашкевіца)
  3. *
  4. * @ingroup Language
  5. *
  6. * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
  7. * @bug 1638, 2135
  8. * @link http://be.wikipedia.org/wiki/Talk:LanguageBe.php
  9. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
  10. * @license http://www.gnu.org/copyleft/fdl.html GNU Free Documentation License
  11. */
  12. class LanguageBe_tarask extends Language {
  13. /**
  14. * Plural form transformations
  15. *
  16. * $wordform1 - singular form (for 1, 21, 31, 41...)
  17. * $wordform2 - plural form (for 2, 3, 4, 22, 23, 24, 32, 33, 34...)
  18. * $wordform3 - plural form (for 0, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 25, 26...)
  19. */
  20. function convertPlural( $count, $forms ) {
  21. if ( !count($forms) ) { return ''; }
  22. //if no number with word, then use $form[0] for singular and $form[1] for plural or zero
  23. if( count($forms) === 2 ) return $count == 1 ? $forms[0] : $forms[1];
  24. $forms = $this->preConvertPlural( $forms, 3 );
  25. if ($count > 10 && floor(($count % 100) / 10) == 1) {
  26. return $forms[2];
  27. } else {
  28. switch ($count % 10) {
  29. case 1: return $forms[0];
  30. case 2:
  31. case 3:
  32. case 4: return $forms[1];
  33. default: return $forms[2];
  34. }
  35. }
  36. }
  37. }