(el: html.Element)
| 366 | |
| 367 | // looks for translatable attributes |
| 368 | private _visitAttributesOf(el: html.Element): void { |
| 369 | const explicitAttrNameToValue: {[k: string]: string} = {}; |
| 370 | const implicitAttrNames: string[] = this._implicitAttrs[el.name] || []; |
| 371 | |
| 372 | el.attrs |
| 373 | .filter((attr) => attr instanceof html.Attribute && attr.name.startsWith(_I18N_ATTR_PREFIX)) |
| 374 | .forEach((attr) => { |
| 375 | explicitAttrNameToValue[attr.name.slice(_I18N_ATTR_PREFIX.length)] = ( |
| 376 | attr as html.Attribute |
| 377 | ).value; |
| 378 | }); |
| 379 | |
| 380 | el.attrs.forEach((attr) => { |
| 381 | if (attr.name in explicitAttrNameToValue) { |
| 382 | this._addMessage([attr], explicitAttrNameToValue[attr.name]); |
| 383 | } else if (implicitAttrNames.some((name) => attr.name === name)) { |
| 384 | this._addMessage([attr]); |
| 385 | } |
| 386 | }); |
| 387 | } |
| 388 | |
| 389 | // add a translatable message |
| 390 | private _addMessage(ast: html.Node[], msgMeta?: string): i18n.Message | null { |
no test coverage detected