
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
translate-google-api
Advanced tools
A free and unlimited API for Google Translate(contains single and multiple)
A free and unlimited API for Google Translate(support single text and Multi-segment text) 💵🚫
npm install --save translate-google-api
I have tried some libs for translate on React-Native app. But don't have any package support.
I don't want to translate all the text first and I'd like to translate segment by segment. Especially in an article, the whole translation may not work well.
In the existing library, if I want to translate multi-segment text, I have to request multiple times.(like google-translate-api)
So I have to use the new api to implement, so the translate-google-api
is born.
Single segment
import translate from 'translate-google-api';
const result = await translate(`I'm fine.`, {
tld: "cn",
to: "vi",
});
// ["Tôi ổn."]
Multi-segment text
import translate from 'translate-google-api';
const result = await translate(['Hi', 'How are you?', `I'm fine`], {
tld: "cn",
to: "vi",
});
//["Chào","Bạn khỏe không?","Tôi ổn."]
Proxy
proxy-config https://github.com/axios/axios#request-config
const result = await translate([`I'm fine. And you?`,`I'm ok.`], {
tld: "cn",
to: "vi",
proxy: {
host: '127.0.0.1',
port: 9000,
auth: {
username: 'mikeymike',
password: 'rapunz3l'
}
}
});
Type: string
, array
The text to be translated
Type: object
from?
Type: string
Default: auto
The text language. Must be auto or one of the codes/names (not case sensitive) contained in src/languages.ts
to
Type: string
Default: en
The language in which the text should be translated. Must be one of the codes/names (not case sensitive) contained in src/languages.ts.
tld
Type: string
'com' | 'cn' <Default 'com'>
cn
is for China, com
for others.
proxy
Type: AxiosProxyConfig
proxy for request.
config
Type: object
config for axios
Apache License
FAQs
A free and unlimited API for Google Translate(contains single and multiple)
The npm package translate-google-api receives a total of 41,344 weekly downloads. As such, translate-google-api popularity was classified as popular.
We found that translate-google-api 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
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
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.