The readonly list whose entries determine the supported language union.
Creates a language broker.
The readonly list whose entries determine the supported language union.
The preferred initial language. The first supported language is used when this value is unsupported.
A non-empty list of languages accepted by set, in iteration order.
Optionalonchange: (language: SupportedLanguages[number]) => void
An optional callback invoked with the new language on every update.
Registers a listener for typed language events.
The language event type.
The listener to register.
Optionaloptions: boolean | AddEventListenerOptions
Standard DOM event listener options.
Returns the active language.
Checks whether a string is supported by this broker.
A successful check narrows the string to the inferred supported language union.
The string to check.
Returns the supported languages in constructor order.
Removes a previously registered language event listener.
The language event type.
The listener to remove.
Optionaloptions: boolean | EventListenerOptions
Standard DOM event listener options.
Updates the active language and notifies all consumers.
Languages outside the supported list are ignored at runtime.
The new active language from the supported language list.
Stores the active language and notifies consumers when it changes.
Each call to set updates the stored BCP 47 language tag, invokes the optional change callback, and dispatches a typed
changeevent.Requires the standard
EventTargetandCustomEventglobals.Example