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

Method merge

packages/compiler/src/i18n/extractor_merger.ts:121–144  ·  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 nodes,
130 false,
131 undefined!,
132 undefined!,
133 undefined,
134 false,
135 );
136
137 const translatedNode = wrapper.visit(this, null);
138
139 if (this._inI18nBlock) {
140 this._reportError(nodes[nodes.length - 1], 'Unclosed block');
141 }
142
143 return new ParseTreeResult(translatedNode.children, this._errors);
144 }
145
146 visitExpansionCase(icuCase: html.ExpansionCase, context: any): any {
147 // 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