rssfetchremote_Translator (fetch_r_api)
Category: | script |
---|---|
Author(s): | icuruok |
Downloads: | 47 |
Rate: | You need to be logged in to vote |
Rating: | None (0) |
Description:
This is a fetchremote resource for MTA that allows your MTA server to auto detect and translate foreign language
This is a alternative version to the socket version made here
https://community.multitheftauto.com/index.php?p=resources..p;id=15871
Unlike the socket version this version uses a queue system for each HTTP POST request
https://i.imgur.com/noFwENW.jpg
working languages
German
Italian
Japanese
Chinese
Russian
Spanish
English
When the user types in global chat The MTA lua resouces uses the fetchremote function of MTA to make a PHP post request
It sends the text this user sent in chat to detect.php at your URL
detect.php then uses Yandex Translate API to detect what language it is
and post the result to trans.php
trans.php then checks if the detected language is other than english "can be changed"
If the detected language is not english then it makes a API call to translate the language
The result is then sent back to MTA if the translation was successfull
So to sum it all up when ever a user types in global chat and if it is in a foreign language this can auto convert it for you.
Requires you have a Yandex Translate API KEY
you can get it free here
https://translate.yandex.com/developers/keys
** SETUP **
Edit acl.xml
Set
<right name="function.fetchRemote" access="true"></right>
Now edit detect.php and trans.php so they have your API KEY also replace URL inside detect.php
where it says URLGOESHERE
Edit smain.lua inside sockets resource replace the URLGOESHERE with the URL to detect.php
Start server and now the chat will auto detect and translate foreign languages
This is a alternative version to the socket version made here
https://community.multitheftauto.com/index.php?p=resources..p;id=15871
Unlike the socket version this version uses a queue system for each HTTP POST request
https://i.imgur.com/noFwENW.jpg
working languages
German
Italian
Japanese
Chinese
Russian
Spanish
English
When the user types in global chat The MTA lua resouces uses the fetchremote function of MTA to make a PHP post request
It sends the text this user sent in chat to detect.php at your URL
detect.php then uses Yandex Translate API to detect what language it is
and post the result to trans.php
trans.php then checks if the detected language is other than english "can be changed"
If the detected language is not english then it makes a API call to translate the language
The result is then sent back to MTA if the translation was successfull
So to sum it all up when ever a user types in global chat and if it is in a foreign language this can auto convert it for you.
Requires you have a Yandex Translate API KEY
you can get it free here
https://translate.yandex.com/developers/keys
** SETUP **
Edit acl.xml
Set
<right name="function.fetchRemote" access="true"></right>
Now edit detect.php and trans.php so they have your API KEY also replace URL inside detect.php
where it says URLGOESHERE
Edit smain.lua inside sockets resource replace the URLGOESHERE with the URL to detect.php
Start server and now the chat will auto detect and translate foreign languages