Google Cloud Translate API V3
Google Cloud Translation API enables your websites and applications to dynamically translate text programmatically through an API. Translation uses a Google pre-trained or a custom machine learning model to translate text. By default, Translation uses a Google pre-trained Neural Machine Translation (NMT) model, which Google updates on semi-regular cadence when more training data or better techniques become available.
Request
The NCP Translata(Papago) API consists of a single HTTP POST endpoint. The body must be a application/json data with following fields.
-
source is the original language code to be translated.
-
target is the language code to be translated
-
text Text to translate (up to 5,000 characters per call)
-
example
{
"source": "en",
"target": "ja",
"text": "Hello, Nice to meet you."
}
Response
- In case of success (example):
{
"translatedText": "こんにちは、はじめまして",
"model": "",
"glossaryConfig": null,
"detectedLanguageCode": ""
}
-
In case of failure:
- the response mime-type is application/json, error type is indicated by the response status code and details are in the json body
Snippets
curl --location \
--request POST 'https://manta-api.coxwave.app/api/google-cloud/translate/v3' \
--header 'X-MANTA-HUB-API-KEY: <your-api-key-here>' \
--header 'Content-Type: application/json' \
--data-raw '{"source": "ko", "target": "en", "text": "안녕하세요. 반나서 반갑습니다."}'
const axios = require('axios');
const data = JSON.stringify({
"source": "ko",
"target": "en",
"text": "안녕하세요. 반나서 반갑습니다."
});
const config = {
method: 'post',
url: 'https://manta-api.coxwave.app/api/google-cloud/translate/v3',
headers: {
'X-MANTA-HUB-API-KEY': '<your-api-key-here>',
'Content-Type': 'application/json'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
import requests
import json
url = "https://manta-api.coxwave.app/api/google-cloud/translate/v3"
payload = json.dumps({
"source": "ko",
"target": "en",
"text": "안녕하세요. 반나서 반갑습니다."
})
headers = {
'X-MANTA-HUB-API-KEY': '<your-api-key-here>',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Supported Languages
Cloud Translation can translate text for more than 100 language pairs.
Language | ISO-639-1 Code |
---|---|
Afrikaans | af |
Albanian | sq |
Amharic | am |
Arabic | ar |
Armenian | hy |
Azerbaijani | az |
Basque | eu |
Belarusian | be |
Bengali | bn |
Bosnian | bs |
Bulgarian | bg |
Catalan | ca |
Cebuano | ceb (ISO-639-2) |
Chinese (Simplified) | zh-CN or zh (BCP-47) |
Chinese (Traditional) | zh-TW (BCP-47) |
Corsican | co |
Croatian | hr |
Czech | cs |
Danish | da |
Dutch | nl |
English | en |
Esperanto | eo |
Estonian | et |
Finnish | fi |
French | fr |
Frisian | fy |
Galician | gl |
Georgian | ka |
German | de |
Greek | el |
Gujarati | gu |
Haitian Creole | ht |
Hausa | ha |
Hawaiian | haw (ISO-639-2) |
Hebrew | he or iw |
Hindi | hi |
Hmong | hmn (ISO-639-2) |
Hungarian | hu |
Icelandic | is |
Igbo | ig |
Indonesian | id |
Irish | ga |
Italian | it |
Japanese | ja |
Javanese | jv |
Kannada | kn |
Kazakh | kk |
Khmer | km |
Kinyarwanda | rw |
Korean | ko |
Kurdish | ku |
Kyrgyz | ky |
Lao | lo |
Latin | la |
Latvian | lv |
Lithuanian | lt |
Luxembourgish | lb |
Macedonian | mk |
Malagasy | mg |
Malay | ms |
Malayalam | ml |
Maltese | mt |
Maori | mi |
Marathi | mr |
Mongolian | mn |
Myanmar (Burmese) | my |
Nepali | ne |
Norwegian | no |
Nyanja (Chichewa) | ny |
Odia (Oriya) | or |
Pashto | ps |
Persian | fa |
Polish | pl |
Portuguese (Portugal, Brazil) | pt |
Punjabi | pa |
Romanian | ro |
Russian | ru |
Samoan | sm |
Scots Gaelic | gd |
Serbian | sr |
Sesotho | st |
Shona | sn |
Sindhi | sd |
Sinhala (Sinhalese) | si |
Slovak | sk |
Slovenian | sl |
Somali | so |
Spanish | es |
Sundanese | su |
Swahili | sw |
Swedish | sv |
Tagalog (Filipino) | tl |
Tajik | tg |
Tamil | ta |
Tatar | tt |
Telugu | te |
Thai | th |
Turkish | tr |
Turkmen | tk |
Ukrainian | uk |
Urdu | ur |
Uyghur | ug |
Uzbek | uz |
Vietnamese | vi |
Welsh | cy |
Xhosa | xh |
Yiddish | yi |
Yoruba | yo |
Zulu | zu |