]> scripts.mit.edu Git - autoinstalls/mediawiki.git/blobdiff - languages/classes/LanguageAr.php
MediaWiki 1.17.0
[autoinstalls/mediawiki.git] / languages / classes / LanguageAr.php
index 514ff028c62d45d8e7688871a47a640386616492..77c46025129a1658e22ae090c9347c5168c70490 100644 (file)
@@ -1,27 +1,44 @@
 <?php
 /** Arabic (العربية)
  *
- * @addtogroup Language
+ * @ingroup Language
  *
  * @author Niklas Laxström
  */
 class LanguageAr extends Language {
+       function convertPlural( $count, $forms ) {
+               if ( !count( $forms ) ) { return ''; }
+               $forms = $this->preConvertPlural( $forms, 6 );
 
-       function convertPlural( $count, $w1, $w2, $w3, $w4, $w5) {
-               $forms = array($w1, $w2, $w3, $w4, $w5);
-               if ( $count == 1 ) {
+               if ( $count == 0 ) {
                        $index = 0;
-               } elseif( $count == 2 ) {
+               } elseif ( $count == 1 ) {
                        $index = 1;
-               } elseif( $count < 11 && $count > 2 ) {
+               } elseif ( $count == 2 ) {
                        $index = 2;
-               } elseif( $count % 100 == 0) {
+               } elseif ( $count % 100 >= 3 && $count % 100 <= 10 ) {
                        $index = 3;
-               } else {
+               } elseif ( $count % 100 >= 11 && $count % 100 <= 99 ) {
                        $index = 4;
+               } else {
+                       $index = 5;
                }
                return $forms[$index];
        }
 
+       /**
+        * Temporary hack for bug 9413: replace Arabic presentation forms with their
+        * standard equivalents.
+        *
+        * FIXME: This is language-specific for now only to avoid the negative
+        * performance impact of enabling it for all languages.
+        */
+       function normalize( $s ) {
+               global $wgFixArabicUnicode;
+               $s = parent::normalize( $s );
+               if ( $wgFixArabicUnicode ) {
+                       $s = $this->transformUsingPairFile( 'normalize-ar.ser', $s );
+               }
+               return $s;
+       }
 }
-