Skip to content

Referencei18n

findLocaleKeys

List the locale tags a lookup falls back through, most specific first

Import

import { findLocaleKeys } from "@videojs/react/i18n";

findLocaleKeys returns the fallback chain the player resolves a locale through: the normalized tag from getLocaleKey, then each shorter prefix, ending with en. A Chinese tag with a script, such as zh-Hant-HK, also falls back through zh-tw or zh-cn before zh. A translation missing from one locale is looked up in the next.

import { findLocaleKeys } from '@videojs/react/i18n';

findLocaleKeys('es-419-u-nu-latn'); // ['es-419', 'es', 'en']
findLocaleKeys('fr'); // ['fr', 'en']

API Reference

findLocaleKeys(locale): Locale[]

Parameters

ParameterTypeDefaultDetails
locale*(typeof LOCALES)[number] | string & {}—

Return Value

Locale[]