Merge "WikiPage: Avoid locking comment and actor tables in doDeleteArticleReal"
[lhc/web/wiklou.git] / languages / Language.php
index 252ce47..d750f7d 100644 (file)
@@ -2140,7 +2140,7 @@ class Language {
                        return $ts;
                }
 
-               MediaWiki\suppressWarnings(); // E_STRICT system time bitching
+               Wikimedia\suppressWarnings(); // E_STRICT system time bitching
                # Generate an adjusted date; take advantage of the fact that mktime
                # will normalize out-of-range values so we don't have to split $minDiff
                # into hours and minutes.
@@ -2153,7 +2153,7 @@ class Language {
                        (int)substr( $ts, 0, 4 ) ); # Year
 
                $date = date( 'YmdHis', $t );
-               MediaWiki\restoreWarnings();
+               Wikimedia\restoreWarnings();
 
                return $date;
        }
@@ -2605,9 +2605,9 @@ class Language {
                # *input* string. We just ignore those too.
                # REF: https://bugs.php.net/bug.php?id=37166
                # REF: https://phabricator.wikimedia.org/T18885
-               MediaWiki\suppressWarnings();
+               Wikimedia\suppressWarnings();
                $text = iconv( $in, $out . '//IGNORE', $string );
-               MediaWiki\restoreWarnings();
+               Wikimedia\restoreWarnings();
                return $text;
        }
 
@@ -4148,6 +4148,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 +4193,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 +4836,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 ) {