Language support in Special:ApiHelp and its transclusion.
Open, NormalPublic

Description

Using {{TNT|Api help|some-module}} we can T89318: Replace on-wiki API documentation with Special:ApiHelp transclusion \o/. But I can't localize this. As I understand it the Spanish version of the template would transclude the Spanish version of the API help.

  • but Special:ApiHelp/query+extracts?uselang=es does not pass on the uselang parameter to the redirect
  • and if you pass the query string to transclusion , e.g. {{Special:ApiHelp/query+extracts?uselang=es}}, Special:ApiHelp tries to load the non-existent module named "query+extracts?uselang=es" instead of passing it on.

Looking at includes/specials/SpecialApiHelp.php, I think it could detect query strings in the "subpage" $par part of the title and pass them on. Or it could have a heuristic like its support for rsub/ and sub/ to detect /language-code in the "subpage". Or maybe when including it can infer the language of the page it's on.

This could also let us localize links to api help in API messages, e.g. the generated French undelete documentation

apihelp-undelete-description": "Restaurer les révisions ... [[Special:ApiHelp/query+deletedrevs|list=deletedrevs]] ...

currently links to the English help for deletedrevs.

I have tests at https://www.mediawiki.org/wiki/User:SPage_%28WMF%29/Api_help_test#Localization_issues

Spage updated the task description. (Show Details)
Spage raised the priority of this task from to Normal.
Spage added subscribers: Aklapper, Spage, Anomie.
gerritbot added a subscriber: gerritbot.

Change 191250 had a related patch set uploaded (by Spage):
Make Special:ApiHelp query string parameters work

https://gerrit.wikimedia.org/r/191250

Patch-For-Review

Spage moved this task from Backlog to Tech on the Web-APIs-Hub board.Feb 18 2015, 4:42 AM
Anomie moved this task from Unsorted to In Dev on the MediaWiki-API board.Feb 19 2015, 5:54 PM
Anomie assigned this task to Spage.
Anomie set Security to None.
Spage added a project: I18n.EditedMar 4 2015, 3:41 AM

Maybe I'm overthinking this :) If a French user

  1. creates an account on mediawiki.org
  2. sets Preferences > Language to fr - français
  3. visits a page that transcludes Special:ApiHelp , such as https://www.mediawiki.org/wiki/Extension:TextExtracts

then the page shows the transcluded API help in French, regardless of the language of the parent page. Try it, follow these steps and instead visit https://www.mediawiki.org/wiki/Extension:TextExtracts/es , the Spanish page also transcludes the French API help. Known French users get API help in French \o/.

So the only use case addressed by the non-trivial work to change SpecialApiHelp.php this bug and customize templates is this:

  1. an anonymous user visits mw.org
  2. browses to https://www.mediawiki.org/wiki/Extension:TextExtracts ,
  3. notices the French translation and clicks https://www.mediawiki.org/wiki/Extension:TextExtracts/fr

but the English API help gets transcluded because we can't tell Special:ApiHelp to do otherwise.

I asked the mw.org i18n community here how common the second scenario is.

CCing @Nemo_bis as he might have a well founded opinion on this.

I asked the mw.org i18n community here how common the second scenario is.

Well, do you expect people not involved in the MediaWiki project to create an account just to see the help pages in their chosen languages? Or reply to your question about how common is this scenario? Even on the Project:Support desk there are a good number of people that prefer to post without creating an account, without the benefit of having notifications of replied posts or having problems with captchas

Ugh, thought I had saved my reply yesterday.

I asked the mw.org i18n community here how common the second scenario is.

Logged out visits to manual pages are certainly the majority, like everywhere else. Only a little minority of "devs" and API users is regularly active and logged in on mediawiki.org. T58464 is indeed a very important bug; if that doesn't get solved in few months, I suggest that you/we adopt Commons' and Wikidata's solution for unregistered users.

Either way, setting language by subpage/transclusion parameters is a valid request.

Spage added a comment.EditedMar 20 2015, 12:37 AM

(thanks for your work on mw.org!)

Well, do you expect people not involved in the MediaWiki project to create an account just to see the help pages in their chosen languages?

This is for Special:ApiHelp, it's fairly specialized and is not yet in wide use, and the parameter names will still be in English. But I agree it would be nice to provide a consistent experience if a user visits a translated mw.org page with API help in it. I also filed T93314: language selector for api.php help to let the user choose when viewing api.php help output.

T58464 is indeed a very important bug; if that doesn't get solved in few months, I suggest that you/we adopt Commons' and Wikidata's solution for unregistered users.

I wasn't aware of AnonymousI18N.js. Is there a phab task to adopt it on mw.org? I

I wasn't aware of AnonymousI18N.js. Is there a phab task to adopt it on mw.org?

No, a discussion in Project:Current_issues is the way to go.

Aklapper removed Spage as the assignee of this task.Sep 23 2016, 2:11 PM