LiberBinjio / GlobalTalk-Hub

GlobalTalk Hub is a place where you can chat without language barriers. Here you can speak your native language freely to friends all over the world and will be understood by them easily. Have fun💕🎈🌭🍔
https://talk.mgpt5.com
MIT License
84 stars 20 forks source link

How to change the translate API #1

Open yhy20 opened 3 months ago

yhy20 commented 3 months ago

I've already tried setting up the project, but now I've run into an issue. If I want to utilize Microsoft cognitive service's translation feature, how should I modify the code?

LiberBinjio commented 3 months ago

Please navigate to line 52 in /node_modules/translatte/index.js, and where you find the following code:

opts.services = opts.services || {google_free: true};

You'll want to modify it to:

opts.services = {"microsoft_v3": {"key": "YOUR_KEY_HERE", "location": "global"}};

Currently, the supported services are as follows:

Google Translate (Free) - {"google_free": true}: The default service that is free and unlimited. Google Cloud - {"google_v3": {"project-id": "XXX", "token": "YYY"}}: Requires sign-up and credit card info. Offers 500,000 free characters each month, then charges $20 per million characters. Microsoft Azure - {"microsoft_v3": {"key": "XXX", "location": "global"}}: Requires sign-up and credit card info. Provides 2 million free characters each month, then charges $10 per million characters. Yandex Translate - {"yandex_v1": {"key": "XXX"}}: Requires sign-up. Offers 10 million free characters each month.