Steps to replicate the issue
- Navigate to https://www.mediawiki.org/w/index.php?title=Special%3ATranslate&group=page-Extension%3AEmailAuth&action=page&filter=&language=nl.
- Click on the message "$1 in $2, for Wikimedia's version of the $3 hook.".
What happens?
The documentation for the message takes a noticeable amount of time to load.
Behind the scenes, it looks like my browser is querying https://www.mediawiki.org/w/api.php?action=translationaids&format=json&title=Translations:Extension:EmailAuth/16/nl&uselang=en. Visiting that URL directly, it seems like it's consistently taking ~4-5 seconds for the server to issue a response.
For some other translation units, the performance can be even worse - e.g., https://www.mediawiki.org/w/api.php?action=translationaids&format=json&title=Translations%3AExtension%3AEmailAuth%2F3%2Fnl&uselang=en consistently takes ~10 seconds to respond for me; and (judging from the API response) it seems like that's because Elasticsearch times out after that amount of time (stack trace taken from the ["helpers"]["ttmserver"]["error"] JSON key of the API response):
Elastica exception: Elastica\\Exception\\Connection\\HttpException: Operation timed out in /srv/mediawiki/php-1.45.0-wmf.9/vendor/ruflin/elastica/src/Transport/Http.php:186
Stack trace:
#0 /srv/mediawiki/php-1.45.0-wmf.9/vendor/ruflin/elastica/src/Request.php(183): Elastica\\Transport\\Http->exec(Object(Elastica\\Request), Array)
#1 /srv/mediawiki/php-1.45.0-wmf.9/vendor/ruflin/elastica/src/Client.php(545): Elastica\\Request->send()
#2 /srv/mediawiki/php-1.45.0-wmf.9/vendor/ruflin/elastica/src/Search.php(352): Elastica\\Client->request('ttmserver/_sear...', 'POST', Array, Array)
#3 /srv/mediawiki/php-1.45.0-wmf.9/vendor/ruflin/elastica/src/Index.php(546): Elastica\\Search->search(Object(Elastica\\Query), NULL, 'POST')
#4 /srv/mediawiki/php-1.45.0-wmf.9/extensions/Translate/src/TtmServer/ElasticSearchTtmServer.php(145): Elastica\\Index->search(Object(Elastica\\Query))
#5 /srv/mediawiki/php-1.45.0-wmf.9/extensions/Translate/src/TtmServer/ElasticSearchTtmServer.php(72): MediaWiki\\Extension\\Translate\\TtmServer\\ElasticSearchTtmServer->doQuery('en', 'nl', 'While this is l...')
#6 /srv/mediawiki/php-1.45.0-wmf.9/extensions/Translate/src/TranslatorInterface/Aid/TTMServerAid.php(69): MediaWiki\\Extension\\Translate\\TtmServer\\ElasticSearchTtmServer->query('en', 'nl', 'While this is l...')
#7 /srv/mediawiki/php-1.45.0-wmf.9/extensions/Translate/src/TranslatorInterface/Aid/TranslationAidsActionApi.php(112): MediaWiki\\Extension\\Translate\\TranslatorInterface\\Aid\\TTMServerAid->getData()
#8 /srv/mediawiki/php-1.45.0-wmf.9/includes/api/ApiMain.php(2016): MediaWiki\\Extension\\Translate\\TranslatorInterface\\Aid\\TranslationAidsActionApi->execute()
#9 /srv/mediawiki/php-1.45.0-wmf.9/includes/api/ApiMain.php(954): MediaWiki\\Api\\ApiMain->executeAction()
#10 /srv/mediawiki/php-1.45.0-wmf.9/includes/api/ApiMain.php(925): MediaWiki\\Api\\ApiMain->executeActionWithErrorHandling()
#11 /srv/mediawiki/php-1.45.0-wmf.9/includes/api/ApiEntryPoint.php(152): MediaWiki\\Api\\ApiMain->execute()
#12 /srv/mediawiki/php-1.45.0-wmf.9/includes/MediaWikiEntryPoint.php(198): MediaWiki\\Api\\ApiEntryPoint->execute()
#13 /srv/mediawiki/php-1.45.0-wmf.9/api.php(44): MediaWiki\\MediaWikiEntryPoint->run()
#14 /srv/mediawiki/w/api.php(3): require('/srv/mediawiki/...')
#15 {main}What should have happened instead?
Translation units' documentation shouldn't take that long to load when using Special:Translate to translate a page.
Software version
1.45.0-wmf.9
Other information/Notes
- One risk of the slow load times is that translators might not wish to wait for the documentation to load before translating a given message, which seems like it could unintentionally defeat the purpose of creating documentation for translation units in the first place.
- I'm tagging Elasticsearch here as well, as it seems like the slow response times might be due in large part to the "ttmserver" response times (which, judging by https://www.mediawiki.org/wiki/Help:Extension:Translate/Translation_memories, is powered by Elasticsearch).
- As an idea, if improving the ttmserver performance is tricky to do, maybe the message-documentation-fetching (and/or everything apart from querying ttmserver) could be split into its own API request, so that it's not affected (or hopefully affected less) by the slow speeds of querying ttmserver?