Using Google Translate to automate text translation

Post your working scripts, libraries and tools
User avatar
rommmcek
Posts: 1196
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: 34
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: 1196
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: 42
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: 1196
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: 1196
Joined: 15 Aug 2014, 15:18

Re: Using Google Translate to automate text translation

28 Oct 2020, 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

28 Oct 2020, 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
User avatar
Pulover
Posts: 528
Joined: 29 Sep 2013, 19:51
Location: Brazil
Contact:

Re: Using Google Translate to automate text translation

30 Oct 2020, 07:03

Thank you so much for this!
Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer)
Fuchisa
Posts: 4
Joined: 06 Dec 2020, 13:23

Re: Using Google Translate to automate text translation

06 Dec 2020, 13:39

Did not work on me at all :(
Fuchisa
Posts: 4
Joined: 06 Dec 2020, 13:23

Re: Using Google Translate to automate text translation

06 Dec 2020, 15:10

Teadrinker versions say today weather is good and some russian stuff after then nothing comes. Osprey's version did not even return. :(
teadrinker
Posts: 2077
Joined: 29 Mar 2015, 09:41
Contact:

Re: Using Google Translate to automate text translation

06 Dec 2020, 15:16

Fuchisa wrote: Teadrinker versions say today weather is good and some russian stuff after then nothing comes.
How do you use it? Write your code.
Fuchisa
Posts: 4
Joined: 06 Dec 2020, 13:23

Re: Using Google Translate to automate text translation

06 Dec 2020, 23:46

teadrinker wrote:
06 Dec 2020, 15:16
Fuchisa wrote: Teadrinker versions say today weather is good and some russian stuff after then nothing comes.
How do you use it? Write your code.
I cant use it I do not know autohotkey lang. I copied your first message.
garry
Posts: 2555
Joined: 22 Dec 2013, 12:50

Re: Using Google Translate to automate text translation

07 Dec 2020, 02:17

maybe try example with GUI ( page-1 )

Code: Select all

-select language , copy marked text ctrl+c > see translation in selected language
-click AUDIO button to hear the text
Fuchisa
Posts: 4
Joined: 06 Dec 2020, 13:23

Re: Using Google Translate to automate text translation

07 Dec 2020, 03:12

garry wrote:
07 Dec 2020, 02:17
maybe try example with GUI ( page-1 )

Code: Select all

-select language , copy marked text ctrl+c > see translation in selected language
-click AUDIO button to hear the text
Thanks garry, example 2 worked on me.
pgeugene
Posts: 3
Joined: 27 Jun 2019, 04:36

Re: Using Google Translate to automate text translation

25 Dec 2020, 04:38

Although now I can click and drag LButton to select only One word for translation.
However I found it easier and faster to double click Lbutton to select single word
How to modify the script if I want to Double click LBotton to select only One word for translation
Haswell
Posts: 64
Joined: 21 Feb 2016, 17:11

Re: Using Google Translate to automate text translation

16 Jan 2021, 11:30

Hi all.
Is there a new workable solution?
I try to use this one:
https://www.autohotkey.com/boards/viewtopic.php?f=6&t=63835&p=344751#p344640

And have such an issue:
Image
Focusing our efforts on non-productive and non-creative endeavours wastes lives as surely as war.
Jacque Fresco / The best that money can't buy
User avatar
rommmcek
Posts: 1196
Joined: 15 Aug 2014, 15:18

Re: Using Google Translate to automate text translation

16 Jan 2021, 13:34

Thee must be some kind of misunderstanding. The script in your link does not contain any MsgBox.
Run the script, click with the left mouse button at the start of the desired text to translate and hold the button, drag the mouse to the end of the desired text to translate and release the left mouse button. The translation is displayed in the ToolTip. Then press Esc to delete the ToolTip. Still works for me, however script is now a bit obsolete and you should edit it at least at this line.

pgeugene wrote:
25 Dec 2020, 04:38
I found it easier and faster to double click Lbutton to select single word
Actually your question doesn't belong here! Anyway, try:
Spoiler
User avatar
kunkel321
Posts: 218
Joined: 30 Nov 2015, 21:19
Facebook: https://www.facebook.com/kunkel321
Google: kunkel321

Re: Using Google Translate to automate text translation

23 Jan 2021, 13:38

Hi Teadrinker and All,
Is there a list somewhere of the different languages that this sctipt will work with? And also, what the abbreviations for them are? For example:
ru = Russian
es = Spanish
en = English
...Others?
;=============================
::sig::Stephen Kunkel

Return to “Scripts and Functions”

Who is online

Users browsing this forum: DaveT1, TheArkive, yutopon777 and 17 guests