mirage-translate-languages

1.0.2 • Public • Published

Mirage Translate Languages

Build Status NPM Downloads

🔤 Maps the languages currently supported by the Mirage Translate API endpoint. The data auto-updates every 3 days, if needed.

Copyright 2023 Crisp IM SAS. See LICENSE for copying information.

😘 Maintainer: @eliottvincent

Usage

const { isLanguageSupported } = require("mirage-translate-languages");

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

API

Access to supported languages

The raw set of supported languages, as returned by the Mirage Translate API, is made accessible:

const { languages } = require("mirage-translate-languages");

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

// OR
const mirageTranslate = require("mirage-translate-languages");

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

Check if a language is supported

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

  • code must be a BCP 47 language tag, as per ISO 3166-1
const { isLanguageSupported } = require("mirage-translate-languages");

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

Package Sidebar

Install

npm i mirage-translate-languages

Weekly Downloads

2

Version

1.0.2

License

MIT

Unpacked Size

6.48 kB

Total Files

5

Last publish

Collaborators

  • eliottvct
  • mirage-dev