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

Closed
wants to merge 3 commits into 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?

srish added 2 commits November 5, 2024 19:58
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 Nov 22, 2024

@Abijeet, thanks for your review of this PR! @amire80 and I discussed your comments, and I’ve made further improvements to the patch. It required an additional change in the extension, which I’ve uploaded here: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/UniversalLanguageSelector/+/1087961. This PR is no longer relevant.

@srish srish closed this Nov 22, 2024
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