How to use Premium Edition of Google Translate within SDL Trados Studio 2017?
Thread poster: Michael79

Michael79  Identity Verified
China
Local time: 21:02
Member (2009)
English to Chinese
+ ...
Dec 12, 2016

Dear All,

I have SDL Trados Studio 2017 installed about 1 month ago with my paid Google Translate API(the formal name is Google Cloud Translation API) and my language pair is English into Simplified Chinese.

The combination of Studio 2017 and GT API works fine but quality of GT API is inferior to that of Google Translate Online which is based on Neural Machine Translation System,which is part of Premium Edition of Google Cloud Translation API.

After my request of applying for the Premium Edition was approved recently, I found that I can't obtain valid key because I have no knowledge about JSON,SDK and other technical issues,which are necessary for using the Premium Edition.In other words, I can't set it up correctly in my Google Console or Studio interface.

So I wonder if anyone here using the Premium Edition within SDL Studio like me ? Any tips or hints out there if so?

Thanks much for your help in advance.


Direct link Reply with quote
 

Samuel Murray  Identity Verified
Netherlands
Local time: 15:02
Member (2006)
English to Afrikaans
+ ...
@Michael Dec 12, 2016

Michael79 wrote:
After my request of applying for the Premium Edition was approved recently...


It is my understanding that (at least for now, while Premium is still in beta, but possibly not after its public release in mid-January 2017), you have to use the same API key for Premium as with Standard.

But the URL that your CAT tool sends has to be slightly different.
1. Use translate.googleapis.com/ instead of www.googleapis.com/.
2. Add &model=nmt to the URL.

The JSON reply is approximately the same, so a CAT tool shouldn't have a problem parsing it, except that there is an extra chunk of data in it which might be useful for the CAT tool to be able to recognise -- the JSON reply tells the CAT tool whether a Standard or a Premium translation was sent.

Also there is a severe "character" limit at this time, and Chinese eats up a lot of characters very quickly, so some of your longer sentences will throw an error.

So, the question is: does Trados allow you to edit the URL that it sends to Google Translate? It does not seem like Trados 2015 allows me edit the URL.

Samuel

PS: In the mean time, if you want to use the Premium translation but your CAT tool doesn't support it yet, you can use my little clipboard script. To use it, you'd have to press Ctrl+A in the segment, then press the script's own shortcut key (which is Ctrl+ `), and then wait a second or two, and then press Ctrl+V to paste the translation. Not guaranteed to work on any computer but my own, obviously. It requires AutoIt to be installed. You need your own API key and the key needs to be enabled for Premium.


[Edited at 2016-12-12 08:59 GMT]


Direct link Reply with quote
 

Michael79  Identity Verified
China
Local time: 21:02
Member (2009)
English to Chinese
+ ...
TOPIC STARTER
Many thanks for your help and tool. Dec 13, 2016

Samuel Murray wrote:

It is my understanding that
PS: In the mean time, if you want to use the Premium translation but your CAT tool doesn't support it yet, you can use my little clipboard script. To use it, you'd have to press Ctrl+A in the segment, then press the script's own shortcut key (which is Ctrl+ `), and then wait a second or two, and then press Ctrl+V to paste the translation. Not guaranteed to work on any computer but my own, obviously. It requires AutoIt to be installed. You need your own API key and the key needs to be enabled for Premium.


[Edited at 2016-12-12 08:59 GMT]


Hi Samuel,

Thanks soooo much for your pretty helpful tips. Your tool is super easy-to-use with a simple read-me document in plain words.

About the API key I use for Studio 2017 , it seems like a random string of digits and letters instead of some kind of URL.

Could you please show me a sample of the URL you mentioned that might be an API key as well ? I will try it out in Studio 2017 later.


Thanks again for your prompt and detailed reply.


Direct link Reply with quote
 

Samuel Murray  Identity Verified
Netherlands
Local time: 15:02
Member (2006)
English to Afrikaans
+ ...
@Michael Dec 13, 2016

Michael79 wrote:
About the API key I use for Studio 2017 , it seems like a random string of digits and letters instead of some kind of URL.


The API key itself is a string of letters and numbers, which Trados then adds to a URL when it sends it to Google. The URL would look something like this:

https://www.googleapis.com/language/translate/v2?key={{YOUR KEY}}&format=html&source=en&target=zh&q={{YOUR SOURCE TEXT HERE}}

