(translations: Record<MessageId, TargetMessage>)
| 62 | * @publicApi |
| 63 | */ |
| 64 | export function loadTranslations(translations: Record<MessageId, TargetMessage>) { |
| 65 | // Ensure the translate function exists |
| 66 | if (!$localize.translate) { |
| 67 | $localize.translate = translate; |
| 68 | } |
| 69 | if (!$localize.TRANSLATIONS) { |
| 70 | $localize.TRANSLATIONS = {}; |
| 71 | } |
| 72 | Object.keys(translations).forEach((key) => { |
| 73 | $localize.TRANSLATIONS[key] = parseTranslation(translations[key]); |
| 74 | }); |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * Remove all translations for `$localize`, if doing runtime translation. |
no test coverage detected
searching dependent graphs…