Use the new and more accurate classes for Arabic per
[lhc/web/wiklou.git] / languages / Language.php
index c54b56d..917898f 100644 (file)
@@ -35,7 +35,8 @@ if( function_exists( 'mb_strtoupper' ) ) {
 class FakeConverter {
        var $mLang;
        function FakeConverter($langobj) {$this->mLang = $langobj;}
-       function convert($t, $i, $v) {return $t;}
+       function autoConvertToAllVariants($text) {return $text;}
+       function convert($t, $i) {return $t;}
        function parserConvert($t, $p) {return $t;}
        function getVariants() { return array( $this->mLang->getCode() ); }
        function getPreferredVariant() {return $this->mLang->getCode(); }
@@ -46,7 +47,6 @@ class FakeConverter {
        function convertCategoryKey( $key ) {return $key; }
        function convertLinkToAllVariants($text){ return array( $this->mLang->getCode() => $text); }
        function armourMath($text){ return $text; }
-       function groupConvert($group) {return '';}
 }
 
 /**
@@ -1154,11 +1154,25 @@ class Language {
                        # Months and days are identical
                        $gy_offset = $gy - 1911;
                } else if (!strcmp($cName,'tenno')) {
-                       # Minguo dates up to Showa period
+                       # Nengō dates up to Meiji period
                        # Deduct years from the Gregorian calendar
                        # depending on the nengo periods
                        # Months and days are identical
-                       if (($gy < 1989) || (($gy == 1989) && ($gm == 1) && ($gd < 8))) {
+                       if (($gy < 1912) || (($gy == 1912) && ($gm < 7)) || (($gy == 1912) && ($gm == 7) && ($gd < 31))) {
+                               # Meiji period
+                               $gy_gannen = $gy - 1868 + 1;
+                               $gy_offset = $gy_gannen;
+                               if ($gy_gannen == 1)
+                                       $gy_offset = '元';
+                               $gy_offset = '明治'.$gy_offset;
+                       } else if ((($gy == 1912) && ($gm == 7) && ($gd == 31)) || (($gy == 1912) && ($gm >= 8)) || (($gy > 1912) && ($gy < 1926)) || (($gy == 1926) && ($gm < 12)) || (($gy == 1926) && ($gm == 12) && ($gd < 26))) {
+                               # Taishō period
+                               $gy_gannen = $gy - 1912 + 1;
+                               $gy_offset = $gy_gannen;
+                               if ($gy_gannen == 1)
+                                       $gy_offset = '元';
+                               $gy_offset = '大正'.$gy_offset;
+                       } else if ((($gy == 1926) && ($gm == 12) && ($gd >= 26)) || (($gy > 1926) && ($gy < 1989)) || (($gy == 1989) && ($gm == 1) && ($gd < 8))) {
                                # Shōwa period
                                $gy_gannen = $gy - 1926 + 1;
                                $gy_offset = $gy_gannen;
@@ -2035,7 +2049,7 @@ class Language {
        function commaList( $list ) {
                return implode(
                        $list,
-                       wfMsgExt( 'comma-separator', array( 'escapenoentities', 'language' => $this ) ) );
+                       wfMsgExt( 'comma-separator', array( 'parsemag', 'escapenoentities', 'language' => $this ) ) );
        }
 
        /**
@@ -2047,7 +2061,7 @@ class Language {
        function semicolonList( $list ) {
                return implode(
                        $list,
-                       wfMsgExt( 'semicolon-separator', array( 'escapenoentities', 'language' => $this ) ) );
+                       wfMsgExt( 'semicolon-separator', array( 'parsemag', 'escapenoentities', 'language' => $this ) ) );
        }
 
        /**
@@ -2229,9 +2243,14 @@ class Language {
                return $text;
        }
 
+       # convert text to all supported variants
+       function autoConvertToAllVariants($text) {
+               return $this->mConverter->autoConvertToAllVariants($text);
+       }
+
        # convert text to different variants of a language.
-       function convert( $text, $isTitle = false, $variant = null ) {
-               return $this->mConverter->convert($text, $isTitle, $variant);
+       function convert( $text, $isTitle = false) {
+               return $this->mConverter->convert($text, $isTitle);
        }
 
        # Convert text from within Parser
@@ -2338,16 +2357,6 @@ class Language {
        function markNoConversion( $text, $noParse=false ) {
                return $this->mConverter->markNoConversion( $text, $noParse );
        }
-       
-       /**
-        * Callback function for magicword 'groupconvert'
-        *
-        * @param string $group: the group name called for
-        * @return blank string
-        */
-       function groupConvert( $group ) {
-               return $this->mConverter->groupConvert( $group );
-       }
 
        /**
         * A regular expression to match legal word-trailing characters