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", "url": "https://www.mediawiki.org/wiki/Extension:InputBox",
"descriptionmsg": "inputbox-desc", "descriptionmsg": "inputbox-desc",
"requires": { "requires": {
"MediaWiki": ">= 1.30.0" "MediaWiki": ">= 1.38.0"
}, },
"license-name": "MIT", "license-name": "MIT",
"type": "parserhook", "type": "parserhook",

View file

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