Page 7 of 7

Re: Using Google Translate to automate text translation

Posted: 29 Jul 2020, 17:08
by rommmcek
I was referring at oJSON array not Ahk array. Never mind, I did it for you. Please test script above. I edited it!
[Edit]: I made a third (unfunctional) edit.
P.s.: This has nothing to do with the knowledge it's pure logic. But obviously it was easier for me having some previous experience...
P.p.s.:
GoogleTranslate oJSON tutorial

Re: Using Google Translate to automate text translation

Posted: 31 Jul 2020, 06:55
by kairushinjuu
@rommmcek Thank you for all your hardwork! Sorry for basically making your write me a script. I really appreciate it though, going through all the versions and see what was changed to what effect ^_^ Its a great learning experience. Also Thank you so much for the GoogleTranslate oJSON tutorial <3 Going to make use of this.

Re: Using Google Translate to automate text translation

Posted: 04 Sep 2020, 11:40
by rommmcek
@kairushinjuu: My hard work was just counting commans and brackets.
Now we have a funciton to avoid this!
Spoiler

Re: Using Google Translate to automate text translation

Posted: 07 Oct 2020, 07:11
by LeFunk
Is there a way to replace some parts of the translation?
For example, I’d like to replace hyphens with en-dashes, something like:

clipboard := StrReplace(clipboard,"-","–")

But it doesn’t seem to have any effect, wherever I might try adding it?

Re: Using Google Translate to automate text translation

Posted: 07 Oct 2020, 07:25
by rommmcek
Try:

Code: Select all

r:= GoogleTranslate("Hello, World!", "en", "ru")
MsgBox % StrReplace(r,"-","–")

Re: Using Google Translate to automate text translation

Posted: 07 Oct 2020, 07:43
by LeFunk
Thanks, got it!

Re: Using Google Translate to automate text translation

Posted: 27 Oct 2020, 15:33
by Hs1988
Hello there! The scripts in this post are AMAZING :bravo: . I have really enjoyed testing them
As a mechanical engineer I have used AHK for several application, but I am not a programmer at all. What I would need is to modify the script made for @rommmcek (which includes Phonetic Transcriptions) in order to get a the full phonetic transcription of any text. The @rommmcek 's script works perfectly, but only provides the phonetic transcription when the text has few words, otherwise the phonetic transcription is blank.

I have tried to modify by myself but I cannot understand why the script stops providing the phonetic transcription when the text has many words ( about more than 45 ). Is what I need possible?

Thank you in advance! :D

Re: Using Google Translate to automate text translation

Posted: 28 Oct 2020, 20:46
by rommmcek
For
this (ad hoc) fix seems to work on the input side. Replace Src.= Str ((Pr1:= ojson[0][1][3])? "`n[" Pr1 "]": "") with:

Code: Select all

loop, % pln:=oJSON[0].length
        Str.= (Pr1:= ojson[0][A_Index-1][3])? "`n[" Pr1 "]": "", A_Index=pln? Src:= Str: ""
P.s.: Can you provide examples for both input and output if possible?

Re: Using Google Translate to automate text translation

Posted: 28 Oct 2020, 22:36
by Hs1988
WOW! It worked perfectly. Now, no matter how long the text is, the full phonetic transcription is provided and matches with traslate.google.com

This script will save me tons of hours in my work. :dance:

You are my new hero @rommmcek. Thank you so so much! :D

Re: Using Google Translate to automate text translation

Posted: 30 Oct 2020, 07:03
by Pulover
Thank you so much for this!