Add some global fallbacks to compact language links

Bug: T135366
Change-Id: I75cc58f79cb818d8330120d996d67c6b183c0843
This commit is contained in:
Niklas Laxström
2016-05-20 14:51:47 +02:00
parent 1e3b85b1ca
commit 021ceadc85

View File

@@ -240,6 +240,9 @@
// These are the most probable languages predicted by ULS. // These are the most probable languages predicted by ULS.
this.getCommonLanguages( languages ), 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. // Finally add the whole languages array too.
// We will remove duplicates and cut down to required size. // We will remove duplicates and cut down to required size.
languages 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. * Filter the language list by Translate's assistant languages.
* Where available, they're languages deemed useful by the user. * Where available, they're languages deemed useful by the user.