Revert "Return target of redirect languages in mw.uls.getFrequentLanguageList"
This reverts commit 76551ed4a7.
Reason for revert: It seems it's breaking Serbian editing Wikidata
Bug: T217770
Bug: T121747
Change-Id: If69156400ff665a8c488a24f70d6a100e26761da
This commit is contained in:
@@ -180,7 +180,7 @@
|
|||||||
* @return {Array} List of language codes without duplicates.
|
* @return {Array} List of language codes without duplicates.
|
||||||
*/
|
*/
|
||||||
mw.uls.getFrequentLanguageList = function ( countryCode ) {
|
mw.uls.getFrequentLanguageList = function ( countryCode ) {
|
||||||
var i, j, lang, target,
|
var i, j, lang,
|
||||||
ret = [],
|
ret = [],
|
||||||
lists = [
|
lists = [
|
||||||
[
|
[
|
||||||
@@ -200,11 +200,6 @@
|
|||||||
for ( i = 0; i < lists.length; i++ ) {
|
for ( i = 0; i < lists.length; i++ ) {
|
||||||
for ( j = 0; j < lists[ i ].length; j++ ) {
|
for ( j = 0; j < lists[ i ].length; j++ ) {
|
||||||
lang = lists[ i ][ j ];
|
lang = lists[ i ][ j ];
|
||||||
target = $.uls.data.isRedirect( lang );
|
|
||||||
if ( target ) {
|
|
||||||
lang = target;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make flat, make unique, and ignore unknown/unsupported languages
|
// Make flat, make unique, and ignore unknown/unsupported languages
|
||||||
if ( ret.indexOf( lang ) === -1 && $.uls.data.getAutonym( lang ) !== lang ) {
|
if ( ret.indexOf( lang ) === -1 && $.uls.data.getAutonym( lang ) !== lang ) {
|
||||||
ret.push( lang );
|
ret.push( lang );
|
||||||
|
|||||||
@@ -90,34 +90,4 @@
|
|||||||
'Tagalog is one of the languages presented to users in the Philippines.'
|
'Tagalog is one of the languages presented to users in the Philippines.'
|
||||||
);
|
);
|
||||||
} );
|
} );
|
||||||
|
|
||||||
QUnit.test( 'Add redirect target', function ( assert ) {
|
|
||||||
var i, foundTagalog, languages, foundFil;
|
|
||||||
|
|
||||||
foundTagalog = false;
|
|
||||||
foundFil = false;
|
|
||||||
mw.uls.getBrowserLanguage = function () {
|
|
||||||
return 'fil';
|
|
||||||
};
|
|
||||||
|
|
||||||
languages = mw.uls.getFrequentLanguageList();
|
|
||||||
|
|
||||||
for ( i = 0; i < languages.length; i++ ) {
|
|
||||||
if ( languages[ i ] === 'tl' ) {
|
|
||||||
foundTagalog = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( languages[ i ] === 'fil' ) {
|
|
||||||
foundFil = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
assert.ok(
|
|
||||||
foundTagalog,
|
|
||||||
'Tagalog is one of the languages presented to users when "fil" language is requested'
|
|
||||||
);
|
|
||||||
assert.notOk(
|
|
||||||
foundFil,
|
|
||||||
'"fil" language is redirected to Tagalog'
|
|
||||||
);
|
|
||||||
} );
|
|
||||||
}() );
|
}() );
|
||||||
|
|||||||
Reference in New Issue
Block a user