(
nodes: html.Node[],
meaning = '',
description = '',
customId = '',
visitNodeFn: VisitNodeFn | undefined,
)
| 70 | ) {} |
| 71 | |
| 72 | public toI18nMessage( |
| 73 | nodes: html.Node[], |
| 74 | meaning = '', |
| 75 | description = '', |
| 76 | customId = '', |
| 77 | visitNodeFn: VisitNodeFn | undefined, |
| 78 | ): i18n.Message { |
| 79 | const context: I18nMessageVisitorContext = { |
| 80 | isIcu: nodes.length == 1 && nodes[0] instanceof html.Expansion, |
| 81 | icuDepth: 0, |
| 82 | placeholderRegistry: new PlaceholderRegistry(), |
| 83 | placeholderToContent: {}, |
| 84 | placeholderToMessage: {}, |
| 85 | visitNodeFn: visitNodeFn || noopVisitNodeFn, |
| 86 | }; |
| 87 | |
| 88 | const i18nodes: i18n.Node[] = html.visitAll(this, nodes, context); |
| 89 | |
| 90 | return new i18n.Message( |
| 91 | i18nodes, |
| 92 | context.placeholderToContent, |
| 93 | context.placeholderToMessage, |
| 94 | meaning, |
| 95 | description, |
| 96 | customId, |
| 97 | ); |
| 98 | } |
| 99 | |
| 100 | visitElement(el: html.Element, context: I18nMessageVisitorContext): i18n.Node { |
| 101 | return this._visitElementLike(el, context); |
no test coverage detected