Nemo bis has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/281126

Change subject: Resolve language code redirects before looking them up in ULS 
data
......................................................................

Resolve language code redirects before looking them up in ULS data

CompactInterlanguageList assumes that the language code is what the
MediaWiki HTML contains, especially in getInterlanguageList() and
showLanguage(). The code can be a macro code which falls back to a
specific code (like "sr") or a special language code.
https://meta.wikimedia.org/wiki/Special_language_codes

When filtering the available languages (from the interwiki links list),
keep the original codes and check the ULS data for the code as stored
in ULS data, by resolving the redirect.

Language codes which alias to other codes are never returned by
$.uls.data.getLanguages* functions. RegionSelector and others may
need to check their assumptions.

Bug: T100002
Change-Id: I8b89edb60b4d2c6f2b25c8589569f748c5523722
---
M resources/js/ext.uls.compactlinks.js
1 file changed, 6 insertions(+), 2 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UniversalLanguageSelector 
refs/changes/26/281126/1

diff --git a/resources/js/ext.uls.compactlinks.js 
b/resources/js/ext.uls.compactlinks.js
index 27c4491..d79e9e0 100644
--- a/resources/js/ext.uls.compactlinks.js
+++ b/resources/js/ext.uls.compactlinks.js
@@ -234,8 +234,12 @@
                filterByCommonLanguages: function ( languages ) {
                        var commonLanguages = mw.uls.getFrequentLanguageList();
 
-                       return $.grep( commonLanguages, function ( language ) {
-                               return $.inArray( language, languages ) >= 0;
+                       return $.grep( languages, function ( language ) {
+                               languageNormal = $.uls.data.isRedirect( 
language );
+                               if ( languageNormal ) {
+                                       language = languageNormal;
+                               }
+                               return $.inArray( language, commonLanguages ) 
>= 0;
                        } );
                },
 

-- 
To view, visit https://gerrit.wikimedia.org/r/281126
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8b89edb60b4d2c6f2b25c8589569f748c5523722
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UniversalLanguageSelector
Gerrit-Branch: master
Gerrit-Owner: Nemo bis <federicol...@tiscali.it>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to