wiki-archive/twiki/pub/TWiki/KupuContrib/_kupu/kupu-i18nextract-sa-diff.patch

34 lines
1.3 KiB
Diff
Raw Normal View History

? kupu-i18nextract-sa-diff.patch
Index: zope/app/locales/extract.py
===================================================================
RCS file: /cvs/infrae-internal/i18nextract-sa/zope/app/locales/extract.py,v
retrieving revision 1.2
diff --unified -r1.2 extract.py
--- zope/app/locales/extract.py 18 Nov 2004 14:28:27 -0000 1.2
+++ zope/app/locales/extract.py 3 Aug 2005 14:08:59 -0000
@@ -289,16 +289,22 @@
# right sys path until app_dir has run
from zope.tal.talgettext import POEngine, POTALInterpreter
from zope.tal.htmltalparser import HTMLTALParser
+ from zope.tal.talparser import TALParser
engine = POEngine()
class Devnull(object):
def write(self, s):
pass
- for filename in find_files(dir, '*.pt'):
+ for filename in (find_files(dir, '*.pt') + find_files(dir, '*.kupu') +
+ find_files(dir, '*.pox') + find_files(dir, '*.xsl')):
try:
engine.file = filename
- p = HTMLTALParser()
+ name, ext = os.path.splitext(filename)
+ if ext in ['.pt', '.html']:
+ p = HTMLTALParser()
+ else:
+ p = TALParser()
p.parseFile(filename)
program, macros = p.getCode()
POTALInterpreter(program, macros, engine, stream=Devnull(),