(el: html.Element | html.Component)
| 394 | |
| 395 | // looks for translatable attributes |
| 396 | private _visitAttributesOf(el: html.Element | html.Component): void { |
| 397 | const explicitAttrNameToValue: {[k: string]: string} = {}; |
| 398 | const implicitAttrNames: string[] = |
| 399 | this._implicitAttrs[el instanceof html.Component ? el.tagName || '' : el.name] || []; |
| 400 | |
| 401 | el.attrs |
| 402 | .filter((attr) => attr instanceof html.Attribute && attr.name.startsWith(_I18N_ATTR_PREFIX)) |
| 403 | .forEach((attr) => { |
| 404 | explicitAttrNameToValue[attr.name.slice(_I18N_ATTR_PREFIX.length)] = ( |
| 405 | attr as html.Attribute |
| 406 | ).value; |
| 407 | }); |
| 408 | |
| 409 | el.attrs.forEach((attr) => { |
| 410 | if (attr.name in explicitAttrNameToValue) { |
| 411 | this._addMessage([attr], explicitAttrNameToValue[attr.name]); |
| 412 | } else if (implicitAttrNames.some((name) => attr.name === name)) { |
| 413 | this._addMessage([attr]); |
| 414 | } |
| 415 | }); |
| 416 | } |
| 417 | |
| 418 | // add a translatable message |
| 419 | private _addMessage(ast: html.Node[], msgMeta?: string): i18n.Message | null { |
no test coverage detected