
Security News
/Research
Popular node-ipc npm Package Infected with Credential Stealer
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.
translateer
Advanced tools
Light-weight translator
Using npm or yarn
npm install translateer --save
yarn add translateer --save
const translator = require('tranlateer');
translate is a function with only one object argument which is specified below.
q [optional] default is empty, the word/sentence you want to query.
from [optional] default is auto, used to specify the language of q.
to [optional] default is en, used to specify the language for translation.
version [optional] default is 1.0, used to specify the version of API.
Examples for API v1.0 (Default)
translator.translate({
q: 'hello world',
to: 'es'
})
.then(res => res.json())
.then(console.log);
// Hola Mundo
Examples for API v2.0
translator.translate({
q: 'hello world',
to: 'es',
v: '2.0'
})
.then(res => res.json())
.then(console.log);
/*
{
"sentences": [
{
"trans": "Hola Mundo",
"orig": "hello world",
"backend": 1
}
],
"src": "en",
"alternative_translations": [
{
"src_phrase": "hello world",
"alternative": [
{
"word_postproc": "Hola Mundo",
"score": 1000,
"has_preceeding_space": true,
"attach_to_next_token": false
},
{
"word_postproc": "Hola Mundo",
"score": 1000,
"has_preceeding_space": true,
"attach_to_next_token": false
}
],
"srcunicodeoffsets": [
{
"begin": 0,
"end": 11
}
],
"raw_src_segment": "hello world",
"start_pos": 0,
"end_pos": 0
}
],
"confidence": 0.71052581,
"ld_result": {
"srclangs": [
"en"
],
"srclangs_confidences": [
0.71052581
],
"extended_srclangs": [
"en"
]
}
}
*/
getAudio is a function returning the url of the audio file
q [optional] default is empty, the word/sentence you want to query.
to [optional] default is auto detected, used to specify the language for translation.
speed [optional] default is 1, used to specify the audio speed.
Example
translator.getAudio({
q: 'hello world'
})
.then(console.log);
// https://translate.google.com/translate_tts?ie=UTF-8&q=test&tl=en&total=1&idx=0&textlen=4&tk=290146.141044&client=t&prev=input&ttsspeed=1
Copyright (C) 2017 Tony Ngan, released under the MIT License.
FAQs
Light-weight Google translator in Node.js
The npm package translateer receives a total of 17 weekly downloads. As such, translateer popularity was classified as not popular.
We found that translateer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
/Research
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.

Security News
TeamPCP and BreachForums are promoting a Shai-Hulud supply chain attack contest with a $1,000 prize for the biggest package compromise.

Security News
Packagist urges PHP projects to update Composer after a GitHub token format change exposed some GitHub Actions tokens in CI logs.