TitleWidget: Account for non-BCP47 language codes in Intl.Collator

This fixes Special:MovePage in cbk-zam.wikipedia.org by passing a
well-formed language code using bcp47 rather than MW's own custom
code.

Bug: T228510
Change-Id: Id94bbf7b99794f944d176036d1c429d59bd7c8b2
This commit is contained in:
Niklas Laxström 2020-04-09 08:59:13 +02:00 committed by Jforrester
parent 4a98fe10bb
commit e1183f0f27
2 changed files with 5 additions and 1 deletions

View file

@ -2289,6 +2289,7 @@ return [
'mediawiki.Title',
'mediawiki.api',
'mediawiki.String',
'mediawiki.language',
],
'messages' => [
// NamespaceInputWidget

View file

@ -61,7 +61,10 @@
this.api = config.api || new mw.Api();
// Supports: IE10, FF28, Chrome23
this.compare = window.Intl && Intl.Collator ?
new Intl.Collator( mw.config.get( 'wgContentLanguage' ), { sensitivity: 'base' } ).compare :
new Intl.Collator(
mw.language.bcp47( mw.config.get( 'wgContentLanguage' ) ),
{ sensitivity: 'base' }
).compare :
null;
// Initialization