1.0.1 • Published 3 years ago
translator-for-you v1.0.1
translator-for-you
A simple npm package to translate words to the specified language using Google Translate API.
Installation
npm install translator-for-youUsage
const translate = require('translator-for-you');
// Translate 'hello' to Hindi
translate('hello', 'hi')
.then(result => console.log(result))
.catch(err => console.log(err));The translate function takes two arguments:
word: The word you want to translate.
language: The language you want to translate to. You can use ISO 639-1 language codes.
The language argument should be in form of ISO 639-1 codes.
Few of language ISO codes are below in the table but if the language you want is not available then click here to view more
| Language | ISO 639-1 |
|---|---|
| English | en |
| Hindi | hi |
| Arabic | ar |
| Chinese (Simplified) | zh-CN |
| Chinese (Traditional) | zh-TW |
| Dutch | nl |
| French | fr |
| German | de |
| Italian | it |
| Japanese | ja |
| Korean | ko |
| Portuguese (Brazil) | pt-BR |
| Russian | ru |
| Spanish | es |
| Turkish | tr |