(unit: ViewCompilationUnit, icu: t.Icu)
| 1000 | } |
| 1001 | |
| 1002 | function 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`. |
no test coverage detected