Translation
For new applications, prefer using TEW integration for translation.
getTranslation(componentName)
Returns a promise that resolves with the translation object for the given component name.
Usage: window.e.utils.v2.translation.getTranslation(componentName)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
componentName | string | yes | Name of the component to get translations for |
Example
const translations = await window.e.utils.v2.translation.getTranslation('event-content-decision');
const translatedTitle = translations['event-content-decision'].title;
getTranslations(componentNames)
Same as getTranslation but accepts an array of multiple component names and returns translations for all of them.
Usage: window.e.utils.v2.translation.getTranslations(componentNames)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
componentNames | string[] | yes | Array of component names |
Example
const translations = await window.e.utils.v2.translation.getTranslations([
'example',
'event-content-decision'
]);
const title = translations['example'].title;