Translating the following content gives <div></div>
< div > < span typeof = "mw:Transclusion" data-mw = "{"parts":[{"template":{"target":{"wt":"Infobox writer\n","href":"./Template:Infobox_writer"},"params":{"name":{"wt":"Meg Johnson"},"image":{"wt":"File:Meg Johnson profile shot.png"},"image_size":{"wt":""},"alt":{"wt":""},"caption":{"wt":""},"birth_name":{"wt":""},"birth_date":{"wt":"<!-- {{birth date and age|YYYY|MM|DD}} -->"},"birth_place":{"wt":"[[Ames, Iowa|Ames]], [[Iowa]]"},"death_date":{"wt":"<!-- {{death date and age|YYYY|MM|DD|YYYY|MM|DD}} -->"},"death_place":{"wt":""},"resting_place":{"wt":""},"occupation":{"wt":"{{flat list |\n* [[Poet]]\n* [[Lecturer]]\n}}"},"language":{"wt":""},"nationality":{"wt":""},"ethnicity":{"wt":""},"citizenship":{"wt":""},"education":{"wt":"[[Master of Fine Arts|MFA]] in [[Creative Writing]]"},"alma_mater":{"wt":"[[University of Akron]]"},"period":{"wt":""},"genre":{"wt":"[[Poetry]]"},"subject":{"wt":""},"movement":{"wt":""},"notableworks":{"wt":""},"spouse":{"wt":""},"partner":{"wt":""},"children":{"wt":""},"relatives":{"wt":""},"awards":{"wt":""},"signature":{"wt":""},"signature_alt":{"wt":""},"years_active":{"wt":""},"website":{"wt":"{{URL|megjohnson.org}}"}},"i":0}}]}" data-ve-no-generated-contents = "true" id = "mwBg" > </ span > </ div >
Note that the span has no about attribute.
Translate API should just adapat the content as enough information (the typeof attribute) is there to identify it as a transclusion
Change 752048 had a related patch set uploaded (by Santhosh; author: Santhosh):
[mediawiki/services/cxserver@master] isTransclusion: Check for typeof attribute value alone
https://gerrit.wikimedia.org/r/752048
Change 752048 merged by KartikMistry:
Change 751547 had a related patch set uploaded (by KartikMistry; author: KartikMistry):
[operations/deployment-charts@master] Deploy Flores MT
https://gerrit.wikimedia.org/r/751547
Change 751547 merged by jenkins-bot:
Mentioned in SAL (#wikimedia-operations) [2022-02-01T15:13:34Z] <kart_> Deployed Flores MT for cxserver + Updated cxserver to 2022-01-13-174407-production ( T298584 , T292412 , T292415 , T298679 , T298752 ) + Updated cxserver to 2022-02-01-141918-production ( T298592 )
How to test: Use the cxserver api and post the test content. Here is how to do that using curl
curl -X POST https://cxserver.wikimedia.org/v2/translate/en/es -H "Content-Type: application/json" --data-binary @- <<DATA { "html" : "<div><span typeof='mw:Transclusion' data-mw='{"parts":[{"template":{"target":{"wt":"Infobox writer\n","href":"./Template:Infobox_writer"},"params":{"name":{"wt":"Meg Johnson"},"image":{"wt":"File:Meg Johnson profile shot.png"},"image_size":{"wt":""},"alt":{"wt":""},"caption":{"wt":""},"birth_name":{"wt":""},"birth_date":{"wt":"<!-- {{birth date and age|YYYY|MM|DD}} -->"},"birth_place":{"wt":"[[Ames, Iowa|Ames]], [[Iowa]]"},"death_date":{"wt":"<!-- {{death date and age|YYYY|MM|DD|YYYY|MM|DD}} -->"},"death_place":{"wt":""},"resting_place":{"wt":""},"occupation":{"wt":"{{flat list |\n* [[Poet]]\n* [[Lecturer]]\n}}"},"language":{"wt":""},"nationality":{"wt":""},"ethnicity":{"wt":""},"citizenship":{"wt":""},"education":{"wt":"[[Master of Fine Arts|MFA]] in [[Creative Writing]]"},"alma_mater":{"wt":"[[University of Akron]]"},"period":{"wt":""},"genre":{"wt":"[[Poetry]]"},"subject":{"wt":""},"movement":{"wt":""},"notableworks":{"wt":""},"spouse":{"wt":""},"partner":{"wt":""},"children":{"wt":""},"relatives":{"wt":""},"awards":{"wt":""},"signature":{"wt":""},"signature_alt":{"wt":""},"years_active":{"wt":""},"website":{"wt":"{{URL|megjohnson.org}}"}},"i":0}}]}' data-ve-no-generated-contents='true' id='mwBg'> </span></div>"} DATA
should give
{"contents":"<div><span data-cx=\"[{"adapted":false}]\" data-mw=\"{"parts":[{"template":{"target":{"wt":"Infobox writer\n","href":"./Template:Infobox_writer"},"params":{"name":{"wt":"Meg Johnson"},"image":{"wt":"File:Meg Johnson profile shot.png"},"image_size":{"wt":""},"alt":{"wt":""},"caption":{"wt":""},"birth_name":{"wt":""},"birth_date":{"wt":"<!-- {{birth date and age|YYYY|MM|DD}} -->"},"birth_place":{"wt":"[[Ames, Iowa|Ames]], [[Iowa]]"},"death_date":{"wt":"<!-- {{death date and age|YYYY|MM|DD|YYYY|MM|DD}} -->"},"death_place":{"wt":""},"resting_place":{"wt":""},"occupation":{"wt":"{{flat list |\n* [[Poet]]\n* [[Lecturer]]\n}}"},"language":{"wt":""},"nationality":{"wt":""},"ethnicity":{"wt":""},"citizenship":{"wt":""},"education":{"wt":"[[Master of Fine Arts|MFA]] in [[Creative Writing]]"},"alma_mater":{"wt":"[[University of Akron]]"},"period":{"wt":""},"genre":{"wt":"[[Poetry]]"},"subject":{"wt":""},"movement":{"wt":""},"notableworks":{"wt":""},"spouse":{"wt":""},"partner":{"wt":""},"children":{"wt":""},"relatives":{"wt":""},"awards":{"wt":""},"signature":{"wt":""},"signature_alt":{"wt":""},"years_active":{"wt":""},"website":{"wt":"{{URL|megjohnson.org}}"}},"i":0}}]}\" data-ve-no-generated-contents=\"true\" id=\"mwBg\" typeof=\"mw:Transclusion\">?</span></div>"}
instead of <div></div>
hey @santhosh is it a problem that when I run the curl command in my local I am get a "%" sign at the end of the response ? Please advice. Thanks
{"contents":"<div><span data-cx=\"[{"adapted":false}]\" data-mw=\"{"parts":[{"template":{"target":{"wt":"Infobox writer\n","href":"./Template:Infobox_writer"},"params":{"name":{"wt":"Meg Johnson"},"image":{"wt":"File:Meg Johnson profile shot.png"},"image_size":{"wt":""},"alt":{"wt":""},"caption":{"wt":""},"birth_name":{"wt":""},"birth_date":{"wt":"<!-- {{birth date and age|YYYY|MM|DD}} -->"},"birth_place":{"wt":"[[Ames, Iowa|Ames]], [[Iowa]]"},"death_date":{"wt":"<!-- {{death date and age|YYYY|MM|DD|YYYY|MM|DD}} -->"},"death_place":{"wt":""},"resting_place":{"wt":""},"occupation":{"wt":"{{flat list |\n* [[Poet]]\n* [[Lecturer]]\n}}"},"language":{"wt":""},"nationality":{"wt":""},"ethnicity":{"wt":""},"citizenship":{"wt":""},"education":{"wt":"[[Master of Fine Arts|MFA]] in [[Creative Writing]]"},"alma_mater":{"wt":"[[University of Akron]]"},"period":{"wt":""},"genre":{"wt":"[[Poetry]]"},"subject":{"wt":""},"movement":{"wt":""},"notableworks":{"wt":""},"spouse":{"wt":""},"partner":{"wt":""},"children":{"wt":""},"relatives":{"wt":""},"awards":{"wt":""},"signature":{"wt":""},"signature_alt":{"wt":""},"years_active":{"wt":""},"website":{"wt":"{{URL|megjohnson.org}}"}},"i":0}}]}\" data-ve-no-generated-contents=\"true\" id=\"mwBg\" typeof=\"mw:Transclusion\">?</span></div>"}%
@EChukwukere-WMF Are you using zsh? If so, https://stackoverflow.com/questions/29497038/why-does-a-curl-request-return-a-percent-sign-with-every-request-in-zsh would explain it.
thanks @Nikerabbit that explains it
Thanks!