Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
translate-platforms
Advanced tools
A Node module to translate words by multiple platforms.
npm install translate-platforms
const { google, microsoft, youdao, baidu } = require('translate-platforms');
// async/await. The second parameter can be a language name (ISO 639-1)
const result = await google('Hello world', { to: google.ja });
console.log(result);
// Output:
// {
// lang: { from: 'en', to: 'ja' },
// word: 'Hello world',
// text: 'こんにちは世界',
// candidate: [ 'こんにちは世界', 'こんにちは' ]
// }
// Promises with .then(). The third parameter is the source language.
microsoft('こんにちは世界', { to: microsoft.zh }).then(result => {
console.log(result);
// Output:
// {
// lang: { from: 'ja', to: 'zh' },
// word: 'こんにちは世界',
// text: '你好世界',
// candidate: [ ]
// }
});
function translate(word: string, language: { from: string, to: string }): object
parameter | description |
---|---|
word | The word want to translate. |
from | The source language. Default is recognized automatically(auto ). (Optional) |
to | The target language. Default is Chinese(zh ). (Optional) |
key | description |
---|---|
lang | The source language and target language. |
word | The word want to translate. |
text | The most match result. |
candidate | Other translate result. |
Each platform supports different translation languages. You can check the interface function properties.
Supported platforms are Google, Microsoft, Yandex, Baidu, Tencent and Youdao.
Tencent does not support mutual translation of all languages, you can use the support
function to get the translation language supported by the language.
FAQs
Translation API from multiple platforms.
We found that translate-platforms 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
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.