1.1.8 • Published 7 years ago

limitless-google-translate v1.1.8

Weekly downloads
15
License
MIT
Repository
github
Last release
7 years ago

Limitless Google Translate API for NodeJs

Translate large texts using the google-translate-api for NodeJS!

The magic itself:

The google-translate-api uses query string in a GET method to send the text to be translated to the translation service. This limits the amount a characters you can translate at once. This package chops the texts into smaller, coherent sentences, translates them and mount them back together into the text. This is all done asynchronously, so it won't block your code midway!

The package:

It return an object with a single method: translate. Couldn't be simpler!

How to install and setup

Simply run

$ npm install limitless-google-translate

Import it into you project

 var limitless = require('limitless-google-translate')

And use it at will!

limitless.translate(VERY_LARGE_TEXT_HERE, {to: 'pt'})
  .then( (result) => {
    console.log( result.text )
  })
  .catch( (err) => {
    console.log( new Error(err) )
  })

Do you wish to use the regular and limited google-translate-api? Just do:

limitless.legacy(BORING_SMALL_TEXT_HERE, {to: 'pt'})
  .then( (result) => {
    console.log( result.text )
  })
  .catch( (err) => {
    console.log( new Error(err) )
  })

The legacy object is a direct import from the regular api, so to use it just refer to here

##The returned result is an object with the following attributes

result: {
  text:, // Fully translated text
  response: [][] //Ordered 2D array in sequence with all the
                 //sentences translated. The object inside
                 //each element of the array is the as describe here:
                 //https://github.com/matheuss/google-translate-api#returns-an-object
}

Found a bug or want to improve this somehow?

Feel free to contact me or submit a pull request. I will be thrilled to help you!

1.1.8

7 years ago

1.1.7

7 years ago

1.1.6

7 years ago

1.1.5

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago