1.0.0 • Published 2 years ago

nodejs-translo v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Translo Nodejs

Nodejs client for Translo API

Import module

const Translo = require('./translo')

const APIKey = 'RAPIDAPI-KEY'
const translo = new Translo(APIKey)

translate

// Promises

translo.translate('Привет, мир!', 'en', 'ru')
.then(response => console.log(response))

// Async

let translate = await translo.translate('Привет, мир!', 'en', 'ru')

batch_translate

// Promises

translo.batchTranslate([
  {"from":"ru","to":"en","text":"Привет, мир!"},
  {"from":"en","to":"ru","text":"Hello, Translo!"}
])
.then(response => console.log(response))

// Async

let batch = await translo.batchTranslate([
  {"from":"ru","to":"en","text":"Привет, мир!"},
  {"from":"en","to":"ru","text":"Hello, Translo!"}
])

detect

// Promises

translo.detect('Translo is the best translator in Telegram')
.then(response => console.log(response))

// Async

let detect = await translo.detect('Translo is the best translator in Telegram')