Show languages from the Babel box on the user page
Bug: T135371 Change-Id: Ieeaf446326be93a779df3e6bd7a8dca899950a6c
This commit is contained in:
@@ -247,6 +247,8 @@
|
||||
// Previous languages are always the better suggestion
|
||||
// because the user has explicitly chosen them.
|
||||
filterByPreviousLanguages,
|
||||
// User's languages in the Babel box on the user page
|
||||
filterByBabelLanguages,
|
||||
// Site specific highlights, mostly used on Wikimedia sites
|
||||
filterBySitePicks,
|
||||
// Add all common languages to the beginning of array.
|
||||
@@ -305,6 +307,20 @@
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter by languages that appear in the Babel box on the user page.
|
||||
*
|
||||
* @param {string[]} languages Language codes
|
||||
* @return {string[]} List of language codes supported by the article
|
||||
*/
|
||||
function filterByBabelLanguages( languages ) {
|
||||
var babelLanguages = mw.config.get( 'wgULSBabelLanguages', [] );
|
||||
|
||||
return $.grep( babelLanguages, function ( language ) {
|
||||
return $.inArray( language, languages ) >= 0;
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the language list by site picks.
|
||||
*
|
||||
@@ -312,7 +328,7 @@
|
||||
* @return {string[]} List of language codes supported by the article
|
||||
*/
|
||||
function filterBySitePicks( languages ) {
|
||||
var picks = mw.config.get( 'wgULSCompactLinksPrepend' ) || [];
|
||||
var picks = mw.config.get( 'wgULSCompactLinksPrepend', [] );
|
||||
|
||||
return $.grep( picks, function ( language ) {
|
||||
return $.inArray( language, languages ) >= 0;
|
||||
|
||||
Reference in New Issue
Block a user