* Returns a tree where all translatable nodes are translated
(nodes: html.Node[], translations: TranslationBundle)
| 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 |
no test coverage detected