Restructured the languages directory, to avoid problems when people untar MW 1.8...
[lhc/web/wiklou.git] / languages / classes / LanguageHe.php
1 <?php
2 /**
3 * Hebrew (עברית)
4 *
5 * @package MediaWiki
6 * @subpackage Language
7 *
8 * @author Rotem Liss
9 */
10
11 class LanguageHe extends Language {
12 /**
13 * Convert grammar forms of words.
14 *
15 * Available cases:
16 * "prefixed" (or "תחילית") - when the word has a prefix
17 *
18 * @param string the word to convert
19 * @param string the case
20 */
21 public function convertGrammar( $word, $case ) {
22 global $wgGrammarForms;
23 if ( isset($wgGrammarForms['he'][$case][$word]) ) {
24 return $wgGrammarForms['he'][$case][$word];
25 }
26
27 switch ( $case ) {
28 case 'prefixed':
29 case 'תחילית':
30 # Duplicate the "Waw" if prefixed
31 if ( substr( $word, 0, 2 ) == "ו" && substr( $word, 0, 4 ) != "וו" ) {
32 $word = "ו".$word;
33 }
34
35 # Remove the "He" if prefixed
36 if ( substr( $word, 0, 2 ) == "ה" ) {
37 $word = substr( $word, 2 );
38 }
39
40 # Add a hyphen if non-Hebrew letters
41 if ( substr( $word, 0, 2 ) < "א" || substr( $word, 0, 2 ) > "ת" ) {
42 $word = "־".$word;
43 }
44 }
45
46 return $word;
47 }
48
49 /**
50 * Gets a number and uses the suited form of the word.
51 *
52 * @param integer the number of items
53 * @param string the first form (singular)
54 * @param string the second form (plural)
55 * @param string the third form (2 items, plural is used if not applicable and not specified)
56 *
57 * @return string of the suited form of word
58 */
59 public function convertPlural( $count, $w1, $w2, $w3) {
60 if ( $count == '1' ) {
61 return $w1;
62 } elseif ( $count == '2' && $w3 ) {
63 return $w3;
64 } else {
65 return $w2;
66 }
67 }
68 }
69
70 ?>