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

Method merge

packages/compiler/src/i18n/extractor_merger.ts:121–145  ·  view source on GitHub ↗

* Returns a tree where all translatable nodes are translated

(nodes: html.Node[], translations: TranslationBundle)

Source from the content-addressed store, hash-verified

119 * Returns a tree where all translatable nodes are translated
120 */
121 merge(nodes: html.Node[], translations: TranslationBundle): ParseTreeResult {
122 this._init(_VisitorMode.Merge);
123 this._translations = translations;
124
125 // Construct a single fake root element
126 const wrapper = new html.Element(
127 'wrapper',
128 [],
129 [],
130 nodes,
131 false,
132 undefined!,
133 undefined!,
134 undefined,
135 false,
136 );
137
138 const translatedNode = wrapper.visit(this, null);
139
140 if (this._inI18nBlock) {
141 this._reportError(nodes[nodes.length - 1], 'Unclosed block');
142 }
143
144 return new ParseTreeResult(translatedNode.children, this._errors);
145 }
146
147 visitExpansionCase(icuCase: html.ExpansionCase, context: any): any {
148 // Parse cases for translatable html attributes

Callers 2

mergeTranslationsFunction · 0.95
addMetadataFunction · 0.45

Calls 3

_initMethod · 0.95
visitMethod · 0.95
_reportErrorMethod · 0.95

Tested by

no test coverage detected