comparison roundup/cgi/TAL/talgettext.py @ 2385:85cbfc4a5946

escape newlines
author Alexander Smishlajev <a1s@users.sourceforge.net>
date Sat, 29 May 2004 07:16:51 +0000
parents c7a05bddd453
children e816a232f988
comparison
equal deleted inserted replaced
2384:33469189bf86 2385:85cbfc4a5946
12 # FOR A PARTICULAR PURPOSE. 12 # FOR A PARTICULAR PURPOSE.
13 # 13 #
14 ############################################################################## 14 ##############################################################################
15 # Modifications for Roundup: 15 # Modifications for Roundup:
16 # 1. commented out ITALES references 16 # 1. commented out ITALES references
17 # 2. escape quotes in msgids 17 # 2. escape quotes and line feeds in msgids
18 18
19 """Program to extract internationalization markup from Page Templates. 19 """Program to extract internationalization markup from Page Templates.
20 20
21 Once you have marked up a Page Template file with i18n: namespace tags, use 21 Once you have marked up a Page Template file with i18n: namespace tags, use
22 this program to extract GNU gettext .po file entries. 22 this program to extract GNU gettext .po file entries.
41 from roundup.cgi.TAL.TALInterpreter import TALInterpreter 41 from roundup.cgi.TAL.TALInterpreter import TALInterpreter
42 from roundup.cgi.TAL.DummyEngine import DummyEngine 42 from roundup.cgi.TAL.DummyEngine import DummyEngine
43 #from ITALES import ITALESEngine 43 #from ITALES import ITALESEngine
44 from roundup.cgi.TAL.TALDefs import TALESError 44 from roundup.cgi.TAL.TALDefs import TALESError
45 45
46 __version__ = '$Revision: 1.4 $' 46 __version__ = '$Revision: 1.5 $'
47 47
48 pot_header = '''\ 48 pot_header = '''\
49 # SOME DESCRIPTIVE TITLE. 49 # SOME DESCRIPTIVE TITLE.
50 # Copyright (C) YEAR ORGANIZATION 50 # Copyright (C) YEAR ORGANIZATION
51 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. 51 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
303 for msgid in msgids: 303 for msgid in msgids:
304 positions = catalog[msgid] 304 positions = catalog[msgid]
305 for filename, position in positions: 305 for filename, position in positions:
306 outfile.write('#: %s:%s\n' % (filename, position[0])) 306 outfile.write('#: %s:%s\n' % (filename, position[0]))
307 307
308 outfile.write('msgid "%s"\n' % msgid.replace('"', '\\"')) 308 outfile.write('msgid "%s"\n'
309 % msgid.replace('"', '\\"').replace("\n", '\\n"\n"'))
309 outfile.write('msgstr ""\n') 310 outfile.write('msgstr ""\n')
310 outfile.write('\n') 311 outfile.write('\n')
311 312
312 313
313 if __name__ == '__main__': 314 if __name__ == '__main__':

Roundup Issue Tracker: http://roundup-tracker.org/