Page 7 of 12

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!

Re: Using Google Translate to automate text translation

Posted: 06 Dec 2020, 13:39
by Fuchisa
Did not work on me at all :(

Re: Using Google Translate to automate text translation

Posted: 06 Dec 2020, 15:10
by Fuchisa
Teadrinker versions say today weather is good and some russian stuff after then nothing comes. Osprey's version did not even return. :(

Re: Using Google Translate to automate text translation

Posted: 06 Dec 2020, 15:16
by teadrinker
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.

Re: Using Google Translate to automate text translation

Posted: 06 Dec 2020, 23:46
by Fuchisa
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.

Re: Using Google Translate to automate text translation

Posted: 07 Dec 2020, 02:17
by garry
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

Re: Using Google Translate to automate text translation

Posted: 07 Dec 2020, 03:12
by Fuchisa
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.

Re: Using Google Translate to automate text translation

Posted: 25 Dec 2020, 04:38
by pgeugene
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

Re: Using Google Translate to automate text translation

Posted: 16 Jan 2021, 11:30
by Haswell
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

Re: Using Google Translate to automate text translation

Posted: 16 Jan 2021, 13:34
by rommmcek
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

Re: Using Google Translate to automate text translation

Posted: 23 Jan 2021, 13:38
by kunkel321
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?