aboutsummaryrefslogtreecommitdiffstats
path: root/languages/LanguageAr.php
blob: a016e3601006e5052e1710fc399b1e9c62218de6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?
# See language.doc
include_once("LanguageUtf8.php");

$wgNamespaceNamesAr = array(
	"-2" => "ملف",
	"-1" => "خاص",
	"0" => "",
	"1" => "نقاش",
	"2" => "مستخدم",
	"3" => "نقاش_المستخدم",
	"4" => "ويكيبيديا",
	"5" => "ويكيبيديا_نقاش",
	"6" => "صورة",
	"7" => "نقاش_الصورة",
	"8" => "MediaWiki",
	"9" => "MediaWiki_talk",
);

class LanguageAr extends LanguageUtf8 {
	# TODO: TRANSLATION!

	# Inherit everything except...

	function getNamespaces()
	{
		global $wgNamespaceNamesAr;
		return $wgNamespaceNamesAr;
	}


	function getNsText( $index )
	{
		global $wgNamespaceNamesAr;
		return $wgNamespaceNamesAr[$index];
	}

	function getNsIndex( $text ) 
	{
		global $wgNamespaceNamesAr;

		foreach ( $wgNamespaceNamesAr as $i => $n ) 
		{
			if ( 0 == strcasecmp( $n, $text ) ) { return $i; }
		}
		return LanguageUtf8::getNsIndex( $text );
	}

	function isRTL() { return true; }

	function getDefaultUserOptions () {
		global $wgDefaultUserOptionsEn;
		$opt = $wgDefaultUserOptionsEn;

		# Swap sidebar to right side by default
		$opt['quickbar'] = 2;
		return $opt ;
	}

	function checkTitleEncoding( $s ) {
		global $wgInputEncoding;
		
		# Check for non-UTF-8 URLs; assume they are windows-1256?
	        $ishigh = preg_match( '/[\x80-\xff]/', $s);
		$isutf = ($ishigh ? preg_match( '/^([\x00-\x7f]|[\xc0-\xdf][\x80-\xbf]|' .
                '[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xf7][\x80-\xbf]{3})+$/', $s ) : true );

		if( $ishigh and !$isutf )
			return iconv( "windows-1256", "utf-8", $s );
		
		return $s;
	}

}

?>