Skip to main content

Function: fetchLanguage()

fetchLanguage(target: Target): Promise<string>

Retrieves the language name for a specific target, using InternationalizationHandler.fetchLanguage. If InternationalizationHandler.fetchLanguage is not defined or this function returns a nullish value, then there will be a series of fallback attempts in the following descending order:

  1. Returns Guild.preferredLocale.
  2. Returns InternationalizationOptions.defaultName if no guild was provided.
  3. Returns 'en-US' if nothing else was found.

Parameters

ParameterTypeDescription
targetTargetThe target to fetch the language from.

Returns

Promise<string>

The name of the language key.

Since

2.0.0

See

resolveLanguage

Defined in

projects/plugins/packages/i18next/src/lib/functions.ts:37