Skip to content

Translate a string to 104 lanuages through the Google Translator API

Notifications You must be signed in to change notification settings

attx/node-translator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-translator

Translate a string to 104 lanuages through the Google Translator API

npm badge

Using the Google Translator API.

Get started

npm install node-translator --save

Usage

const translator = require('./node-translator')

translator.set('<GOOGLE_API_KEY>')

let text = 'The old brown fox is lazy now." // text to translate
translator.translate({
  text: text,
}).then((result) => {
  console.log(result)
})

Google Translator API Access required: cloud.google.com/translate

// ./config.json
{
  "API_KEY": "<GOOGLE_API_KEY>"
}

Result Format

{
  'af': { code: 'af', language: 'Afrikaans', translatedText: '..' },
  'sq': { code: 'sq', language: 'Albanian', translatedText: '..' },
  'am': { code: 'am', language: 'Amharic', translatedText: '..' },
  // ...
}

About

Translate a string to 104 lanuages through the Google Translator API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published