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

Conversation

srish
Copy link
Member

@srish srish commented Sep 5, 2024

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
@srish
Copy link
Member Author

srish commented Sep 19, 2024

@santhoshtr @Abijeet Could we get one of you to help review this patch?

@@ -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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants