Add some global fallbacks to compact language links
Bug: T135366 Change-Id: I75cc58f79cb818d8330120d996d67c6b183c0843
This commit is contained in:
@@ -240,6 +240,9 @@
|
||||
// These are the most probable languages predicted by ULS.
|
||||
this.getCommonLanguages( languages ),
|
||||
|
||||
// Some global fallbacks to avoid showing languages in the beginning of the alphabet
|
||||
this.getExtraCommonLanguages( languages ),
|
||||
|
||||
// Finally add the whole languages array too.
|
||||
// We will remove duplicates and cut down to required size.
|
||||
languages
|
||||
@@ -282,6 +285,22 @@
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
* Filter the language list by globally common languages, i.e.
|
||||
* this list is not user specific.
|
||||
*
|
||||
* @return {Array} List of language codes supported by the article
|
||||
*/
|
||||
getExtraCommonLanguages: function ( languages ) {
|
||||
var commonLanguages = [ 'zh', 'en', 'hi', 'ur', 'es', 'ar', 'ru', 'id', 'ms', 'pt',
|
||||
'fr', 'de', 'bn', 'ja', 'pnb', 'pa', 'jv', 'te', 'ta', 'ko', 'mr', 'tr', 'vi',
|
||||
'it', 'fa', 'sv', 'nl', 'pl' ];
|
||||
|
||||
return $.grep( commonLanguages, function ( language ) {
|
||||
return $.inArray( language, languages ) >= 0;
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
* Filter the language list by Translate's assistant languages.
|
||||
* Where available, they're languages deemed useful by the user.
|
||||
|
||||
Reference in New Issue
Block a user