Replace deprecated Language::isValidBuiltInCode and Language::factory

Change-Id: I4c5bf4d68bcb79da33864dbffe395e3818050eb4
This commit is contained in:
Fomafix 2022-09-17 10:00:50 +00:00
parent a29459d71c
commit 6468bf9ebb

View file

@ -512,9 +512,10 @@ class ParserFunctions {
wfMessage( 'pfunc_time_too_small' )->inContentLanguage()->escaped() .
'</strong>';
} elseif ( $ts < 100000000000000 ) { // Language can't deal with years after 9999
if ( $language !== '' && Language::isValidBuiltInCode( $language ) ) {
$services = MediaWikiServices::getInstance();
if ( $language !== '' && $services->getLanguageNameUtils()->isValidBuiltInCode( $language ) ) {
// use whatever language is passed as a parameter
$langObject = Language::factory( $language );
$langObject = $services->getLanguageFactory()->getLanguage( $language );
} else {
// use wiki's content language
$langObject = $parser->getFunctionLang();