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.

LanguageISO-639-1 Code
Afrikaansaf
Albaniansq
Amharicam
Arabicar
Armenianhy
Azerbaijaniaz
Basqueeu
Belarusianbe
Bengalibn
Bosnianbs
Bulgarianbg
Catalanca
Cebuanoceb (ISO-639-2)
Chinese (Simplified)zh-CN or zh (BCP-47)
Chinese (Traditional)zh-TW (BCP-47)
Corsicanco
Croatianhr
Czechcs
Danishda
Dutchnl
Englishen
Esperantoeo
Estonianet
Finnishfi
Frenchfr
Frisianfy
Galiciangl
Georgianka
Germande
Greekel
Gujaratigu
Haitian Creoleht
Hausaha
Hawaiianhaw (ISO-639-2)
Hebrewhe or iw
Hindihi
Hmonghmn (ISO-639-2)
Hungarianhu
Icelandicis
Igboig
Indonesianid
Irishga
Italianit
Japaneseja
Javanesejv
Kannadakn
Kazakhkk
Khmerkm
Kinyarwandarw
Koreanko
Kurdishku
Kyrgyzky
Laolo
Latinla
Latvianlv
Lithuanianlt
Luxembourgishlb
Macedonianmk
Malagasymg
Malayms
Malayalamml
Maltesemt
Maorimi
Marathimr
Mongolianmn
Myanmar (Burmese)my
Nepaline
Norwegianno
Nyanja (Chichewa)ny
Odia (Oriya)or
Pashtops
Persianfa
Polishpl
Portuguese (Portugal, Brazil)pt
Punjabipa
Romanianro
Russianru
Samoansm
Scots Gaelicgd
Serbiansr
Sesothost
Shonasn
Sindhisd
Sinhala (Sinhalese)si
Slovaksk
Sloveniansl
Somaliso
Spanishes
Sundanesesu
Swahilisw
Swedishsv
Tagalog (Filipino)tl
Tajiktg
Tamilta
Tatartt
Telugute
Thaith
Turkishtr
Turkmentk
Ukrainianuk
Urduur
Uyghurug
Uzbekuz
Vietnamesevi
Welshcy
Xhosaxh
Yiddishyi
Yorubayo
Zuluzu