Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide language redirects in the ULS panel #490

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/jquery.uls.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@
// Language is unknown to ULS.
delete this.languages[ code ];
}

// Check if the language code is a redirect
var target = $.uls.data.isRedirect( code );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.options.languages is initialized to $.uls.data.getAutonyms() by default which does not have redirects listed](

$.uls.data.getAutonyms = function () {
var language,
autonymsByCode = {};
for ( language in $.uls.data.languages ) {
if ( $.uls.data.isRedirect( language ) ) {
continue;
}
autonymsByCode[ language ] = $.uls.data.getAutonym( language );
}
return autonymsByCode;
).

I assume somewhere some custom language options are being passed that necessitates this check. Do we know where this is being done?


if ( target ) {
// Update target in the languages object and delete redirect
this.languages[ target ] = this.languages[ code ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens when the languages list has the original language (ady) and a related redirect (ady-cyrl)? Should we avoid this assignment in such cases?

delete this.languages[ code ];
}
}

this.left = this.options.left;
Expand Down
Loading