Merge "ve.dm.MWLanguageVariantNode: Fix "undefined" appearing for some nodes"

This commit is contained in:
jenkins-bot 2021-06-08 07:15:48 +00:00 committed by Gerrit Code Review
commit 69e17ef432

View file

@ -216,7 +216,6 @@ ve.dm.MWLanguageVariantNode.static.insertPreviewElements = function ( element, v
* @return {string} HTML string
*/
ve.dm.MWLanguageVariantNode.static.getPreviewHtml = function ( variantInfo, opts ) {
var languageIndex, html;
if ( variantInfo.disabled ) {
return variantInfo.disabled.t;
} else if ( variantInfo.name ) {
@ -224,6 +223,7 @@ ve.dm.MWLanguageVariantNode.static.getPreviewHtml = function ( variantInfo, opts
} else if ( variantInfo.filter ) {
return variantInfo.filter.t;
} else if ( variantInfo.describe || ( opts && opts.describeAll ) ) {
var html = '';
if ( variantInfo.twoway && variantInfo.twoway.length ) {
variantInfo.twoway.forEach( function ( item ) {
html += ve.init.platform.getLanguageName( item.l.toLowerCase() ) + ':' +
@ -238,6 +238,7 @@ ve.dm.MWLanguageVariantNode.static.getPreviewHtml = function ( variantInfo, opts
}
return html;
} else {
var languageIndex;
if ( variantInfo.twoway && variantInfo.twoway.length ) {
languageIndex = this.matchLanguage( variantInfo.twoway );
return variantInfo.twoway[ languageIndex ].t;