From 2d4686660cb670fda2142b4579471f2398b83c2f Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Thu, 10 Dec 2009 12:08:26 +0100 Subject: [PATCH] [FIX] handle the case of missing "#:" formated comment in po files bzr revid: chs@tinyerp.com-20091210110826-he983jrra2tr4sfo --- bin/tools/translate.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bin/tools/translate.py b/bin/tools/translate.py index 7aa96ece5d4..2ce2d4fccf2 100644 --- a/bin/tools/translate.py +++ b/bin/tools/translate.py @@ -152,8 +152,12 @@ _ = GettextAlias() # class to handle po files class TinyPoFile(object): def __init__(self, buffer): + self.logger = netsvc.Logger() self.buffer = buffer + def warn(self, msg): + self.logger.notifyChannel("i18n", netsvc.LOG_WARNING, msg) + def __iter__(self): self.buffer.seek(0) self.lines = self._get_lines() @@ -228,6 +232,10 @@ class TinyPoFile(object): self.tnrs.append((t, n, r, source, trad)) self.first = False + + if name is None: + self.warn('Missing "#:" formated comment for the following source:\n\t%s' % (source,)) + return self.next() return type, name, res_id, source, trad def write_infos(self, modules):