Skip to main content

getSupportedLanguages()

The getSupportedLanguages function returns the array of supported languages configured in your i18n-keyless application. This function is useful for building dynamic language selectors or checking if a specific language is supported.

Function Signature

getSupportedLanguages(): Lang[]

Return Value

Lang[]

type: Lang[]

Returns an array of supported language codes as configured during initialization. The Lang type includes one of the 48 Lang codes — "fr", "en", "es", "zh-Hans", "pt-BR", and so on.

getSupportedLanguages vs AVAILABLE_LANGS

getSupportedLanguages() returns only the languages your project enabled in init({ languages: { supported: [...] } }). If you want the full list of every language i18n-keyless can translate to (regardless of your config), import the AVAILABLE_LANGS constant instead:

import { AVAILABLE_LANGS } from 'i18n-keyless-node';

// All 48 languages i18n-keyless supports, ready to spread into init({ supported })
console.log(AVAILABLE_LANGS);

Notes

  • Returns the exact array configured in I18nKeyless.init({ languages: { supported: [...] } })
  • The array reflects the languages configured at initialization time
  • Useful for building dynamic interfaces that adapt to your language configuration
  • The order of languages in the array matches the order specified during initialization
  • For the full set of available language codes (not just the ones enabled in your project), use AVAILABLE_LANGS