mirage-translate-languages
v1.0.2
Published
Maps supported languages by the Mirage Translate API.
Downloads
6
Readme
Mirage Translate Languages
🔤 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