Could you please show me a sample of the URL you mentioned that might be an API key as well ? I will try it out in Studio 2017 later.


No, I think you misunderstood -- you can't give the new URL to Trados. You can only give your API key to Trados. The Trados developers will have to reprogram Trados to make it possible to use the Premium service. Perhaps Trados 2019 will have that.

Unfortunately I did not select any of the Premium service's languages when I installed Trados, so I can't test whether hacking Sdl.LanguagePlatform.MTConnectors.Google.dll with something like ILSpy will do the trick.

Samuel


Direct link Reply with quote
 

Michael79  Identity Verified
China
Local time: 21:02
Member (2009)
English to Chinese
+ ...
TOPIC STARTER
Another big thank you. Dec 15, 2016

Samuel Murray wrote:

Michael79 wrote:
About the API key I use for Studio 2017 , it seems like a random string of digits and letters instead of some kind of URL.


The API key itself is a string of letters and numbers, which Trados then adds to a URL when it sends it to Google. The URL would look something like this:

https://www.googleapis.com/language/translate/v2?key={{YOUR KEY}}&format=html&source=en&target=zh&q={{YOUR SOURCE TEXT HERE}}

Could you please show me a sample of the URL you mentioned that might be an API key as well ? I will try it out in Studio 2017 later.


No, I think you misunderstood -- you can't give the new URL to Trados. You can only give your API key to Trados. The Trados developers will have to reprogram Trados to make it possible to use the Premium service. Perhaps Trados 2019 will have that.

Unfortunately I did not select any of the Premium service's languages when I installed Trados, so I can't test whether hacking Sdl.LanguagePlatform.MTConnectors.Google.dll with something like ILSpy will do the trick.

Samuel


Such a valuable post. I really appreciate your inputs.


Direct link Reply with quote
 

Michael79  Identity Verified
China
Local time: 21:02
Member (2009)
English to Chinese
+ ...
TOPIC STARTER
About the AutoIt Script Dec 19, 2016

Samuel Murray wrote:

The API key itself is a string of letters and numbers, which Trados then adds to a URL when it sends it to Google. The URL would look something like this.....
Samuel


Hi Samuel,

I have been using your AutoIt Script for translating some projects with Google NMT ,which is super super amazing.

Just a little question about the script:

How can I edit your script so that translation I get from the Premium Edition of GT can be pasted onto the text editor such as MS-Word or SDL Studios directly rather than the clipboard to avoid the ctrl+v command?


Thanks much for your further instruction.


Michael


Direct link Reply with quote
 

Donglai Lou  Identity Verified
China
Local time: 21:02
Member (2002)
English to Chinese
+ ...
Switch: Model Dec 31, 2016

Dear Samual,

Happy New Year.

I am testing the new premium service URL by adding &model=nmt, but got an error message:

Invalid JSON payload received. Unknown name \"model\": Cannot bind 'nmt'. Field 'model' could not be found in request message

both translate.googleapis.com and translation.googleapis.com can't recognize the model switch despite the sample given in the Google API site.

However, www.translationapis.com can correctly return a result after adding the switch. unfortunately, the result is the same as regular one.

my URL should be OK:

https://translate.googleapis.com/language/translate/v2?key={}&model=base&q=test&source=en&target=zh-cn

or

https://translation.googleapis.com/language/translate/v2?key={}&model=base&q=test&source=en&target=zh-cn

I see there is a beta application form on the Google site. Do I need to apply for the service before I can use it in my small autohotkey tool.

thank you in advance for your kind help.

best regards,
Donglai


Direct link Reply with quote
 

Samuel Murray  Identity Verified
Netherlands
Local time: 15:02
Member (2006)
English to Afrikaans
+ ...
@Donglai Dec 31, 2016

Donglai Lou wrote:
I see there is a beta application form on the Google site. Do I need to apply for the service before I can use it...


Yes, you have to apply for it first.

Your URL should be:
https://translate.googleapis.com/language/translate/v2?key=YOURKEY&mode=nmt&source=en&target=zh&q=SOURCETEXT

When your application succeeded, you're welcome to use some of my scripts: 1. simplegoog premium version 5, for testing the premium service (it can create e.g. a table with both the premium and standard translations side by side), 2. simplegoog premium version 5 with shortcut key, for use in programs like Trados, 3. simplegoog premium version 5 for OmegaT, for use with OmegaT, and 4. simplegoog premium version 6, with shortcut, for self-compile, for programs like Trados, but with the option to compile it without putting the API key in the file name.



