Return language code if language name not found

A language code is better than an empty string.

The string would be used in the LanguageContext to
describe an annotation like <span lang="en-fakeVariant">.

Change-Id: Ibc18c238d6216927447ca26f336e9d973c6b93eb
This commit is contained in:
Ed Sanders 2020-10-02 14:54:19 +01:00
parent bc0347259b
commit 4915cbaed4

View file

@ -214,7 +214,7 @@ ve.init.mw.Platform.prototype.getLanguageCodes = function () {
ve.init.mw.Platform.prototype.getLanguageName = function ( code ) {
var languageNames = mw.language.getData( mw.config.get( 'wgUserLanguage' ), 'languageNames' ) ||
$.uls.data.getAutonyms();
return languageNames[ code ] || '';
return languageNames[ code ] || code;
};
/**