Once the pageviews tool has support for more than just English, we should add an interface in the Settings dialog to let people override the language with the language of their choice. The interface should only list the languages that have translations.
|Resolved||• Lea_WMDE||T143664 Improve page view statistics (#15)|
|Resolved||None||T120497 Pageview Stats tool|
|Resolved||MusikAnimal||T128770 Add language selector to Settings interface in pageviews tool|
|Resolved||kaldari||T128768 Register pageviews tool with translatewiki.net|
|Resolved||kaldari||T128103 Add i18n support to pageviews tool with Intuition|
My thoughts are we should have a dropdown at the bottom-right, just above the footer. The only reason for this is some users might not even figure out where the settings are due to the language barrier. A two-letter "en" in a clearly marked dropdown might give a big hint where to switch the language. The settings dialogue might be doomed as it is. With T126782 I don't think we need the search options anymore, issue #25 resulted in a compromise for colours, and most people are going to be OK with their i18n date/number formats.
@MusikAnimal: I think just having a drop-down is fine. To retrieve all the supported languages, you can use Intuition::getAvailableLangs(). There are also some functions in there that demonstrate setting the cookie, but I assume you'll want to implement that on the client-side instead.
Alright, got a working language selector. Check it out at http://tools.wmflabs.org/pageviews-test
Since we don't have any translatewiki messages synced to our repo yet, I just made a test one for German. All it does is change the title. Try it out, then browse to tools.wmflabs.org/intuition to see that the preference carried over, and vice versa. I can also confirm that by default it correctly shows whatever language your browser is set to. If we don't have support for that language it shows English.
Let me know what you think!
I've noticed a few problems... first it does not default to English for specific messages that are not translated. For instance see the Persian variation in it's current state: http://tools.wmflabs.org/pageviews-test/#start=2016-02-23&end=2016-03-13&project=en.wikipedia.org&platform=all-access&agent=user&pages=Cat|Dog
Not sure how to fix this... seems like maybe we'd need to dig into the Intuition source. @kaldari any ideas?
Additionally, some languages (such as Persian) need to be printed right-to-left. There's a CSS property that makes this easy to do, but we'll need to clean up the styling some to make it still look decent. I can take on this task. There's also some vertically written languages, I think, but I doubt we'll be able to support those :-/
It looks like the problem is that Western Balochi (what MusikAnimal referred to as Persian), is a language supported by Translatewiki, but not Wikipedia or Intuition. The two options here are:
- Limit the language selector to languages supported by Wikipedia and Intuition.
- Add support for Western Balochi to Intuition.
- Add code to Intuition to have it always fall back to English if the language isn't otherwise supported.
Actually, scratch that. It looks like the problem is that the language fallback chain for Western Balochi is just Persian (Farsi), but we don't have any Persian translations, and English is not in the fallback chain for some reason.