Translator launched from bat-file

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Translator launched from bat-file

#1 Post by Eugene Lutsenko »

Does anyone know a file translator run from a bat-file?

It can be a local translator program with its own dictionaries, it can be a program that accesses dictionaries on the Internet. and can be at all site. I know how to do it in Unix (Cygwin). And it is made in the system of Eidos. But Cygwin itself takes up a lot of space (about 300 MB) and Google translator stopped working

skiman
Posts: 1183
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: Translator launched from bat-file

#2 Post by skiman »

Hi,

Google translator didn't stop, but is changed.

You can do it this way if you want. Don't use this too much or Google will block your IP.

Code: Select all

https://translate.googleapis.com/translate_a/single?client=gtx&sl=nl&tl=fr&dt=t&q=dit%20is%20een%20test
sl=nl (Source Language)
tl=fr (To Language)
q=... text to translate
Best regards,

Chris.
www.aboservice.be

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Translator launched from bat-file

#3 Post by Eugene Lutsenko »

Thank you, Chris! It's working!

For example:

Code: Select all

https://translate.googleapis.com/translate_a/single?client=gtx&sl=ru&tl=en&dt=t&q=Привет, Мир!
Writes to the downloads folder file: а.txt this content:

[[["Hello World!","Привет, Мир!",null,null,1]],null,"ru"]

That's right.

With regard to limitations, it seems they are not very strong:

https://cloud.google.com/translate/pricing
https://cloud.google.com/translate/quotas

Chris! And how to set the file translation in this style?

Here found one more variant. Even easier to unpack the result:

Code: Select all

http://translate.google.ru/translate_a/t?client=x&text={Привет, Мир!}&hl=en&sl=ru&tl=en
As a result, the file is written to the download folder: f.txt with such content:
"{Hello World!}"

This raises two questions:
1. How to translate a file, not a string specified directly in the command in the address bar?
2. How to specify the path where to write the output file with the translation result?

And it may be possible to get the result of the translation immediately in the form of a variable value, as in C#:
https://studassistent.ru/charp/zapros-n ... oogle-ru-c

This would be much more convenient than taking the translation result from a file. And from the file, which generally speaking is unknown where

skiman
Posts: 1183
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: Translator launched from bat-file

#4 Post by skiman »

Hi,

Use loadfromurl, then you get the result in a variable.
cResult := loadfromurl(...)
Best regards,

Chris.
www.aboservice.be

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Translator launched from bat-file

#5 Post by Eugene Lutsenko »

you cannot use this feature yet

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Translator launched from bat-file

#6 Post by Eugene Lutsenko »

with this command does not work, because there are conflicts in ch-files, etc. And there is no option to appeal to the online translator with the translation of the file?

skiman
Posts: 1183
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: Translator launched from bat-file

#7 Post by skiman »

I'm using the loadfromurl() function of Phil Ide for years. It is working without any problem.
Best regards,

Chris.
www.aboservice.be

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Translator launched from bat-file

#8 Post by Eugene Lutsenko »

String:

Code: Select all

https://translate.googleapis.com/translate_a/single?client=gtx&sl=ru&tl=en&dt=t&q=Привет, Мир!
works correctly from the address bar. But when you access it programmatically and write its output to a file, you get an incomprehensible encoding (Win 65001 (UTF-8) without ROM). This is when translated from Russian into English. Is there a parameter somewhere in this line that specifies the encoding of the input text? In principle, I Russian is not going to translate, so you can use it. Thank you!

Post Reply