Page MenuHomePhabricator

Wikitext syntax is translated when requesting translations via MinT
Closed, ResolvedPublic

Description

MinT is translating PLURAL|GRAMMAR|GENDER syntax which is not desirable:

curl -X 'POST' \
  'https://cxserver.wikimedia.org/v1/mt/en/hi/MinT' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "html": "{{PLURAL|one=%{count} report|%{count} reports}}"
}'

{"contents":"{ ′PLURAL|one=% ′count′ report|% ′Count′ report"}

Additionally the HTML translate (https://html.spec.whatwg.org/multipage/dom.html#the-translate-attribute) attribute also does not seem to be respected.

curl -X 'POST' \
  'https://cxserver.wikimedia.org/v1/mt/en/hi/MinT' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "html": "<span translate=\"no\">{{PLURAL</span>|one=%{count} report|%{count} reports}}"
}'

{"contents":"{ ′PLURAL|one=% ′count′ report|% ′Count′ report"}

Event Timeline

Change 935149 had a related patch set uploaded (by Abijeet Patro; author: Abijeet Patro):

[mediawiki/extensions/Translate@master] MinT: Pre/post process input/output sent to API

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

To reduce the impact of this issue, we've added some code to check that the translation should contain the same instances of wikitext as the source string that is being translated. If the translated content has fewer wikitext instances then the source string, we are not displaying that translation from MinT to the translator.

Change 935149 merged by jenkins-bot:

[mediawiki/extensions/Translate@master] MinT: Pre/post process input/output sent to API

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

Pginer-WMF claimed this task.
Pginer-WMF subscribed.

The specific issue is resolved. I created a more general ticket for proper support for arbitrary wikitext markup with MinT: T347018: MinT support for Wikitext