Microsoft Translator API module for node.js
Microsoft Translator Documentation
SOAP version that supports translating longer strings
Methods
Microsoft Translator API Reference
- addTranslation
- addTranslationArray (not implemented)
- breakSentences (not working)
- detect
- detectArray
- getLanguageNames
- getLanguagesForSpeak
- getLanguagesForTranslate
- getTranslations
- getTranslationsArray
- speak
- translate
- translateArray
- translateArray2
Installation
$ npm install mstranslator
An API key from portal.azure.com is needed to create a token as of April 30, 2017. See Microsoft Translator API Documentation. For details on previous authentication API and migration info
Example Usage - Auto-generated token
var MsTranslator = ;// Second parameter to constructor (true) indicates that// the token should be auto-generated. var client = api_key: "your portal.azure.com api key" true; var params = text: 'How\'s it going?' from: 'en' to: 'es'; // Don't worry about access token, it will be auto-generated if needed.client;
Example Usage - Generate token manually
var MsTranslator = ; var client = api_key: "your portal.azure.com api key" true; var params = text: 'How\'s it going?' from: 'en' to: 'es'; // Using initialize_token manually.client;
Tests
npm test
License
Licensed under the MIT license.