/**
* Get an array of language names, indexed by code.
* @param null|string $inLanguage Code of language in which to return the names
- * Use null for autonyms (native names)
+ * Use null for autonyms (native names)
* @param string $include One of:
- * 'all' all available languages
- * 'mw' only if the language is defined in MediaWiki or wgExtraLanguageNames (default)
- * 'mwfile' only if the language is in 'mw' *and* has a message file
+ * 'all' all available languages
+ * 'mw' only if the language is defined in MediaWiki or wgExtraLanguageNames (default)
+ * 'mwfile' only if the language is in 'mw' *and* has a message file
* @return array Language code => language name
* @since 1.20
*/
* @param int $length Maximum length (including ellipsis)
* @param string $ellipsis String to append to the truncated text
* @param bool $adjustLength Subtract length of ellipsis from $length.
- * $adjustLength was introduced in 1.18, before that behaved as if false.
+ * $adjustLength was introduced in 1.18, before that behaved as if false.
* @return string
*/
function truncate( $string, $length, $ellipsis = '...', $adjustLength = true ) {
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
*
/**
* 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 );
}
/**
* @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 ) {