MCPcopy Create free account
hub / github.com/angular/angular / ingestIcu

Function ingestIcu

packages/compiler/src/template/pipeline/src/ingest.ts:886–901  ·  view source on GitHub ↗
(unit: ViewCompilationUnit, icu: t.Icu)

Source from the content-addressed store, hash-verified

884}
885
886function ingestIcu(unit: ViewCompilationUnit, icu: t.Icu) {
887 if (icu.i18n instanceof i18n.Message && isSingleI18nIcu(icu.i18n)) {
888 const xref = unit.job.allocateXrefId();
889 unit.create.push(ir.createIcuStartOp(xref, icu.i18n, icuFromI18nMessage(icu.i18n).name, null!));
890 for (const [placeholder, text] of Object.entries({...icu.vars, ...icu.placeholders})) {
891 if (text instanceof t.BoundText) {
892 ingestBoundText(unit, text, placeholder);
893 } else {
894 ingestText(unit, text, placeholder);
895 }
896 }
897 unit.create.push(ir.createIcuEndOp(xref));
898 } else {
899 throw Error(`Unhandled i18n metadata type for ICU: ${icu.i18n?.constructor.name}`);
900 }
901}
902
903/**
904 * Ingest an `@for` block into the given `ViewCompilation`.

Callers 1

ingestNodesFunction · 0.85

Calls 7

icuFromI18nMessageFunction · 0.90
isSingleI18nIcuFunction · 0.85
ingestBoundTextFunction · 0.85
ingestTextFunction · 0.85
ErrorInterface · 0.85
pushMethod · 0.45
entriesMethod · 0.45

Tested by

no test coverage detected