1.1.0 • Published 8 years ago

gtrans v1.1.0

Weekly downloads
13
License
ISC
Repository
github
Last release
8 years ago

Flattr this git repo Build Status

gtrans

Installation

npm install gtrans

Duh.

Translation Example

var gtrans = require('gtrans');

var t = new gtrans("apikey");

var opts = {
  text: "Hello, world!",
  source: "en", // This is optional. Language can be auto-detected.
  target: "de"
};

t.translate(opts).then(console.log);

Console output:

[ { translatedText: 'Hallo Welt!' } ]

Language Detection Example

var gtrans = require('gtrans');

var t = new gtrans("apikey");

t.detect("Hello, world!").then(console.log);

Console output:

[ [ { language: 'en', isReliable: false, confidence: 0.7100697 } ] ]

gtrans can also detect multiple strings, like this.

t.detect("one", "two")

Running tests

  1. npm install
  2. Rename test/key.template.json to test/key.json and add your Google Translate API key
  3. npm test
1.1.0

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago