🔤 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
const { isLanguageSupported } = require("mirage-translate-languages");
console.log(isLanguageSupported("en"));
// true
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: {…}, …}
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