useL10n
A React Hook to dynamically load translations and locale data for a runner.
Signature
useL10n(
initial: IL10n | undefined,
onL10n: ((l10n: IL10n) => Promise<void>) | undefined,
runner: {
l10n: L10n.Namespace;
update: () => void;
},
purgeCache?: () => void
): [IL10n, (l10n: IL10n) => void, (language?: string) => void]
Parameters
Name | Type | Optional | Description |
---|---|---|---|
initial | IL10n | undefined | No | Specifies the initial translations and locale data for the runner. |
onL10n | ((l10n: IL10n ) => Promise<void> ) | undefined | No | Function that is invoked when an update of the translations or locale data is requested. |
runner | object | No | Reference to the runner. |
purgeCache | () => void | Yes | Function that is invoked when new translations or locale data is loaded. |
Return value
Returns a tuple with the current IL10n
object, a function to update the IL10n
object, and a function to change the language of the runner.