Page MenuHomePhabricator

Use UniversalLanguageSelector for selecting the UI language in the Labs Pageviews tool
Open, Needs TriagePublic

Description

The Labs Pageviews tool has a UI language selector at the top. It is a dropdown with dozens of items, and it's hard to find a language the right language there.

Precisely for cases like this the Universal Language Selector was made. It can be used without MediaWiki, as a standalone jquery component. See https://github.com/wikimedia/jquery.uls . You apply is at a plugin function .uls() to the element to which you want to attach it, and you'll need to provide the list of languages (which you already have) and a function to do on selection (reload the page with a new language). The sorting by continent and script family is done automatically.

Event Timeline

Awesome! I will add this. Thank you :)

MusikAnimal moved this task from In Development to Done on the Tool-Pageviews board.

For now I'm going to decline this. I tried it out and got it to work, but the additional ~60KB of JavaScript doesn't seem worth it to me. Instead I'm going to sort the list in the existing language selector, and perhaps implement my own search. Thanks for letting me know about the tool, nonetheless! I will try to submit a few PRs for some ideas I have to improve it.

Oh please don't reinvent the wheel :)

I am aware of the footprint problem (T153845) and I was actually about to reduce the footprint drastically Really Soon.

With your kind permission I'm reopening this. Feel free to do it after I'm done with the above.

Oh please don't reinvent the wheel :)

I am aware of the footprint problem (T153845) and I was actually about to reduce the footprint drastically Really Soon.

With your kind permission I'm reopening this. Feel free to do it after I'm done with the above.

Ok :) I'd be happy to help some too! Especially with the CSS. For me it doesn't play that nicely on mobile, despite the mobile-specific stylesheet. Maybe I did something wrong, not sure, but the popup is misaligned and extends beyond the viewport. What would be really cool is to utilize Bootstrap CSS, given it's popularity. For sites that don't use Bootstrap (Wikimedia, in particular), you could offer a polyfill stylesheet. I realize that's a lot of work, and maybe doesn't align well with the idea of a standalone tool built with MediaWiki in mind – but it would mean that much less CSS for sites that already have Bootstrap's mobile-friendly grid system. At the very least, we might consider using CSS to center the popup rather than using JavaScript. Just a few ideas :)