b4c5276b8f387a878dda25057d855b66a80683c9
[lhc/web/wiklou.git] / languages / LanguageAr.php
1 <?php
2 # See language.doc
3 include_once("LanguageUtf8.php");
4
5 /* private */ $wgNamespaceNamesAr = array(
6 -2 => "ملف",
7 -1 => "خاص",
8 0 => "",
9 1 => "نقاش",
10 2 => "مستخدم",
11 3 => "نقاش_المستخدم",
12 4 => "ويكيبيديا",
13 5 => "ويكيبيديا_نقاش",
14 6 => "صورة",
15 7 => "نقاش_الصورة",
16 8 => "MediaWiki",
17 9 => "MediaWiki_talk",
18 );
19
20 /* private */ $wgWeekdayNamesAr = array(
21 "الأحد", "الإثنين", "الثلاثاء", "الأربعاء", "الخميس",
22 "الجمعة", "السبت"
23 );
24
25 /* private */ $wgMonthNamesAr = array(
26 "يناير", "فبراير", "مارس", "ابريل", "مايو", "يونيو",
27 "يوليو", "أغسطس", "سبتمبر", "اكتوبر", "نوفمبر",
28 "ديسمبر"
29 );
30
31 class LanguageAr extends LanguageUtf8 {
32 var $digitTransTable = array(
33 "0" => "٠",
34 "1" => "١",
35 "2" => "٢",
36 "3" => "٣",
37 "4" => "٤",
38 "5" => "٥",
39 "6" => "٦",
40 "7" => "٧",
41 "8" => "٨",
42 "9" => "٩",
43 "%" => "٪",
44 "." => "٫",
45 "," => "٬"
46 );
47
48 # TODO: TRANSLATION!
49
50 # Inherit everything except...
51
52 function getNamespaces()
53 {
54 global $wgNamespaceNamesAr;
55 return $wgNamespaceNamesAr;
56 }
57
58
59 function getNsText( $index )
60 {
61 global $wgNamespaceNamesAr;
62 return $wgNamespaceNamesAr[$index];
63 }
64
65 function getNsIndex( $text )
66 {
67 global $wgNamespaceNamesAr;
68
69 foreach ( $wgNamespaceNamesAr as $i => $n )
70 {
71 if ( 0 == strcasecmp( $n, $text ) ) { return $i; }
72 }
73 return LanguageUtf8::getNsIndex( $text );
74 }
75
76 function getMonthName( $key )
77 {
78 global $wgMonthNamesAr;
79 return $wgMonthNamesAr[$key-1];
80 }
81
82 function getMonthAbbreviation( $key )
83 {
84 /* No abbreviations in Arabic */
85 return $this->getMonthName( $key );
86 }
87
88 function getWeekdayName( $key )
89 {
90 global $wgWeekdayNamesAr;
91 return $wgWeekdayNamesAr[$key-1];
92 }
93
94 function isRTL() { return true; }
95
96 function linkPrefixExtension() { return true; }
97
98 function getDefaultUserOptions () {
99 global $wgDefaultUserOptionsEn;
100 $opt = $wgDefaultUserOptionsEn;
101
102 # Swap sidebar to right side by default
103 $opt['quickbar'] = 2;
104
105 # Underlines seriously harm legibility. Force off:
106 $opt['underline'] = 0;
107 return $opt ;
108 }
109
110 function checkTitleEncoding( $s ) {
111 global $wgInputEncoding;
112
113 # Check for non-UTF-8 URLs; assume they are windows-1256?
114 $ishigh = preg_match( '/[\x80-\xff]/', $s);
115 $isutf = ($ishigh ? preg_match( '/^([\x00-\x7f]|[\xc0-\xdf][\x80-\xbf]|' .
116 '[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xf7][\x80-\xbf]{3})+$/', $s ) : true );
117
118 if( $ishigh and !$isutf )
119 return iconv( "windows-1256", "utf-8", $s );
120
121 return $s;
122 }
123
124 function formatNum( $number ) {
125 return strtr( $number, $this->digitTransTable );
126 }
127 }
128
129 ?>