0.1.25 • Published 6 months ago

microsoft-translator-languages v0.1.25

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

Microsoft Translator Languages

Build Status NPM Downloads

Maps the languages currently supported by operations of the Microsoft Cognitive Translator service. The data auto-updates every 3 days, if needed.

😘 Maintainer: @eliottvincent

Who uses it?

👋 You use this library and you want to be listed there? Contact us.

Usage

const { isLanguageSupported } = require("microsoft-translator-languages");

console.log(isLanguageSupported("en", "translation"));
// true

API

Access to supported languages

The raw sets of supported languages, as returned by Microsoft Translator API, are made accessible:

const { translation } = require("microsoft-translator-languages");

console.log(translation);
// {af: {…}, am: {…}, ar: {…}, as: {…}, az: {…}, …}

// OR
const microsoftTranslator = require("microsoft-translator-languages");

console.log(microsoftTranslator.dataTranslation);
// {af: {…}, am: {…}, ar: {…}, as: {…}, az: {…}, …}

Supported scopes are: translation, transliteration & dictionary.

Check if a language is supported

isLanguageSupported(code, scope) returns whether a language is supported or not:

  • code must be a BCP 47 language tag, as per ISO 3166-1
  • scope must be either translation, transliteration or dictionary (defaults to translation)
const { isLanguageSupported } = require("microsoft-translator-languages");

console.log(isLanguageSupported("en"));
// true

console.log(isLanguageSupported("en", "translation"));
// true

console.log(isLanguageSupported("en", "transliteration"));
// false

console.log(isLanguageSupported("en", "dictionary"));
// true

License

microsoft-translator-languages is released under the MIT License. See the bundled LICENSE file for details.

0.1.25

6 months ago

0.1.23

2 years ago

0.1.24

2 years ago

0.1.22

2 years ago

0.1.21

2 years ago

0.1.20

2 years ago

0.1.18

2 years ago

0.1.19

2 years ago

0.1.15

2 years ago

0.1.16

2 years ago

0.1.17

2 years ago

0.1.11

2 years ago

0.1.12

2 years ago

0.1.13

2 years ago

0.1.14

2 years ago

0.1.10

3 years ago

0.1.9

3 years ago

0.1.8

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago