Page MenuHomePhabricator

Implement accessibility language attribute for "$1" in "Redirected from: $1" (search screen)
Closed, DeclinedPublic

Description

In Search screen, "Redirected from: $1" is sometimes displayed and sometimes "$1" is in searchSite's language, sometimes in other language, and there does not seem a way to get at MWKSearchRedirectMapping.redirectFromTitle's language. We need to find $1's language in order to be able to set accessibilityLanguage of that part of the label so that VoiceOver reads it properly.

E.g. after setting Czech language in search, searching for "Köln" (German for Cologne ) finds Kolín nad Rýnem (Czech for "Cologne upon Rhine"), and adds "Redirected from: Köln am Rhein" (German for "Cologne upon Rhine") which is obviously a German article (though I found only article for Köln). So here, "$1" (i.e. "Köln am Rhein") is in German, which is neither the UI language (English) nor the search language (Czech).

This part of string (i.e. "$1" in "Redirected from: $1") would then have UIAccessibilitySpeechAttributeLanguage set to the proper language code if it differs from the UI language.

Event Timeline

dusek raised the priority of this task from to High.
dusek updated the task description. (Show Details)
dusek added subscribers: BGerstle-WMF, hhanke, JMinor and 7 others.

Just realized this does not work as I imagined. E.g. on Czech wikipedia London Underground redirects to Metro v Londýně. The London Underground page on Czech Wikipedia is not in any way connected with the London Underground article on English Wikipedia.

So the only way to know in this case that "London Underground" is in English would be if the London Underground Czech redirection page would have some markup saying the text "London Underground" is in English. However when editing the page, I can only edit the contents (i.e. that it is redirection to "Metro v Londýně"), not the title ("London Underground").

So the conclusion is that information about language of "$1" is not stored in the model, hence what I wanted to achieve is not currently possible.

@dusek I think the simplest thing to do for now is to always set the accessibilityLanguage to the language code of the site the data was retrieved from. However, this is something we should do alongside other changes to site/language-specific view configurations, so I'm moving this to "Blocked/Waiting" for now. Off the top of my head, if we were to do this should apply to:

  • Search results, which also includes:
    • Nearby
    • Article recommendations (i.e. "Because you read..." in Explore)
    • Random
    • Similar pages
    • Disambiguation
  • Saved pages
  • Recent pages
  • Article content itself

Also worth noting, is that this would be (yet another) case of when we rely on site domain to contain an ISO language code—which is not always the case! For example, there are wikis like simple.wikipedia.org, not to mention people setting up their own Mediawiki installs (mydomain.wikipedia.org, or even mywiki.com). That said, I think the best we can do at the moment is attempt to do the mapping using the NSLocale API and fall back to the device language, unless we're able to get the wiki's actual ISO language (if there is one) via some kind of meta or siteinfo API query.

JMinor lowered the priority of this task from High to Medium.Feb 1 2016, 8:32 PM
JMinor removed a project: Wikipedia-iOS-App-Backlog.