The current module does not use the Gengo server side calculation of word due for translation. It seems to use a local algorithm.

This leads to higher estimates of words and hence increased cost for a job, which can be a real problem for large and complex jobs. Though Gengo seems to correctly process the word count/cost when the job is submitted, the current situation is misleading and makes it difficult to correctly estimate the total cost of translation.

Comments

berdir’s picture

What TMGMT core does is just a rough estimate of the words, this has no effect on the costs. This is calculated before it's even known that MyGengo might be used and it's used for certain internal checks.

The only thing that would be possible is updating after a job has been submitted/sent for an offer.

The wordcount that is displayed in the offer before you submit a job is the only thing that is relevant for the costs.

bforchhammer’s picture

The gengo api support quotes: http://developers.gengo.com/v2/service/#quote-post
A quote returns the number of words ("unit_count") and the respective cost ("credits").

Can we use that to display the correct number of words and cost before submitting a job?

Edit: and slightly off-topic, but it would be cool if we could also display the current gengo account balance from http://developers.gengo.com/v2/account/#balance-get

bforchhammer’s picture

Title: Use word count from Gengo » Get translation job quotes from Gengo (real word count + cost)
Version: 7.x-1.0-beta1 » 7.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new7.71 KB
new34.19 KB

Attached patch adds functionality to query the quote service mentioned above... it also changes a few other things which may or may not need to go into separate issues. ;-)

tmgmt_gengo-checkout-quote.png

Notice the different word counts; the top one (353) is the one calculated by tmgmt, the bottom one in Checkout Settings (265) is the one from Gengo. Cost and ETA are also returned from the service, so I also showed them in the UI...

blueminds’s picture

@ihamilton thanks a lot for your patch. I reviewed your patch with following changes:
- quote logic now fully relies on gengo service including the word count
- getGengoLanguagePairs() method is now the only place to query the language_pairs resource
- quality options are build in the ui controller based on language pairs returned from gengo

Changes are pushed into repository. Please see if it works for you as well, if so we can go to RTBC.

miro_dietiker’s picture

Status: Needs review » Fixed

Since you committed it, i switch to fixed. Please reopen if you feel it is not 100% done yet.

bforchhammer’s picture

Status: Fixed » Needs work

@blueminds: Thanks for committing. Please mention me in the commit message next time you commit one of my patches... :-)

Also, there's a few things that still need work IMO:

  • Machine translation is gone from the list of quality levels. Shouldn't this option always be available?
  • The watchdog message in tmgmt_mygengo_ajax_callback_translator_select() needs to cleaned up ("jo vole"?)
  • I have a new notice on job pages:
    Notice: Undefined index: comment in TMGMTMyGengoTranslatorUIController->checkoutSettingsForm() (line 156 of /var/www/drupal/sites/all/modules/tmgmt_mygengo/tmgmt_mygengo.ui.inc).
    
  • The order of quality tiers is now the following: Standard - Ultra - Business. We shoult probably reorder this by unit-price (ascending); this may just be because of the sandbox, but probably a good idea either way because the api doesn't guarantee a certain order afaik.
  • You turned a one-liner around $job->settings['quality'] into 9 lines; from what I can see both versions do exactly the same. Revert for the sake of readability? ;-)
  • The adjustment of the #description on the "Quality" form item seems to have gotten lost... unless that was left out on purpose?
    -      '#description' => t('With which Quality you want to translate?'),
    +      '#description' => t('Choose the level of quality for this translation job.'),
    
bforchhammer’s picture

Forgot to mention: I tested it with the sandbox and apart from the issues above things seem to be working well! Quoting works, functionality-wise things seem good :)

blueminds’s picture

StatusFileSize
new4.07 KB

sorry... I mentioned ihamilton's name instead - will update commit message and push it as soon as this patch is okay with you.

Here are answers to your points:
- Machine translation was not present as it is not supported for requested language pair. I added it back, I guess as it was misleading for you it will be for others as well. So now instead it will display error message about not supported language.
- Watchdog message removed, also removed the ajax callback, and using the default one - leftover from debugging
- Notice fixed
- one-liner has changed as it needs to deal with several things. First - settings will not get updated on repetitive change of quality select box. Second - we need to set default if there is nothing in. I guess it is more readable when split into two blocks where each is explained in comment.
- Description changed to your wish.

Please see the patch.

blueminds’s picture

Status: Needs work » Needs review
miro_dietiker’s picture

Sorry to tell you: You cannot update commit messages on d.o. :-) Only pushing new commits fast forward is possible.

bforchhammer’s picture

Status: Needs review » Needs work

Machine translation was not present as it is not supported for requested language pair. I added it back, I guess as it was misleading for you it will be for others as well. So now instead it will display error message about not supported language.

I actually think it's okay to completely hide invalid choices... But I thought that machine translation was always available, regardless of the current language pair. It seems that you just cannot get a quote for a machine translation (which makes sense, because cost and eta are always zero).

With patch #8 it's currently not possible to get a machine translation from English to German, which I'm quite sure was possible before! (Instead I get #1551 language service not supported)

blueminds’s picture

Status: Needs work » Needs review
StatusFileSize
new6.58 KB

Regarding invalid choices - it seems that machine is always available, at least I could not find a way to tell from the gengo api. So currently it seems that the only invalid choice is ultra as gengo does not support grouped jobs for this tier - so before final push we should comment out this option and wait for gengo to fix this.

The patch is a mess as it includes code from other issue as well :( ... the subject of this issue starts on line 96.

miro_dietiker’s picture

Assigned: Unassigned » blueminds
Status: Needs review » Needs work

Can you then provide a better patch that is not messy? I don't really what i should review in your messy patch...

Please don't cover adding other translation modes in this issue. It has a clear scope defined by title. Add new ons for the other topics. I'm missing the thread here.

blueminds’s picture

Status: Needs work » Fixed

So to move forward I pushed the latest code. All seems to work nicely - the subject of this thread as well the tier select.

In case there are further issues I suggest to open new thread and solve it there.

... sorry for disorganising the workflow here :|

miro_dietiker’s picture

Great, thank you. We should possibly also trigger Gengo to test it and then release a new beta?

bforchhammer’s picture

Status: Fixed » Closed (fixed)

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