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

Class LocalizeMessageStringVisitor

packages/compiler/src/i18n/i18n_ast.ts:289–322  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

287}
288
289class LocalizeMessageStringVisitor implements Visitor {
290 visitText(text: Text): any {
291 return text.value;
292 }
293
294 visitContainer(container: Container): any {
295 return container.children.map((child) => child.visit(this)).join('');
296 }
297
298 visitIcu(icu: Icu): any {
299 const strCases = Object.keys(icu.cases).map(
300 (k: string) => `${k} {${icu.cases[k].visit(this)}}`,
301 );
302 return `{${icu.expressionPlaceholder}, ${icu.type}, ${strCases.join(' ')}}`;
303 }
304
305 visitTagPlaceholder(ph: TagPlaceholder): any {
306 const children = ph.children.map((child) => child.visit(this)).join('');
307 return `{$${ph.startName}}${children}{$${ph.closeName}}`;
308 }
309
310 visitPlaceholder(ph: Placeholder): any {
311 return `{$${ph.name}}`;
312 }
313
314 visitIcuPlaceholder(ph: IcuPlaceholder): any {
315 return `{$${ph.name}}`;
316 }
317
318 visitBlockPlaceholder(ph: BlockPlaceholder): any {
319 const children = ph.children.map((child) => child.visit(this)).join('');
320 return `{$${ph.startName}}${children}{$${ph.closeName}}`;
321 }
322}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected