Fix 'oops' in gsw
[mediawiki.git] / languages / classes / LanguageHe.php
blobca760c1a36ff293454c1ffc43c53160a9f138e3a
1 <?php
2 /**
3 * Hebrew (עברית)
5 * @addtogroup Language
7 * @author Rotem Liss
8 */
10 class LanguageHe extends Language {
11 /**
12 * Convert grammar forms of words.
14 * Available cases:
15 * "prefixed" (or "תחילית") - when the word has a prefix
17 * @param string the word to convert
18 * @param string the case
20 public function convertGrammar( $word, $case ) {
21 global $wgGrammarForms;
22 if ( isset($wgGrammarForms['he'][$case][$word]) ) {
23 return $wgGrammarForms['he'][$case][$word];
26 switch ( $case ) {
27 case 'prefixed':
28 case 'תחילית':
29 # Duplicate the "Waw" if prefixed
30 if ( substr( $word, 0, 2 ) == "ו" && substr( $word, 0, 4 ) != "וו" ) {
31 $word = "ו".$word;
34 # Remove the "He" if prefixed
35 if ( substr( $word, 0, 2 ) == "ה" ) {
36 $word = substr( $word, 2 );
39 # Add a hyphen if non-Hebrew letters
40 if ( substr( $word, 0, 2 ) < "א" || substr( $word, 0, 2 ) > "ת" ) {
41 $word = "־".$word;
45 return $word;
48 /**
49 * Gets a number and uses the suited form of the word.
51 * @param integer the number of items
52 * @param string the first form (singular)
53 * @param string the second form (plural)
54 * @param string the third form (2 items, plural is used if not applicable and not specified
55 * @param not used (for compatibility with ancestor)
56 * @param not used (for compatibility with ancestor)
58 * @return string of the suited form of word
60 public function convertPlural( $count, $w1, $w2, $w3, $w4, $w5) {
61 if ( $count == '1' ) {
62 return $w1;
63 } elseif ( $count == '2' && $w3 ) {
64 return $w3;
65 } else {
66 return $w2;