Gathering detailed insights and metrics for @akgargo/ms-translator-api-client
Gathering detailed insights and metrics for @akgargo/ms-translator-api-client
non-official package that enables a Microsoft Azure Translator API Client for NodeJS This package was created as response of a lack of official packages for consuming MS Translator APIs in NodeJS applications. It provides an easy way to consume their endpoints and it's fully extensible by adding layers of abstraction for business logic.
npm install @akgargo/ms-translator-api-client
Typescript
Module System
Node Version
NPM Version
72.6
Supply Chain
98
Quality
74.9
Maintenance
50
Vulnerability
100
License
TypeScript (100%)
Verify real, reachable, and deliverable emails with instant MX records, SMTP checks, and disposable email detection.
Total Downloads
2,479
Last Day
1
Last Week
2
Last Month
9
Last Year
169
7 Commits
1 Watchers
1 Branches
1 Contributors
Updated on Aug 16, 2022
Minified
Minified + Gzipped
Latest Version
0.0.4
Package Id
@akgargo/ms-translator-api-client@0.0.4
Unpacked Size
45.41 kB
Size
9.50 kB
File Count
14
NPM Version
7.17.0
Node Version
16.16.0
Cumulative downloads
Total Downloads
Last Day
0%
1
Compared to previous day
Last Week
0%
2
Compared to previous week
Last Month
-72.7%
9
Compared to previous month
Last Year
-58.1%
169
Compared to previous year
non-official package that enables a Microsoft Azure Translator API Client for NodeJS
This package was created as response of a lack of official packages for consuming MS Translator API in NodeJS applications.
It provides an easy way to consume their enpointsand its fully extensible by adding layers of abstraction for business logic.
This package is currently a beta version and only supports "languages", "detect", "translate" and "transliterate" endpoints of the Azure Text Translation REST API
This package is only available for NodeJS and should be installed using NPM by running the commands below:
Open a command line and make sure you are in your project's root directory before installing it
cd development/my-awesome-project/
Now, let's install this package
npm i @akgargo/ms-translator-api-client
The usage of this API client is very intuitive if you have already read the official Microsoft documentation. I higly recommend you to uderstand how the API works first, as this is only an abstracion layer that help you to reduce boilerplate code directly in your application for using MS Azure translation capabilities.
import { MicrosoftTextTranslator } from '@akgargo/ms-translator-api-client';
const translator = new MicrosoftTextTranslator({ subscriptionKey: <YOUR_AZURE_TRANSLATOR_KEY> })
translator.translate({
text: ["Hello world", "This are two different texts to be translated in a single call"],
to: "es"
})
.then(translation => {
console.log(JSON.stringify({ translation }, null, 2))
});
The code above should print in the console
{
"translation": [
{
"detectedLanguage": {
"language": "en",
"score": 1
},
"translations": [
{
"text": "Hola mundo",
"to": "es"
}
]
},
{
"detectedLanguage": {
"language": "en",
"score": 1
},
"translations": [
{
"text": "Se trata de dos textos diferentes a traducir en una sola convocatoria",
"to": "es"
}
]
}
]
}
Usage
translator.languages({}).then(languages => {
console.log(JSON.stringify({ languages }, null, 2))
});
Result
{
"detection": [
{
"translation": {
"af": {
"name": "Afrikaans",
"nativeName": "Afrikaans",
"dir": "ltr"
},
....
},
"transliteration": {
"ar": {
"name": "Arabic",
"nativeName": "العربية",
"scripts": [
{
"code": "Arab",
"name": "Arabic",
"nativeName": "العربية",
"dir": "rtl",
"toScripts": [
{
"code": "Latn",
"name": "Latin",
"nativeName": "اللاتينية",
"dir": "ltr"
}
]
},
{
"code": "Latn",
"name": "Latin",
"nativeName": "اللاتينية",
"dir": "ltr",
"toScripts": [
{
"code": "Arab",
"name": "Arabic",
"nativeName": "العربية",
"dir": "rtl"
}
]
}
]
},
...
},
"dictionary": {
"af": {
"name": "Afrikaans",
"nativeName": "Afrikaans",
"dir": "ltr",
"translations": [
{
"name": "English",
"nativeName": "English",
"dir": "ltr",
"code": "en"
}
]
},
...
}
}
]
}
Usage
translator.detect({
text: ['Bonjour']
}).then(detection => {
console.log(JSON.stringify({ detection }, null, 2))
});
Result
{
"detection": [
{
"language": "fr",
"score": 1,
"isTranslationSupported": true,
"isTransliterationSupported": false
}
]
}
Usage
translator.translate({
text: ['Bonjour'],
to: "en"
}).then(translation => {
console.log(JSON.stringify({ translation }, null, 2))
});
Result
{
"translation": [
{
"detectedLanguage": {
"language": "fr",
"score": 1
},
"translations": [
{
"text": "Hello",
"to": "en"
}
]
}
]
}
Usage
translator.transliterate({
text: ["こんにちは"],
language: "ja",
fromScript: "Jpan",
toScript: "Latn",
}).then(transliteration => {
console.log(JSON.stringify({ transliteration }, null, 2))
});
Result
{
"transliteration": [
{
"text": "Kon'nichiwa",
"script": "Latn"
}
]
}
No vulnerabilities found.
No security vulnerabilities found.