diff --git a/odoo/tools/translate.py b/odoo/tools/translate.py index 3c031f3d277..5561aa082c7 100644 --- a/odoo/tools/translate.py +++ b/odoo/tools/translate.py @@ -159,7 +159,7 @@ def translate_xml_node(node, callback, parse, serialize): """ def nonspace(text): - return bool(text) and not text.isspace() + return bool(text) and len(re.sub(r'\W+', '', text)) > 1 def concat(text1, text2): return text2 if text1 is None else text1 + (text2 or "") @@ -810,14 +810,6 @@ def trans_generate(lang, modules, cr): # empty and one-letter terms are ignored, they probably are not meant to be # translated, and would be very hard to translate anyway. sanitized_term = (source or '').strip() - try: - # verify the minimal size without eventual xml tags - # wrap to make sure html content like 'bd' is accepted by lxml - wrapped = u"
%s
" % sanitized_term - node = etree.fromstring(wrapped) - sanitized_term = etree.tostring(node, encoding='unicode', method='text') - except etree.ParseError: - pass # remove non-alphanumeric chars sanitized_term = re.sub(r'\W+', '', sanitized_term) if not sanitized_term or len(sanitized_term) <= 1: