<?php
+
/**
* Base class for content handling.
*
$slotDiffRenderer->setStatsdDataFactory( $statsdDataFactory );
// XXX using the page language would be better, but it's unclear how that should be injected
$slotDiffRenderer->setLanguage( $contentLanguage );
- $slotDiffRenderer->setWikiDiff2MovedParagraphDetectionCutoff(
- $context->getConfig()->get( 'WikiDiff2MovedParagraphDetectionCutoff' )
- );
$engine = DifferenceEngine::getEngine();
if ( $engine === false ) {
* This default implementation just returns the content language (except for pages
* in the MediaWiki namespace)
*
- * Note that the pages language is not cacheable, since it may in some
+ * Note that the page's language is not cacheable, since it may in some
* cases depend on user settings.
*
* Also note that the page language may or may not depend on the actual content of the page,
global $wgLang;
$pageLang = MediaWikiServices::getInstance()->getContentLanguage();
- if ( $title->getNamespace() == NS_MEDIAWIKI ) {
+ if ( $title->inNamespace( NS_MEDIAWIKI ) ) {
// Parse mediawiki messages with correct target language
list( /* $unused */, $lang ) = MessageCache::singleton()->figureMessage( $title->getText() );
$pageLang = Language::factory( $lang );
}
+ // Simplify hook handlers by only passing objects of one type, in case nothing
+ // else has unstubbed the StubUserLang object by now.
+ StubObject::unstub( $wgLang );
+
Hooks::run( 'PageContentLanguage', [ $title, &$pageLang, $wgLang ] );
return wfGetLangObj( $pageLang );