* Process the given i18n node for serialization. * Returns the first RNode for the i18n node to begin hydration.
( lView: LView, serializedI18nBlock: SerializedI18nBlock, context: HydrationContext, node: I18nNode, )
| 249 | * Returns the first RNode for the i18n node to begin hydration. |
| 250 | */ |
| 251 | function serializeI18nNode( |
| 252 | lView: LView, |
| 253 | serializedI18nBlock: SerializedI18nBlock, |
| 254 | context: HydrationContext, |
| 255 | node: I18nNode, |
| 256 | ): Node | null { |
| 257 | const maybeRNode = unwrapRNode(lView[node.index]!); |
| 258 | if (!maybeRNode || isDisconnectedRNode(maybeRNode)) { |
| 259 | serializedI18nBlock.disconnectedNodes.add(node.index - HEADER_OFFSET); |
| 260 | return null; |
| 261 | } |
| 262 | |
| 263 | const rNode = maybeRNode as Node; |
| 264 | switch (node.kind) { |
| 265 | case I18nNodeKind.TEXT: { |
| 266 | processTextNodeBeforeSerialization(context, rNode); |
| 267 | break; |
| 268 | } |
| 269 | |
| 270 | case I18nNodeKind.ELEMENT: |
| 271 | case I18nNodeKind.PLACEHOLDER: { |
| 272 | serializeI18nBlock(lView, serializedI18nBlock, context, node.children); |
| 273 | break; |
| 274 | } |
| 275 | |
| 276 | case I18nNodeKind.ICU: { |
| 277 | const currentCase = lView[node.currentCaseLViewIndex] as number | null; |
| 278 | if (currentCase != null) { |
| 279 | // i18n uses a negative value to signal a change to a new case, so we |
| 280 | // need to invert it to get the proper value. |
| 281 | const caseIdx = currentCase < 0 ? ~currentCase : currentCase; |
| 282 | serializedI18nBlock.caseQueue.push(caseIdx); |
| 283 | serializeI18nBlock(lView, serializedI18nBlock, context, node.cases[caseIdx]); |
| 284 | } |
| 285 | break; |
| 286 | } |
| 287 | } |
| 288 | |
| 289 | return getFirstNativeNodeForI18nNode(lView, node) as Node | null; |
| 290 | } |
| 291 | |
| 292 | /** |
| 293 | * Helper function to get the first native node to begin hydrating |
no test coverage detected
searching dependent graphs…