Use correct BCP 47 language codes in lang="…" attributes

A small mistake made in I7a82143. This is only relevant for very few
(but critical) language codes. For example, the dialog allows to add
the MediaWiki code "zh-classical". This needs to be translated to
"lzh", but only when we use it directly in HTML.

Bug: T238329
Change-Id: Ifcbb877fb6a348937e85a82459e924548f5ca856
This commit is contained in:
thiemowmde 2023-09-21 17:33:41 +02:00
parent 10e1c26580
commit f302f65dbb
2 changed files with 4 additions and 2 deletions

View file

@ -91,6 +91,7 @@
], ],
"dependencies": [ "dependencies": [
"mediawiki.api", "mediawiki.api",
"mediawiki.language",
"mediawiki.user", "mediawiki.user",
"oojs-ui-core", "oojs-ui-core",
"oojs-ui-widgets", "oojs-ui-widgets",

View file

@ -698,7 +698,7 @@ Dialog.prototype.onLanguageDropdownWidgetSelect = function ( item ) {
// Update description value // Update description value
this.descriptionInput.setValue( this.model.getTemplateDescription( language ) ) this.descriptionInput.setValue( this.model.getTemplateDescription( language ) )
.$input.attr( { lang: language, dir: 'auto' } ); .$input.attr( { lang: mw.language.bcp47( language ), dir: 'auto' } );
// Update all param descriptions in the param select widget // Update all param descriptions in the param select widget
this.repopulateParamSelectWidget(); this.repopulateParamSelectWidget();
@ -1253,7 +1253,8 @@ Dialog.prototype.updateParamDetailsLanguage = function () {
// * templatedata-modal-table-param-type // * templatedata-modal-table-param-type
var label = mw.msg( 'templatedata-modal-table-param-' + prop, this.language ); var label = mw.msg( 'templatedata-modal-table-param-' + prop, this.language );
this.propFieldLayout[ prop ].setLabel( label ); this.propFieldLayout[ prop ].setLabel( label );
this.propInputs[ prop ].$input.attr( { lang: this.language, dir: 'auto' } ); this.propInputs[ prop ]
.$input.attr( { lang: mw.language.bcp47( this.language ), dir: 'auto' } );
} }
}; };