MCPcopy Index your code
hub / github.com/angular/angular / visitLocalizedString

Function visitLocalizedString

packages/compiler/src/output/abstract_js_emitter.ts:90–111  ·  view source on GitHub ↗
(ast: o.LocalizedString, ctx: EmitterVisitorContext)

Source from the content-addressed store, hash-verified

88 }
89
90 override visitLocalizedString(ast: o.LocalizedString, ctx: EmitterVisitorContext): void {
91 // The following convoluted piece of code is effectively the downlevelled equivalent of
92 // ```
93 // $localize `...`
94 // ```
95 // which is effectively like:
96 // ```
97 // $localize(__makeTemplateObject(cooked, raw), expression1, expression2, ...);
98 // ```
99 ctx.print(ast, `$localize(${makeTemplateObjectPolyfill}(`);
100 const parts = [ast.serializeI18nHead()];
101 for (let i = 1; i < ast.messageParts.length; i++) {
102 parts.push(ast.serializeI18nTemplatePart(i));
103 }
104 ctx.print(ast, `[${parts.map((part) => escapeIdentifier(part.cooked)).join(', ')}], `);
105 ctx.print(ast, `[${parts.map((part) => escapeIdentifier(part.raw)).join(', ')}])`);
106 ast.expressions.forEach((expression) => {
107 ctx.print(ast, ', ');
108 expression.visitExpression(this, ctx);
109 });
110 ctx.print(ast, ')');
111 }
112}

Callers

nothing calls this directly

Calls 9

escapeIdentifierFunction · 0.90
serializeI18nHeadMethod · 0.80
mapMethod · 0.80
joinMethod · 0.65
printMethod · 0.45
pushMethod · 0.45
forEachMethod · 0.45
visitExpressionMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…