Fix for bug 9413 and the related Malayalam issue reported on wikitech-l.
[lhc/web/wiklou.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 var $normalizeArray;
10
11 function convertPlural( $count, $forms ) {
12 if ( !count($forms) ) { return ''; }
13 $forms = $this->preConvertPlural( $forms, 6 );
14
15 if ( $count == 0 ) {
16 $index = 0;
17 } elseif ( $count == 1 ) {
18 $index = 1;
19 } elseif( $count == 2 ) {
20 $index = 2;
21 } elseif( $count % 100 >= 3 && $count % 100 <= 10 ) {
22 $index = 3;
23 } elseif( $count % 100 >= 11 && $count % 100 <= 99 ) {
24 $index = 4;
25 } else {
26 $index = 5;
27 }
28 return $forms[$index];
29 }
30
31 /**
32 * Temporary hack for bug 9413: replace Arabic presentation forms with their
33 * standard equivalents.
34 *
35 * FIXME: This is language-specific for now only to avoid the negative
36 * performance impact of enabling it for all languages.
37 */
38 function normalize( $s ) {
39 global $wgFixArchaicUnicode;
40 $s = parent::normalize( $s );
41 if ( $wgFixArchaicUnicode ) {
42 $s = $this->transformUsingPairFile( 'normalize-ar.ser', $s );
43 }
44 return $s;
45 }
46 }