-
Notifications
You must be signed in to change notification settings - Fork 67
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
base: master
Are you sure you want to change the base?
Conversation
Around 30 languages with redirects and variants appear twice in the ULS panel. This fix checks if a redirect exists for a language code, and if it does it updates the target in the languages object and removes the redirect. Bug: T195342
@santhoshtr @Abijeet Could we get one of you to help review this patch? |
src/jquery.uls.core.js
Outdated
@@ -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 ); |
There was a problem hiding this comment.
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](
jquery.uls/src/jquery.uls.data.utils.js
Lines 93 to 105 in 8b10421
$.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?
src/jquery.uls.core.js
Outdated
|
||
if ( target ) { | ||
// Update target in the languages object and delete redirect | ||
this.languages[ target ] = this.languages[ code ]; |
There was a problem hiding this comment.
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?
Around 30 languages with redirects and variants appear twice in the ULS panel. This fix checks if a redirect exists for a language code, and if it does it updates the target in the languages object and removes the redirect. Bug: T195342
Around 30 languages with redirects and variants appear twice in the ULS panel. This fix checks if a redirect exists for a language code, and if it does, it updates the target in the languages object and removes the redirect.
Bug: T195342