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

Function ingestIcu

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

Source from the content-addressed store, hash-verified

1000}
1001
1002function ingestIcu(unit: ViewCompilationUnit, icu: t.Icu) {
1003 if (icu.i18n instanceof i18n.Message && isSingleI18nIcu(icu.i18n)) {
1004 const xref = unit.job.allocateXrefId();
1005 unit.create.push(ir.createIcuStartOp(xref, icu.i18n, icuFromI18nMessage(icu.i18n).name, null!));
1006 for (const [placeholder, text] of Object.entries({...icu.vars, ...icu.placeholders})) {
1007 if (text instanceof t.BoundText) {
1008 ingestBoundText(unit, text, placeholder);
1009 } else {
1010 ingestText(unit, text, placeholder);
1011 }
1012 }
1013 unit.create.push(ir.createIcuEndOp(xref));
1014 } else {
1015 throw Error(`Unhandled i18n metadata type for ICU: ${icu.i18n?.constructor.name}`);
1016 }
1017}
1018
1019/**
1020 * 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