mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/InputBox
synced 2024-11-23 22:54:02 +00:00
Merge "Use services from Parser"
This commit is contained in:
commit
e378b75454
|
@ -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",
|
||||||
|
|
|
@ -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 );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue