Update RELEASE-NOTES-1.31
[lhc/web/wiklou.git] / languages / Language.php
index fc8ef87..42de91e 100644 (file)
@@ -1931,7 +1931,11 @@ class Language {
                                        $gy_offset = '元';
                                }
                                $gy_offset = '昭和' . $gy_offset;
-                       } else {
+                       } elseif (
+                               ( ( $gy == 1989 ) && ( $gm == 1 ) && ( $gd >= 8 ) ) ||
+                               ( ( $gy > 1989 ) && ( $gy < 2019 ) ) ||
+                               ( ( $gy == 2019 ) && ( $gm < 5 ) )
+                       ) {
                                # Heisei period
                                $gy_gannen = $gy - 1989 + 1;
                                $gy_offset = $gy_gannen;
@@ -1939,6 +1943,14 @@ class Language {
                                        $gy_offset = '元';
                                }
                                $gy_offset = '平成' . $gy_offset;
+                       } else {
+                               # Reiwa period
+                               $gy_gannen = $gy - 2019 + 1;
+                               $gy_offset = $gy_gannen;
+                               if ( $gy_gannen == 1 ) {
+                                       $gy_offset = '元';
+                               }
+                               $gy_offset = '令和' . $gy_offset;
                        }
                } else {
                        $gy_offset = $gy;
@@ -4148,6 +4160,18 @@ class Language {
                return $this->mConverter;
        }
 
+       /**
+        * convert text to a variant
+        *
+        * @param string $text text to convert
+        * @param string|bool $variant variant to convert to, or false to use the user's preferred
+        *      variant (if logged in), or the project default variant
+        * @return string the converted string
+        */
+       public function autoConvert( $text, $variant = false ) {
+               return $this->mConverter->autoConvert( $text, $variant );
+       }
+
        /**
         * convert text to all supported variants
         *
@@ -4181,11 +4205,13 @@ class Language {
        /**
         * Convert a namespace index to a string in the preferred variant
         *
-        * @param int $ns
-        * @return string
+        * @param int $ns namespace index (https://www.mediawiki.org/wiki/Manual:Namespace)
+        * @param string|null $variant variant to convert to, or null to use the user's preferred
+        *      variant (if logged in), or the project default variant
+        * @return string a string representation of the namespace
         */
-       public function convertNamespace( $ns ) {
-               return $this->mConverter->convertNamespace( $ns );
+       public function convertNamespace( $ns, $variant = null ) {
+               return $this->mConverter->convertNamespace( $ns, $variant );
        }
 
        /**
@@ -4822,7 +4848,7 @@ class Language {
         * @param string $details HTML safe text between brackets
         * @param bool $oppositedm Add the direction mark opposite to your
         *   language, to display text properly
-        * @return HTML escaped string
+        * @return string HTML escaped
         */
        function specialList( $page, $details, $oppositedm = true ) {
                if ( !$details ) {