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