:rtype: ``iterator``
"""
result = []
- def handle_text(text, lineno, name=None):
+ def handle_text(text, lineno):
text = (text or "").strip()
- if len(text) > 1 or name in ['accesskey']:
- # Avoid mono-char tokens like ':' ',' etc but keep accesskeys
+ if len(text) > 1: # Avoid mono-char tokens like ':' ',' etc.
result.append((lineno, None, text, [TRANSLATION_FLAG_COMMENT]))
# not using elementTree.iterparse because we need to skip sub-trees in case
if "t-js" not in el.attrib and \
not ("t-jquery" in el.attrib and "t-operation" not in el.attrib) and \
not ("t-translation" in el.attrib and el.attrib["t-translation"].strip() == "off"):
- handle_text(el.text, el.sourceline, el.tag)
- for att in ('title', 'alt', 'label', 'placeholder', 'accesskey'):
+ handle_text(el.text, el.sourceline)
+ for att in ('title', 'alt', 'label'):
if att in el.attrib:
- handle_text(el.attrib[att], el.sourceline, att)
+ handle_text(el.attrib[att], el.sourceline)
iter_elements(el)
handle_text(el.tail, el.sourceline)