Page MenuHomePhabricator

ContentTranslation's postMT hook is fired twice even though no MT is done
Closed, DeclinedPublic

Description

While investigating T104055 and translating "Róisín Murphy" from English to Hebrew, I noticed that the 'mw.cx.translation.postMT' hook is fired twice.

This may do the right thing functionally (and I'm not sure about this), but given that no MT is done at all and the target section is left completely empty (because of different direction), the code looks incorrect. If this is not really MT, it shouldn't be called "MT" - this only makes debugging harder.

Event Timeline

Amire80 raised the priority of this task from to Medium.
Amire80 updated the task description. (Show Details)
Amire80 added a project: ContentTranslation.
Amire80 added a subscriber: Amire80.

In case it's not clear, the problem is not just the name of the hook, but the fact that it fires twice. Among other things, it causes link adaptation to run twice. This wastes time and bandwidth and makes debugging unnecessarily harder.

Niklas's comment from a dupe bug: While investigating the parent report, I noticed we do lots of repeated API calls for link pairs. One of the reasons is that mw.cx.translation.postMT gets fired twice, first with origin as click and then immediately second time with origin as mt-user-disabled.

I ran into this again when I was debugging T110007, and it was in French, not Hebrew.

Amire80 renamed this task from when ContentTranslation translates from English to Hebrew, postMT hook is fired twice even though no MT is done to ContentTranslation's postMT hook is fired twice even though no MT is done.Sep 2 2015, 4:20 AM
Arrbee raised the priority of this task from Medium to Needs Triage.Oct 29 2018, 1:31 PM

If the mw.cx.translation.postMT is only used in CX1, then it's OK to close this.

I am fairly certain based on this code search that it is only used in CX1.