MediaWiki  REL1_19
LanguageHe.php
Go to the documentation of this file.
00001 <?php
00002 
00010 class LanguageHe extends Language {
00011 
00023         public function convertGrammar( $word, $case ) {
00024                 global $wgGrammarForms;
00025                 if ( isset( $wgGrammarForms['he'][$case][$word] ) ) {
00026                         return $wgGrammarForms['he'][$case][$word];
00027                 }
00028 
00029                 switch ( $case ) {
00030                         case 'prefixed':
00031                         case 'תחילית':
00032                                 # Duplicate the "Waw" if prefixed
00033                                 if ( substr( $word, 0, 2 ) == "ו" && substr( $word, 0, 4 ) != "וו" ) {
00034                                         $word = "ו" . $word;
00035                                 }
00036 
00037                                 # Remove the "He" if prefixed
00038                                 if ( substr( $word, 0, 2 ) == "ה" ) {
00039                                         $word = substr( $word, 2 );
00040                                 }
00041 
00042                                 # Add a hyphen (maqaf) if non-Hebrew letters
00043                                 if ( substr( $word, 0, 2 ) < "א" || substr( $word, 0, 2 ) > "ת" ) {
00044                                         $word = "־" . $word;
00045                                 }
00046                 }
00047 
00048                 return $word;
00049         }
00050 
00058         function convertPlural( $count, $forms ) {
00059                 if ( !count( $forms ) ) { return ''; }
00060                 $forms = $this->preConvertPlural( $forms, 3 );
00061 
00062                 if ( $count == 1 ) {
00063                         return $forms[0]; // Singular
00064                 } elseif ( $count == 2 ) {
00065                         return $forms[2]; // Dual or plural if dual is not provided (filled in preConvertPlural)
00066                 } else {
00067                         return $forms[1]; // Plural
00068                 }
00069         }
00070 }