This bug has 3 parts:

1) After submitting a live job to MyGengo, I check the 'review' tab for the finished translation. The translation is in English, or it's the same as the source language. Screenshot attached.

2) When I click Accept the English from above (which should be Japanese) is saved erroneously into that translation for that node, meaning I now have two English versions. (This sounds like it might be related to the core tmgmt module than mygengo?)

3) After clicking Accept the MyGengo website shows the job as still needing review. Mygengo module not updating the mygengo site correctly?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ethanethan’s picture

The translation data you get from mygengo is in English? Maybe that's what they return if the translation failed, or is pending.

Gastonia’s picture

Sorry, that could have been more clear.

The translation is correctly done and awaiting approval in mygengo. However, what is returned to Drupal (via the API?), or at least entered into the fields as a translation, is English, or the source langauge. So, for whatever reason, Drupal and MyGengo are not communicating correctly.

I am not sure what you mean by 'is pending.' Is that not the whole point of the interface is to see the translation and then approve it?, and then accept all the fields as a set of jobs in order to move forward with posting it?

Berdir’s picture

Are you using the live or the sandbox environment of MyGengo?

Gastonia’s picture

Live

Berdir’s picture

It's possible that there is a API difference, can you check if you can reproduce the same behavior in the sandbox?

devlada’s picture

Assigned: Unassigned » devlada
devlada’s picture

Assigned: devlada » Unassigned
devlada’s picture

Assigned: Unassigned » devlada
Berdir’s picture

I believe this is the issue:

    // @todo Clean this up once sandbox and production return the same thing.
    if ($job->getTranslator()->getSetting('use_sandbox')) {
      $translation = $data->body_src;
    }
    else {
      $translation = $data->body_tgt;
    }
    $job->addTranslatedData(array('#text' => $data->body_src), $keys);

You can see that it has a special case for production/sandbox but it doesn't actually use $translation then, it always uses $data->body_src. Can you check what exactly is returned in these two arguments and which one we need to use for which environment?

Berdir’s picture

Project: Translation Management Tool » TMGMT Translator Gengo
Component: Translator: Mygengo » Code

Moving this issue over to the new Mygengo Project.

devlada’s picture

Assigned: devlada » Berdir

hmm, this can be prob, mygengo never return body_tgt both on live and sandbox. There are no other variable that contains the translation, this is an live response that I grabbed with watchdog:

stdClass Object ( [job_id] => 901177 [body_src] => Biology [lc_src] => en [lc_tgt] => de [unit_count] => 1 [tier] => standard [credits] => 0.05 [currency] => USD [status] => reviewable [eta] => -1 [ctime] => 1340631222 [callback_url] => http://tmgmt.dev.office.md-systems.ch/tmgmt_mygengo_callback [auto_approve] => 0 [custom_data] => 119][128][node_title [preview_url] => http://api.mygengo.com/v1/translate/job/901177/preview [captcha_url] => http://mygengo.com/express/captcha/?key=a8f43277bf95d82ff2300ee76e6ffe748ca048f0bb186d95896a49bda49b8083 )

Berdir’s picture

I think the reason for that is "[status] => reviewable". My guess is that this means that you can now review the job on mygengo.com and the translation will only actually be sent to you when you reviewed.

Both TMGMT and mygengo.com can AFAIK be configured to auto-accept any translations, so in a real example, you would want to configure either one to auto-accept and not review it twice.

devlada’s picture

Assigned: Berdir » devlada
devlada’s picture

Assigned: devlada » Berdir

Tested again and I get translated text only in case when approve translation on mygengo live, this is response:

stdClass Object ( [job_id] => 902231 [body_src] => Literature [lc_src] => en [lc_tgt] => de [unit_count] => 1 [tier] => standard [credits] => 0.05 [currency] => USD [status] => approved [eta] => -1 [ctime] => 1340708661 [callback_url] => http://tmgmt.dev.office.md-systems.ch/tmgmt_mygengo_callback [auto_approve] => 1 [custom_data] => 127][136][body][0][value [body_tgt] => Literatur )

When auto approve is checked, I got the same response after manually approved translation, because we always send auto_approve => 0, this option works on our side (automaticaly create node), but not on mygengo.

When auto_approve is set to 1, mygengo directly return response and only in that case we should create translated node. Before that we do not have [body_tgt] and we can not display it on review page.

Berdir’s picture

Sounds ok to me. If status != approved, ignore. In regards to body_tgt, is live/sandbox the same now? Or are they different. If equal, remove that special case code, otherwise fix it.

Once this is fixed, we should open two follow-up issues:

- Consider adding job item messages when there is a status change on the mygengo side so that you know that you need to look there. However, this could easily lead to tons of messages for large jobs.
- Allow to control the auto_approve setting per translator/job (not sure if both, maybe only translator level?)

devlada’s picture

Yes, sandbox behaves the same, returns body_tgt only when status is approved. Patch follows...

devlada’s picture

Status: Active » Needs review
FileSize
1.27 KB

Status: Needs review » Needs work

The last submitted patch, tmgmt_mygengo.plugin.inc_.patch, failed testing.

devlada’s picture

dependency problem...

What to do with review page?

devlada’s picture

Assigned: Berdir » devlada
Berdir’s picture

Status: Needs work » Needs review
FileSize
1.79 KB

Add a mygengo-specific setting to auto-approve jobs in mygengo, this is the only way to get them through the sandbox (you can't approve, you can only auto-approve.

The attached patch works, but is missing a UI to change that variable, will open that as a follow up. This is currently the main blocker to have something that works.

Berdir’s picture

Status: Needs review » Fixed

Commited.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.