[Edited at 2016-12-31 12:38 GMT]


Direct link Reply with quote
 

Samuel Murray  Identity Verified
Netherlands
Local time: 15:02
Member (2006)
English to Afrikaans
+ ...
@Michael Dec 31, 2016

Michael79 wrote:
How can I edit your script so that translation I get from the Premium Edition of GT can be pasted onto the text editor such as MS-Word or SDL Studios directly rather than the clipboard to avoid the ctrl+v command?


Change this:

ClipPut ($bigtranslation)

to this:

ClipPut ($bigtranslation)
Sleep ("500")
Send ("^v")

You can reduce the sleep time (in milliseconds) to e.g. 200 or even 100, depending on your computer's clipboard speed. The sleep time tells the script to wait a bit (for the translation to be written to the clipboard properly) before sending the paste command.

You might want the script to do Ctrl+A first, before doing Ctrl+V:

ClipPut ($bigtranslation)
Send ("^a")
Sleep ("500")
Send ("^v")


Direct link Reply with quote
 

Donglai Lou  Identity Verified
China
Local time: 21:02
Member (2002)
English to Chinese
+ ...
You are the Star Dec 31, 2016

Samuel Murray wrote:

Donglai Lou wrote:
I see there is a beta application form on the Google site. Do I need to apply for the service before I can use it...


Yes, you have to apply for it first.

Your URL should be:
https://translate.googleapis.com/language/translate/v2?key=YOURKEY&mode=nmt&source=en&target=zh&q=SOURCETEXT

When your application succeeded, you're welcome to use some of my scripts: 1. simplegoog premium version 5, for testing the premium service (it can create e.g. a table with both the premium and standard translations side by side), 2. simplegoog premium version 5 with shortcut key, for use in programs like Trados, 3. simplegoog premium version 5 for OmegaT, for use with OmegaT, and 4. simplegoog premium version 6, with shortcut, for self-compile, for programs like Trados, but with the option to compile it without putting the API key in the file name.



[Edited at 2016-12-31 12:38 GMT]


Thanks a lot for your advice and help.


Direct link Reply with quote
 

Samuel Murray  Identity Verified
Netherlands
Local time: 15:02
Member (2006)
English to Afrikaans
+ ...
Google changed the URL again Jan 10

Samuel Murray wrote:
In the mean time, if you want to use the Premium translation but your CAT tool doesn't support it yet, you can use my little clipboard script. ... It requires AutoIt to be installed. You need your own API key and the key needs to be enabled for Premium.


Google changed the URL again. It now uses "translation." instead of "translate.". I've updated my scripts (let me know if anyone uses them and it doesn't work):

http://www.leuce.com/autoit/simplegoog%20premium%20v7%20SHORTCUT.zip (for Trados)
http://www.leuce.com/autoit/simplegoog%20premium%20v7.zip (for testing)
http://www.leuce.com/autoit/simplegoog%20premium%20v7%20OMEGAT.zip (for OmegaT)
http://www.leuce.com/autoit/simplegoog%20premium%20v7%20SHORTCUT%20for%20self-compile.zip (for self compile)

Samuel


Direct link Reply with quote
 

Ricardo Castaño
Colombia
Local time: 08:02
English to Spanish
+ ...
Kind of off-topic but Jul 16

This question is kind of off-topic but since the OP mentioned that the quality of Google Translate Online is superior, I wonder if you know what API does the translation feature within Gdrive use? The one to translate full documents.

Direct link Reply with quote
 


To report site rules violations or get help, contact a site moderator:


You can also contact site staff by submitting a support request »

How to use Premium Edition of Google Translate within SDL Trados Studio 2017?

Advanced search







CafeTran Espresso
You've never met a CAT tool this clever!

Translate faster & easier, using a sophisticated CAT tool built by a translator / developer. Accept jobs from clients who use SDL Trados, MemoQ, Wordfast & major CAT tools. Download and start using CafeTran Espresso -- for free

More info »
SDL Trados Studio 2017 Freelance
The leading translation software used by over 250,000 translators.

SDL Trados Studio 2017 helps translators increase translation productivity whilst ensuring quality. Combining translation memory, terminology management and machine translation in one simple and easy-to-use environment.

More info »



Forums
  • All of ProZ.com
  • Term search
  • Jobs
  • Forums
  • Multiple search