From f302f65dbb215a8cae65a2904a21a312989f0545 Mon Sep 17 00:00:00 2001 From: thiemowmde Date: Thu, 21 Sep 2023 17:33:41 +0200 Subject: [PATCH] =?UTF-8?q?Use=20correct=20BCP=2047=20language=20codes=20i?= =?UTF-8?q?n=20lang=3D"=E2=80=A6"=20attributes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- extension.json | 1 + modules/ext.templateDataGenerator.editTemplatePage/Dialog.js | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/extension.json b/extension.json index cf56dd4c..d11de040 100644 --- a/extension.json +++ b/extension.json @@ -91,6 +91,7 @@ ], "dependencies": [ "mediawiki.api", + "mediawiki.language", "mediawiki.user", "oojs-ui-core", "oojs-ui-widgets", diff --git a/modules/ext.templateDataGenerator.editTemplatePage/Dialog.js b/modules/ext.templateDataGenerator.editTemplatePage/Dialog.js index 50953652..3bb9263f 100644 --- a/modules/ext.templateDataGenerator.editTemplatePage/Dialog.js +++ b/modules/ext.templateDataGenerator.editTemplatePage/Dialog.js @@ -698,7 +698,7 @@ Dialog.prototype.onLanguageDropdownWidgetSelect = function ( item ) { // Update description value 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 this.repopulateParamSelectWidget(); @@ -1253,7 +1253,8 @@ Dialog.prototype.updateParamDetailsLanguage = function () { // * templatedata-modal-table-param-type var label = mw.msg( 'templatedata-modal-table-param-' + prop, this.language ); 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' } ); } };