Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
yandex-translator
Advanced tools
Readme
yandex-translator is a a promise based implementation of Yandex Translate API for node.js
To start using Yandex Translate API we need to get an API key first, which we will get it from the API key request form after having created an account the registration page.
npm install yandex-translator --save
Import the yandex-translator package with with the API key obtained from the API key request form.
const yandexTranslator = require('yandex-translator')(apiKey);
Get the languages that yandex-translator support their translation:
yandexTranslator.getAvailableLanguages().then(
(result) => {
console.log(result);
},
(error) => {
console.log(error);
}
);
The parameters parameter is an object which can contain any of the following attributes:
Attribute | Type | Description | Default value |
---|---|---|---|
[ui] | string | The returned language names are output in the language corresponding to the code in this parameter. The supported language codes are shown in the list of supported languages. | |
[resultFormat] | string | The result format which can be either JSON or XML. | JSON |
[apiKey] | string | Another API key to run only this request with | The same value as the initialized API key. |
Detect a text language:
yandexTranslator.detectLanguage({text: 'Bonjour'}).then(
(result) => {
console.log(result);
},
(error) => {
console.log(error);
}
);
The parameters parameter is an object which can contain any of the following attributes:
Attribute | Type | Description | Default value |
---|---|---|---|
text* | string | The text that we want to detect it's language. | |
[hints] | array | An array of the most likely languages (they will be given preference when detecting the text language). | [] |
[resultFormat] | string | The result format which can be either JSON or XML. | JSON |
[apiKey] | string | Another API key to run only this request with | The same value as the initialized API key. |
Translate a text:
yandexTranslator.translate({text: 'Bonjour', to: 'en'}).then(
(result) => {
console.log(result);
},
(error) => {
console.log(error);
}
);
The parameters parameter is an object which can contain any of the following attributes:
Attribute | Type | Description | Default value |
---|---|---|---|
text* | string | The text that we want to detect it's language. | |
to* | string | The language which the text will be translated to. | |
[from] | string | The source language of the text. If it's then the service will try to detect the source language automatically. | |
[options] | integer | Whether the response should include the automatically detected language of the text being translated: 1 to include the automatically detected language of the text, 0 to not | 1 |
[format] | string | The text format which can be plain (Text without markup) or html (Text in HTML format). | plain |
[hints] | array | An array of the most likely languages (they will be given preference when detecting the text language). | [] |
[resultFormat] | string | The result format which can be either JSON or XML. | JSON |
[apiKey] | string | Another API key to run only this request with | The same value as the initialized API key. |
MIT.
FAQs
A promise based implementation of Yandex Translate API for Node.js.
The npm package yandex-translator receives a total of 1 weekly downloads. As such, yandex-translator popularity was classified as not popular.
We found that yandex-translator 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.