
Research
/Security News
60 Malicious Ruby Gems Used in Targeted Credential Theft Campaign
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
google-translate-api-browser
Advanced tools
A free and unlimited API for Google Translate that works in browser
Based on google-translate-api and google-translate-token
npm install google-translate-api-browser
For cross origin requests it uses cors-anywhere
. You can use public cors-anywhere server https://cors-anywhere.herokuapp.com/
or set up your own. By default it does not use proxying.
import { translate } from "google-translate-api-browser";
translate("Je ne mangé pas six jours", { to: "en", corsUrl: "http://cors-anywhere.herokuapp.com/" })
.then(res => {
// I do not eat six days
console.log(res.text)
})
.catch(err => {
console.error(err);
});
You don't need to use CORS for node
const { translate } = require('google-translate-api-browser');
translate("Je ne mangé pas six jours", { to: "en" })
.then(res => {
// I do not eat six days
console.log(res.text)
})
.catch(err => {
console.error(err);
});
Verifies if the selected language is supported by Google Translate.
The text to be translated
type TranslateOptions = {
rpcids: string;
from: LangKey;
to: LangKey;
hl: LangKey;
raw: boolean;
tld: string;
}
const options = {
rpcids: 'MkEWBc',
from: 'ua',
to: 'en',
hl: 'en',
raw: false,
tld: 'com',
}
type TranslationResult = {
text: string; // The translated text.
pronunciation: string;
from: {
language: {
didYouMean: boolean; // `true` if the API suggest a correction in the source language
iso: string; // The code of the language that the API has recognized in the `text`
};
text: {
autoCorrected: boolean; // `true` if the API has auto corrected the `text`
value: string; // The auto corrected `text` or the `text` with suggested corrections
didYouMean: boolean; // `true` if the API has suggested corrections to the `text`
}
};
raw?: any; // If `options.raw` is true, the raw response from Google Translate servers
}
Note that from.text
will only be returned if from.text.autoCorrected
or from.text.didYouMean
equals to true
. In this case, it will have the corrections delimited with brackets ([ ]
):
Formats the google translate response.
Generates a url to google translate api.
FAQs
A free and unlimited API for Google Translate that works in browser
The npm package google-translate-api-browser receives a total of 13,943 weekly downloads. As such, google-translate-api-browser popularity was classified as popular.
We found that google-translate-api-browser 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.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.
Research
/Security News
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.