Merge "Use services from Parser"

This commit is contained in:
jenkins-bot 2021-11-12 08:44:56 +00:00 committed by Gerrit Code Review
commit e378b75454
2 changed files with 3 additions and 7 deletions

View file

@ -11,7 +11,7 @@
"url": "https://www.mediawiki.org/wiki/Extension:InputBox",
"descriptionmsg": "inputbox-desc",
"requires": {
"MediaWiki": ">= 1.30.0"
"MediaWiki": ">= 1.38.0"
},
"license-name": "MIT",
"type": "parserhook",

View file

@ -6,8 +6,6 @@
* @ingroup Extensions
*/
use MediaWiki\MediaWikiServices;
/**
* InputBox class
*/
@ -191,7 +189,7 @@ class InputBox {
// Determine namespace checkboxes
$namespacesArray = explode( ',', $this->mNamespaces );
if ( $this->mNamespaces ) {
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
$contLang = $this->mParser->getContentLanguage();
$namespaces = $contLang->getNamespaces();
$nsAliases = array_merge( $contLang->getNamespaceAliases(), $wgNamespaceAliases );
$showNamespaces = [];
@ -745,9 +743,7 @@ REGEX;
* @return string
*/
private function languageConvert( $text ) {
$lang = $this->mParser->getTargetLanguage();
$langConv = MediaWikiServices::getInstance()->getLanguageConverterFactory()
->getLanguageConverter( $lang );
$langConv = $this->mParser->getTargetLanguageConverter();
if ( $langConv->hasVariants() && strpos( $text, '-{' ) !== false ) {
$text = $langConv->convert( $text );
}