Jump to content

User:Michawiki/LanguageDsb

From translatewiki.net

<?php

/** Lower Sorbian (Dolnoserbski)

*
* @ingroup Language
*/

class LanguageDsb extends Language {

   # Convert from the nominative form of a noun to some other case
   # Invoked with word
   function convertGrammar( $word, $case ) {
       global $wgGrammarForms;
       if ( isset( $wgGrammarForms['dsb'][$case][$word] ) ) {
           return $wgGrammarForms['dsb'][$case][$word];
       }
       switch ( $case ) {
           case 'genitiw': # genitive
               if ( $word == 'Wikipedija' ) {
                   $word = 'Wikipedije';
               } elseif ( $word == 'Wikiknigły' ) {
                   $word = 'Wikiknigłow';
               } elseif ( $word == 'Wikinowosće' ) {
                   $word = 'Wikinowosćow';
               } elseif ( $word == 'Wikižrědło' ) {
                   $word = 'Wikižrědła';
               } elseif ( $word == 'Wikicitaty' ) {
                   $word = 'Wikicitatow';
               } elseif ( $word == 'Wikisłownik' ) {
                   $word = 'Wikisłownika';
               }
               break;
           case 'datiw': # dative
               if ( $word == 'Wikipedija' ) {
                   $word = 'Wikipediji';
               } elseif ( $word == 'Wikiknigły' ) {
                   $word = 'Wikiknigłam';
               } elseif ( $word == 'Wikinonowosće' ) {
                   $word = 'Wikinowosćam';
               } elseif ( $word == 'Wikižrědło' ) {
                   $word = 'Wikižřědłoju';
               } elseif ( $word == 'Wikicitaty' ) {
                   $word = 'Wikicitatam';
               } elseif ( $word == 'Wikisłownik' ) {
                   $word = 'Wikisłownikoju';
               }
               break;
           case 'akuzatiw': # accusative
               if ( $word == 'Wikipedija' ) {
                   $word = 'Wikipediju';
               } elseif ( $word == 'Wikiknigły' ) {
                   $word = 'Wikiknigły';
               } elseif ( $word == 'Wikinowosće' ) {
                   $word = 'Wikinowosće';
               } elseif ( $word == 'Wikižrědło' ) {
                   $word = 'Wikižrědło';
               } elseif ( $word == 'Wikicitaty' ) {
                   $word = 'Wikicitaty';
               } elseif ( $word == 'Wikisłownik' ) {
                   $word = 'Wikisłownik';
               }
               break;
           case 'instrumental': # instrumental
               if ( $word == 'Wikipedija' ) {
                   $word = 'Wikipediju';
               } elseif ( $word == 'Wikiknigły' ) {
                   $word = 'Wikiknigłami';
               } elseif ( $word == 'Wikinowosće' ) {
                   $word = 'Wikinowosćami';
               } elseif ( $word == 'Wikižrědło' ) {
                   $word = 'Wikižrědłom';
               } elseif ( $word == 'Wikicitaty' ) {
                   $word = 'Wikicitatami';
               } elseif ( $word == 'Wikisłownik' ) {
                   $word = 'Wikisłownikom';
               }
               break;
           case 'lokatiw': # locative
               if ( $word == 'Wikipedija' ) {
                   $word = 'Wikipediji';
               } elseif ( $word == 'Wikiknigly' ) {
                   $word = 'Wikiknigłach';
               } elseif ( $word == 'Wikinowosće' ) {
                   $word = 'Wikinowosćach';
               } elseif ( $word == 'Wikižřědło' ) {
                   $word = 'Wikižrědle';
               } elseif ( $word == 'Wikicitaty' ) {
                   $word = 'Wikicitatach';
               } elseif ( $word == 'Wikisłownik' ) {
                   $word = 'Wikisłowniku';
               }
               break;
           }
       return $word; # this will return the original value for 'nominatiw' (nominativ) and all undefined case values
   }
   function convertPlural( $count, $forms ) {
       if ( !count($forms) ) { return ; }
       $forms = $this->preConvertPlural( $forms, 4 );
       switch ( abs( $count ) % 100 ) {
           case 1:  return $forms[0]; // singular
           case 2:  return $forms[1]; // dual
           case 3:
           case 4:  return $forms[2]; // plural
           default: return $forms[3]; // pluralgen
       }
   }

}