Using Google Translate to automate text translation

Post your working scripts, libraries and tools
User avatar
rommmcek
Posts: 1106
Joined: 15 Aug 2014, 15:18

Re: Using Google Translate to automate text translation

29 Jul 2020, 17:08

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
kairushinjuu
Posts: 25
Joined: 07 May 2020, 07:02

Re: Using Google Translate to automate text translation

31 Jul 2020, 06:55

@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.
User avatar
rommmcek
Posts: 1106
Joined: 15 Aug 2014, 15:18

Re: Using Google Translate to automate text translation

04 Sep 2020, 11:40

@kairushinjuu: My hard work was just counting commans and brackets.
Now we have a funciton to avoid this!
Spoiler
LeFunk
Posts: 32
Joined: 29 Aug 2016, 03:12

Re: Using Google Translate to automate text translation

07 Oct 2020, 07:11

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?
User avatar
rommmcek
Posts: 1106
Joined: 15 Aug 2014, 15:18

Re: Using Google Translate to automate text translation

07 Oct 2020, 07:25

Try:

Code: Select all

r:= GoogleTranslate("Hello, World!", "en", "ru")
MsgBox % StrReplace(r,"-","–")
Hs1988
Posts: 2
Joined: 27 Oct 2020, 13:33

Re: Using Google Translate to automate text translation

27 Oct 2020, 15:33

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
User avatar
rommmcek
Posts: 1106
Joined: 15 Aug 2014, 15:18

Re: Using Google Translate to automate text translation

Yesterday, 20:46

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?
Hs1988
Posts: 2
Joined: 27 Oct 2020, 13:33

Re: Using Google Translate to automate text translation

Yesterday, 22:36

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

Return to “Scripts and Functions”

Who is online

Users browsing this forum: Bing [Bot], Chiefkes, Dean36, robodesign, Spikea and 23 guests