summaryrefslogtreecommitdiff
path: root/bin/tools/translate.py
diff options
context:
space:
mode:
authorP. Christeas <p_christ@hol.gr>2010-12-29 13:33:34 +0200
committerP. Christeas <p_christ@hol.gr>2010-12-29 13:33:34 +0200
commitbcb7335027e447f2fde441ed8e857e7fa9760461 (patch)
treefaf407b6ba682508d5c2d49da12c70269b4dd47c /bin/tools/translate.py
parentb0e2c850651b476108b287a1126d63be29ffe5fd (diff)
tools/translate: don't export comments and PI nodes for translation
We are not going to display them to user, so let the teams skip those strings. bzr revid: p_christ@hol.gr-20101229113334-71fe2bnw1dra167q
Diffstat (limited to 'bin/tools/translate.py')
-rw-r--r--bin/tools/translate.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/bin/tools/translate.py b/bin/tools/translate.py
index 8cf09f96fef..6b7a0600956 100644
--- a/bin/tools/translate.py
+++ b/bin/tools/translate.py
@@ -468,12 +468,16 @@ def trans_export(lang, modules, buffer, format, dbname=None):
_process(format, modules, trans, buffer, lang, newlang)
del trans
+# We'd better not import orm here, so copy this from osv.orm:
+SKIPPED_ELEMENT_TYPES = (etree._Comment, etree._ProcessingInstruction, etree.CommentBase, etree.PIBase)
def trans_parse_xsl(de):
res = []
for n in de:
if n.get("t"):
- for m in [j for j in n if j.text]:
+ for m in n:
+ if isinstance(m, SKIPPED_ELEMENT_TYPES) or not m.text:
+ continue
l = m.text.strip().replace('\n',' ')
if len(l):
res.append(l.encode("utf8"))
@@ -483,7 +487,9 @@ def trans_parse_xsl(de):
def trans_parse_rml(de):
res = []
for n in de:
- for m in [j for j in n if j.text]:
+ for m in n:
+ if isinstance(m, SKIPPED_ELEMENT_TYPES) or not m.text:
+ continue
string_list = [s.replace('\n', ' ').strip() for s in re.split('\[\[.+?\]\]', m.text)]
for s in string_list:
if s: