Add namespaces
[lhc/web/wiklou.git] / languages / LanguageAr.php
1 <?
2 # See language.doc
3 include_once("LanguageUtf8.php");
4
5 $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 class LanguageAr extends LanguageUtf8 {
21 # TODO: TRANSLATION!
22
23 # Inherit everything except...
24
25 function getNamespaces()
26 {
27 global $wgNamespaceNamesAr;
28 return $wgNamespaceNamesAr;
29 }
30
31
32 function getNsText( $index )
33 {
34 global $wgNamespaceNamesAr;
35 return $wgNamespaceNamesAr[$index];
36 }
37
38 function getNsIndex( $text )
39 {
40 global $wgNamespaceNamesAr;
41
42 foreach ( $wgNamespaceNamesAr as $i => $n )
43 {
44 if ( 0 == strcasecmp( $n, $text ) ) { return $i; }
45 }
46 return LanguageUtf8::getNsIndex( $text );
47 }
48
49 function isRTL() { return true; }
50
51 function getDefaultUserOptions () {
52 global $wgDefaultUserOptionsEn;
53 $opt = $wgDefaultUserOptionsEn;
54
55 # Swap sidebar to right side by default
56 $opt['quickbar'] = 2;
57 return $opt ;
58 }
59
60 function checkTitleEncoding( $s ) {
61 global $wgInputEncoding;
62
63 # Check for non-UTF-8 URLs; assume they are windows-1256?
64 $ishigh = preg_match( '/[\x80-\xff]/', $s);
65 $isutf = ($ishigh ? preg_match( '/^([\x00-\x7f]|[\xc0-\xdf][\x80-\xbf]|' .
66 '[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xf7][\x80-\xbf]{3})+$/', $s ) : true );
67
68 if( $ishigh and !$isutf )
69 return iconv( "windows-1256", "utf-8", $s );
70
71 return $s;
72 }
73
74 }
75
76 ?>