Avoid references to jquery.uls RL module from ext.uls.init
Checks to see if language is supported can be also done using jquery.uls.data Bug: T135210 Change-Id: Ib6b0d31b33be10b38aba713c3c4ba5370a27a8f4
This commit is contained in:
@@ -20,8 +20,6 @@
|
||||
( function ( $, mw ) {
|
||||
'use strict';
|
||||
|
||||
var hasOwn = Object.prototype.hasOwnProperty;
|
||||
|
||||
mw.uls = mw.uls || {};
|
||||
mw.uls.previousLanguagesStorageKey = 'uls-previous-languages';
|
||||
mw.uls.languageSettingsModules = [ 'ext.uls.inputsettings', 'ext.uls.displaysettings' ];
|
||||
@@ -152,23 +150,12 @@
|
||||
|
||||
// Filter out unknown and unsupported languages
|
||||
unique = $.grep( unique, function ( langCode ) {
|
||||
var target;
|
||||
|
||||
// If the language is already known and defined, just use it
|
||||
if ( hasOwn.call( $.fn.uls.defaults.languages, langCode ) ) {
|
||||
// If the language is already known and defined, just use it.
|
||||
// $.uls.data.getAutonym will resolve redirects if any.
|
||||
if ( $.uls.data.getAutonym( langCode ) !== langCode ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// If the language is not immediately known,
|
||||
// try to check is as a redirect
|
||||
target = $.uls.data.isRedirect( langCode );
|
||||
|
||||
if ( target ) {
|
||||
// Check that the redirect's target is known
|
||||
// to this instance of ULS
|
||||
return hasOwn.call( $.fn.uls.defaults.languages, target );
|
||||
}
|
||||
|
||||
return false;
|
||||
} );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user