Replace deprecated Language::fetchLanguageName(s)

Bug: T325962
Change-Id: Iff57224d231480507f138f9ba51f385ed32bf5b1
This commit is contained in:
Umherirrender 2022-12-27 17:21:10 +01:00
parent b0cbcfffbf
commit e76dff032d
2 changed files with 5 additions and 4 deletions

View file

@ -127,7 +127,8 @@ class LanguageLibrary extends LibraryBase {
public function fetchLanguageName( $code, $inLanguage ) {
$this->checkType( 'fetchLanguageName', 1, $code, 'string' );
$this->checkTypeOptional( 'fetchLanguageName', 2, $inLanguage, 'string', null );
return [ Language::fetchLanguageName( $code, $inLanguage ) ];
return [ MediaWikiServices::getInstance()->getLanguageNameUtils()
->getLanguageName( $code, $inLanguage ) ];
}
/**
@ -140,7 +141,8 @@ class LanguageLibrary extends LibraryBase {
public function fetchLanguageNames( $inLanguage, $include ) {
$this->checkTypeOptional( 'fetchLanguageNames', 1, $inLanguage, 'string', null );
$this->checkTypeOptional( 'fetchLanguageNames', 2, $include, 'string', 'mw' );
return [ Language::fetchLanguageNames( $inLanguage, $include ) ];
return [ MediaWikiServices::getInstance()->getLanguageNameUtils()
->getLanguageNames( $inLanguage, $include ) ];
}
/**

View file

@ -2,7 +2,6 @@
namespace MediaWiki\Extension\Scribunto\Tests\Engines\LuaCommon;
use Language;
use MediaWiki\MediaWikiServices;
use Title;
@ -20,7 +19,7 @@ class LanguageLibraryTest extends LuaEngineUnitTestBase {
// Skip certain tests if something isn't providing translated language names
// (bug 67343)
if ( Language::fetchLanguageName( 'en', 'fr' ) === 'English' ) {
if ( MediaWikiServices::getInstance()->getLanguageNameUtils()->getLanguageName( 'en', 'fr' ) === 'English' ) {
$msg = 'Language name translations are unavailable; ' .
'install Extension:CLDR or something similar';
$this->skipTests += [