2004-02-18 02:15:00 +00:00
|
|
|
|
<?php
|
2005-04-05 11:00:27 +00:00
|
|
|
|
/**
|
2006-06-16 18:47:15 +00:00
|
|
|
|
* Hebrew (עברית)
|
|
|
|
|
|
*
|
2007-01-20 15:09:52 +00:00
|
|
|
|
* @addtogroup Language
|
2006-06-16 18:47:15 +00:00
|
|
|
|
*
|
2006-08-13 21:03:56 +00:00
|
|
|
|
* @author Rotem Liss
|
2006-06-16 18:47:15 +00:00
|
|
|
|
*/
|
2003-07-12 07:53:14 +00:00
|
|
|
|
|
2006-07-26 07:15:39 +00:00
|
|
|
|
class LanguageHe extends Language {
|
2006-05-26 18:26:51 +00:00
|
|
|
|
/**
|
2006-06-25 10:37:45 +00:00
|
|
|
|
* Convert grammar forms of words.
|
2006-06-16 18:47:15 +00:00
|
|
|
|
*
|
2006-06-25 10:37:45 +00:00
|
|
|
|
* Available cases:
|
|
|
|
|
|
* "prefixed" (or "תחילית") - when the word has a prefix
|
2006-05-26 18:26:51 +00:00
|
|
|
|
*
|
2006-06-25 10:37:45 +00:00
|
|
|
|
* @param string the word to convert
|
|
|
|
|
|
* @param string the case
|
|
|
|
|
|
*/
|
2006-07-07 13:12:51 +00:00
|
|
|
|
public function convertGrammar( $word, $case ) {
|
2006-06-25 10:37:45 +00:00
|
|
|
|
global $wgGrammarForms;
|
|
|
|
|
|
if ( isset($wgGrammarForms['he'][$case][$word]) ) {
|
|
|
|
|
|
return $wgGrammarForms['he'][$case][$word];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch ( $case ) {
|
|
|
|
|
|
case 'prefixed':
|
|
|
|
|
|
case 'תחילית':
|
|
|
|
|
|
# Duplicate the "Waw" if prefixed
|
|
|
|
|
|
if ( substr( $word, 0, 2 ) == "ו" && substr( $word, 0, 4 ) != "וו" ) {
|
|
|
|
|
|
$word = "ו".$word;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Remove the "He" if prefixed
|
|
|
|
|
|
if ( substr( $word, 0, 2 ) == "ה" ) {
|
|
|
|
|
|
$word = substr( $word, 2 );
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Add a hyphen if non-Hebrew letters
|
|
|
|
|
|
if ( substr( $word, 0, 2 ) < "א" || substr( $word, 0, 2 ) > "ת" ) {
|
|
|
|
|
|
$word = "־".$word;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return $word;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Gets a number and uses the suited form of the word.
|
2006-05-26 18:26:51 +00:00
|
|
|
|
*
|
2006-06-25 10:37:45 +00:00
|
|
|
|
* @param integer the number of items
|
|
|
|
|
|
* @param string the first form (singular)
|
|
|
|
|
|
* @param string the second form (plural)
|
2006-12-16 22:31:08 +00:00
|
|
|
|
* @param string the third form (2 items, plural is used if not applicable and not specified
|
|
|
|
|
|
* @param not used (for compatibility with ancestor)
|
|
|
|
|
|
* @param not used (for compatibility with ancestor)
|
2006-06-16 18:47:15 +00:00
|
|
|
|
*
|
|
|
|
|
|
* @return string of the suited form of word
|
2006-05-26 18:26:51 +00:00
|
|
|
|
*/
|
2006-12-16 22:31:08 +00:00
|
|
|
|
public function convertPlural( $count, $w1, $w2, $w3, $w4, $w5) {
|
2006-05-26 18:26:51 +00:00
|
|
|
|
if ( $count == '1' ) {
|
2006-07-11 15:18:09 +00:00
|
|
|
|
return $w1;
|
|
|
|
|
|
} elseif ( $count == '2' && $w3 ) {
|
|
|
|
|
|
return $w3;
|
2006-05-26 18:26:51 +00:00
|
|
|
|
} else {
|
2006-07-11 15:18:09 +00:00
|
|
|
|
return $w2;
|
2006-05-26 18:26:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2003-07-08 20:17:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
?>
|