Page MenuHomePhabricator

[Bug] Languages shown in language picker on the main page not showing "title" because editors create intrawiki links with blank name
Closed, DeclinedPublic

Description

Steps to Reproduce

Visit https://en.m.wikipedia.org/wiki/Main_Page#/languages
Compare with https://en.m.wikipedia.org/wiki/San_Francisco#/languages

Expected Results

  • Each language entry appears in the middle of its row

Actual Results

  • Each language entry appears closer to the top than the bottom of its row
    Screenshot from 2018-04-12 11-41-37.png (959×1 px, 51 KB)

Explanation

On English Wikipedia the main page lists language links like so

[[en:]]
[[fr:]]

The empty string resolves (by accident?) to the main page and hence the title of these pages is not known by the API. The main page should be updated to specifically select those pages.

Environments Observed

  • enwiki

Browser Version

  • Chromium v65.0.3325.181

OS Version

  • Ubuntu v17.10 64b

Device Model

  • Desktop

Device Language

  • English

Acceptance criteria

  • When I visit the language overlay of the Main page I see the page title under the language name e.g. Hauptseite

Developer notes

The API returns an empty string for the main page title:
https://en.m.wikipedia.org/w/api.php?action=query&format=json&meta=siteinfo&siprop=general&prop=langlinks&lllimit=max&titles=Main_Page&formatversion=2&llprop=url%7Cautonym%7Clangname&llinlanguagecode=en

See T64020: API langlinks does not return title of Main Pages for background.

Event Timeline

@Legoktm hmm that explains where it's coming from then. Thanks! I 'm not sure we should be encouraging links to "https://en.wikipedia.org/wiki/" (which adds an unnecessary redirect) and an empty string for a title isn't very helpful. With an empty string, an API client that wants to use this information to render needs to not only know about this edge case, but then to handle it, look up the title for the main page before it can request it. I is demonstrated by this PWA API client: https://trending.wmflabs.org/wiki/Main%20Page#/languages (click any link)

From a MediaWiki-Action-API perspective this is a duplicate of T64020. But since I suspect you'll want to use this task to track whatever fix you might make for MobileFrontend, I'm not going to actually close it as a duplicate.

ovasileva triaged this task as Medium priority.Apr 16 2018, 6:20 PM

This should be fixed on wiki.
The fact that [[:en]] resolves to the English Main page is very brittle and we shouldn't work around such things in our code.

Jdlrobson renamed this task from [Bug] Languages shown in language picker on the main page not showing "title" to [Bug] Languages shown in language picker on the main page not showing "title" because editors create intrawiki links with blank name.Apr 24 2018, 3:28 PM
Jdlrobson updated the task description. (Show Details)

The fact that [[:en]] resolves to the English Main page is very brittle

{{citation needed}}

When no title is supplied, either by hitting index.php directly without specifying a 'title' parameter or by supplying the empty string (directly or via $wgArticlePath), the wiki redirects the request to its main page. That doesn't seem fragile and fixing it should it ever break would be an UBN-priority task.

[[en:]] as an interwiki link is equivalent to "supplying the empty string (directly or via $wgArticlePath)", so that's not likely to break either.

@Anome it's fragile in the sense that any client that is not MediaWiki needs to know and workaround this. MediaWiki is not the only thing that displays our content.

So it's only "fragile" in the sense that "it's extra work if you want to know the title of the target page ahead of time" rather than any common meaning of the word?

If something needs to be fixed here it likely needs to be done inside the API response for https://en.m.wikipedia.org/w/api.php?action=query&format=json&meta=siteinfo&siprop=general&prop=langlinks&lllimit=max&titles=Main_Page&formatversion=2&llprop=url%7Cautonym%7Clangname&llinlanguagecode=en

e.g. instead of empty string, it should the localized main page title.

Is this something the language team is interested in? If not, I think this task should be declined.

Nikerabbit subscribed.

When we work on the new language selector, we can consider what information should be shown.

It doesn't make sense for us to work on this right now.