LoadTranslations

The LoadTranslations function is used to dynamically load or reload translation resources for specified languages and namespaces within the application. This function is essential for multi-lingual applications, allowing the dashboard to update its displayed language content without a full page refresh.

As this is a Function, it inherits all the common parameters and outgoing triggers from the base Function component.

Parameters

Key Description Default value Possible values
$languages An array of language codes (e.g., ['en', 'fr']) to load or reload. This parameter is mandatory. undefined array of string
$namespaces An array of namespaces (e.g., ['common', 'dashboard']) to load translations from. These namespaces will be loaded for any languages in $languages that are not yet loaded. If not provided, all available namespaces for these newly loaded languages will be loaded. [] array of string

Outgoing Triggers

Type: translationsLoaded

Fires when the translations have been successfully loaded or reloaded.

Additional event properties (besides the inherited properties):

Key Description Possible values
languages An array of language codes that were loaded. array of string
namespaces An array of namespaces that were loaded. array of string