CLEO Help Google Translate a String

CLEO related
Status
Not open for further replies.

ajom

Well-known member
Joined
Apr 14, 2020
Messages
389
Solutions
2
Reaction score
268
Location
Pluto
I am trying to create a Script from scratch that translates all incoming chat since SAMP Translator(0.3z) and SAMP Translate++ does not work on the server I am using. Does anybody know how to Google translate a string? Maybe a finished snippet would be a great help to me. Thank you!

The idea was like this:
Code:
{$CLEO .cs}
0000: translator

while true
    wait 0
    // 1@ var contains "Hello World! greetings from UGBASE! I'm ajom"
    alloc 0@ 60 // 60 characters max
    04B1: @googletranslate 4 _targetstring 1@ _translatedbuffer 0@ _inlanguage 'auto' _outlanguage 'es'
    free 0@
end

:googletranslate
// some opcodes for translation...
ret 0
 
Last edited:

ItsRobinson

Active member
Joined
Nov 16, 2017
Messages
105
Reaction score
20
https://blog.api.rakuten.net/api-tutorial-google-translate-api/

You’ll have to read up on the usage of a google translate api. Once you have a read and understood that you will have to setup your own PHP (easiest language if you’re not familiar with back-end languages) you’ll have to send a request from the cleo and return the translation to the cleo.

there are snippets on ugbase for sending and receiving information to a webpage. You can put your api on a free web host like 000webhosting.
 
Status
Not open for further replies.
Top