HTTP() & ****** Translator
#1

Hey!

Is it possible to actually use the HTTP() function to send a request to the ****** Translator website in order to return the translated text in game?
Reply
#2

Yes it is there are even script made for this , search.
Reply
#3

I have searched. I'm not looking to download a script to use, I want to make one myself. The ones I have found are "text to speech" which I don't actually want. I'd rather have it actually translate the text I send and return the translated text.
Reply
#4

****** translator if I'm not wrong blocking directly http texts so samp http function can't read the text it's translating, here's a website that would work on samp http( thingy

PHP код:
 udcs-tss.com/******/?msg=%s&langin=%s&langout=%
example:
PHP код:
 udcs-tss.com/******/?msg=Hi&langin=en&langout=es 
lang-in even if wrong it detecting the real one of it auto
Reply
#5

Quote:
Originally Posted by jlalt
Посмотреть сообщение
****** translator if I'm not wrong blocking directly http texts so samp http function can't read the text it's translating, here's a website that would work on samp http( thingy

PHP код:
 udcs-tss.com/******/?msg=%s&langin=%s&langout=%
example:
PHP код:
 udcs-tss.com/******/?msg=Hi&langin=en&langout=es 
lang-in even if wrong it detecting the real one of it auto
or
Код:
stock Trans(id,str[]) 
{ 
     new stream[114]; 
    format(stream,sizeof(stream),"http://translate.******.com/translate_tts?ie=UTF-8&total=1&idx=0&textlen=32&client=tw-ob&q=%s&tl=En-gb",str); 
    PlayAudioStreamForPlayer(id,stream); 
    return 1; 
}
Reply
#6

@Luis- You just have to look for the official API. ****** has one for just about ALL of their services. All you need to do is sign up (it's free, no credit or anything) and get your personal key.
Reply
#7

Crayder:
****** Translate API is a paid service. For website translations, we encourage you to use the ****** Website Translator gadget.

Reply
#8

Hmm. So, i'm guessing there's no way to actually return the translated text in text form instead of audio form?
Reply
#9

There is a way. I saw it in a server.
Reply
#10

I'm sorry for the late reply.
What jlalt said was very helpful.

This is only a testing code, so you'll have to change the HTTP index if you want multiple people to use this.

Also, the "langout=fr" at the end of the URL is the language the website will translate the string to.
I've only tried it with french, but I think it'll cause problems once it starts to show the none english characters. (For example й and shit like that)

Signs like # will fuck it up so I think you should limit the input text to A-Z only.
You can always find a fix for that, but I'm not that good with URLs, and I'm a bit lazy.
Код:
forward HTTP_TranslateResponse(index, response_code, data[])

public OnGameModeInit()
{
	new str[128];
	strcat(str, "Hello, my name is James. How are you?");
	for (new i; i < 82; i++)
	{
	    if (str[i] == ' ')
	    {
	        str[i] = '+';
	    }
	}
	format(str, sizeof (str), "udcs-tss.com/******/?msg=%s&langin=en&langout=fr", str);
	HTTP(0, HTTP_GET, str, "", "HTTP_TranslateResponse");
	return 1;
}

public HTTP_TranslateResponse(index, response_code, data[])
{
    if(response_code == 200)
    {
        if (strfind(data, "\n") != -1)
        {
            strdel(data, 0, strfind(data, "\n")+1);
            strdel(data, strlen(data)-6, strlen(data));
        }
        print(data);
    }
    else
    {
        printf("Error ID: %i", response_code);
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)