From d5a9450d72e487d2abec5231888dbc4e60dec062 Mon Sep 17 00:00:00 2001 From: Gaetan Delannay Date: Wed, 26 Mar 2014 14:01:03 +0100 Subject: [PATCH] [gen] Bugfixin the sync of i18n files; allow to include XHTML within messages in Appy popups. --- gen/generator.py | 5 +++-- gen/po.py | 5 +++++ gen/wrappers/__init__.py | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/gen/generator.py b/gen/generator.py index 39dde64..67cc99b 100644 --- a/gen/generator.py +++ b/gen/generator.py @@ -449,8 +449,9 @@ class ZopeGenerator(Generator): baseLabels = po.PoParser(appyPoFileName).parse().messages else: baseLabels = appyLabels - poFile.update(baseLabels + self.labels.get(), - self.options.i18nClean, keepExistingOrder=False) + poFile.update(baseLabels + self.labels.get() + \ + potFile.getCustomMessages(), self.options.i18nClean, + keepExistingOrder=False) poFile.generate() # Generate corresponding fields on the Translation class page = '1' diff --git a/gen/po.py b/gen/po.py index a1c0152..2d5bf03 100644 --- a/gen/po.py +++ b/gen/po.py @@ -276,6 +276,11 @@ class PoFile: res = '%s-%s-%s.po' % (self.applicationName, self.domain, language) return res + def getCustomMessages(self): + '''Returns, the list of messages from self.messages whose ID starts with + "custom_".''' + return [m for m in self.messages if m.id.startswith('custom_')] + class PoParser: '''Allows to parse a i18n file. The result is produced in self.res as a PoFile instance.''' diff --git a/gen/wrappers/__init__.py b/gen/wrappers/__init__.py index c47b5d6..7579d49 100644 --- a/gen/wrappers/__init__.py +++ b/gen/wrappers/__init__.py @@ -570,7 +570,7 @@ class AbstractWrapper(object): layoutTarget=obj">:tool.pxLayoutedObject :tool.pxPageBottom ''', template=pxTemplate, hook='content')