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