Skip to content
Browse files

[FIX] base: ignore empty translatable attribute

Complete cd40808
  <span class="fa fa-globe" title="Title stuff"/>
is not correctly extracted but
  <span class="fa fa-globe" title=""/>
was also extracted while there is no content

Check the size of the content too

Similar content is present on website and should not be translatable
on Transifex
  • Loading branch information...
mart-e committed Mar 21, 2019
1 parent f7acbf6 commit c3ff818e13d2007d157762a7b4561517479f0676
Showing with 14 additions and 1 deletion.
  1. +13 −0 odoo/addons/base/tests/
  2. +1 −1 odoo/tools/
@@ -131,6 +131,19 @@ def test_translate_xml_inline4(self):
['Form stuff', '<span class="fa fa-globe" title="Title stuff"/>'])

def test_translate_xml_inline5(self):
""" Test xml_translate() with inline elements with empty translated attrs only. """
terms = []
source = """<form string="Form stuff">
<label for="stuff"/>
<span class="fa fa-globe" title=""/>
result = xml_translate(terms.append, source)
self.assertEquals(result, source)
self.assertItemsEqual(terms, ['Form stuff'])

def test_translate_xml_t(self):
""" Test xml_translate() with t-* attributes. """
terms = []
@@ -257,7 +257,7 @@ def process(node):
result.tail = node.tail
has_text = (
todo_has_text or nonspace(result.text) or nonspace(result.tail)
or any(name in TRANSLATED_ATTRS for name in result.attrib)
or any((key in TRANSLATED_ATTRS and val) for key, val in result.attrib.items())
return (has_text, result)

0 comments on commit c3ff818

Please sign in to comment.
You can’t perform that action at this time.