From 3ab0128bfd1cf79215d73fafb8e33b6434ad30ff Mon Sep 17 00:00:00 2001 From: "Amir E. Aharoni" Date: Sat, 4 May 2024 15:37:53 +0300 Subject: [PATCH] Parse a message correctly Follow-up to I2495fe32c2d540be50450d715b049173f2f8727d Done with the help of Matma Rex at Wikimedia Hackathon 2024. Bug: T361103 Change-Id: Ica328233cb6172277e66d2341cfb53f87f8aff67 --- .../ve.ui.MWLanguageVariantNodeContextItem.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/modules/ve-mw/ui/contextitems/ve.ui.MWLanguageVariantNodeContextItem.js b/modules/ve-mw/ui/contextitems/ve.ui.MWLanguageVariantNodeContextItem.js index c225eaedec..4f14cdf0ca 100644 --- a/modules/ve-mw/ui/contextitems/ve.ui.MWLanguageVariantNodeContextItem.js +++ b/modules/ve-mw/ui/contextitems/ve.ui.MWLanguageVariantNodeContextItem.js @@ -84,8 +84,10 @@ ve.ui.MWLanguageVariantNodeContextItem.prototype.renderBody = function () { function languageNameIfKnown( code ) { return ve.init.platform.hasLanguageCode( code ) ? - ve.init.platform.getLanguageName( code ) : - ve.msg( 'visualeditor-mwlanguagevariantcontextitem-rule-invalid-language-label' ); + mw.html.escape( ve.init.platform.getLanguageName( code ) ) : + mw.message( + 'visualeditor-mwlanguagevariantcontextitem-rule-invalid-language-label' + ).parse(); } switch ( type ) { @@ -106,7 +108,8 @@ ve.ui.MWLanguageVariantNodeContextItem.prototype.renderBody = function () { $table .append( $( '' ) - .append( $( '' ).text( name ).attr( 'lang', code ) ) + // eslint-disable-next-line no-jquery/no-html + .append( $( '' ).html( name ).attr( 'lang', code ) ) .append( $( '' ).text( code ) ) ); } ); @@ -137,7 +140,8 @@ ve.ui.MWLanguageVariantNodeContextItem.prototype.renderBody = function () { name = languageNameIfKnown( code.toLowerCase() ); $table .append( $( '' ) - .append( $( '' ).text( name ).attr( 'lang', code ) ) + // eslint-disable-next-line no-jquery/no-html + .append( $( '' ).html( name ).attr( 'lang', code ) ) .append( $( '' ).text( code ) ) .append( $fromText ) .append( $toText ) @@ -167,7 +171,8 @@ ve.ui.MWLanguageVariantNodeContextItem.prototype.renderBody = function () { ); $table .append( $( '' ) - .append( $( '' ).text( name ).attr( 'lang', code ) ) + // eslint-disable-next-line no-jquery/no-html + .append( $( '' ).html( name ).attr( 'lang', code ) ) .append( $( '' ).text( code ) ) .append( $text ) );