]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blob - languages/classes/LanguageAr.php
MediaWiki 1.16.0
[autoinstallsdev/mediawiki.git] / languages / classes / LanguageAr.php
1 <?php
2 /** Arabic (العربية)
3  *
4  * @ingroup Language
5  *
6  * @author Niklas Laxström
7  */
8 class LanguageAr extends Language {
9         function convertPlural( $count, $forms ) {
10                 if ( !count($forms) ) { return ''; }
11                 $forms = $this->preConvertPlural( $forms, 6 );
12
13                 if ( $count == 0 ) {
14                         $index = 0;
15                 } elseif ( $count == 1 ) {
16                         $index = 1;
17                 } elseif( $count == 2 ) {
18                         $index = 2;
19                 } elseif( $count % 100 >= 3 && $count % 100 <= 10 ) {
20                         $index = 3;
21                 } elseif( $count % 100 >= 11 && $count % 100 <= 99 ) {
22                         $index = 4;
23                 } else {
24                         $index = 5;
25                 }
26                 return $forms[$index];
27         }
28
29         /**
30          * Temporary hack for bug 9413: replace Arabic presentation forms with their 
31          * standard equivalents. 
32          *
33          * FIXME: This is language-specific for now only to avoid the negative 
34          * performance impact of enabling it for all languages.
35          */
36         function normalize( $s ) {
37                 global $wgFixArabicUnicode;
38                 $s = parent::normalize( $s );
39                 if ( $wgFixArabicUnicode ) {
40                         $s = $this->transformUsingPairFile( 'normalize-ar.ser', $s );
41                 }
42                 return $s;
43         }
44 }