MCPcopy
hub / github.com/angular/angular / loadTranslations

Function loadTranslations

packages/localize/src/translate.ts:64–75  ·  view source on GitHub ↗
(translations: Record<MessageId, TargetMessage>)

Source from the content-addressed store, hash-verified

62 * @publicApi
63 */
64export 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.

Callers 7

i18n_spec.tsFile · 0.90
hmr_spec.tsFile · 0.90
content_spec.tsFile · 0.90
translate_spec.tsFile · 0.85

Calls 3

parseTranslationFunction · 0.90
keysMethod · 0.65
forEachMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…