# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
"Project-Id-Version: PACKAGE VERSION\\n"
"POT-Creation-Date: %(time)s\\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\\n"
"Language-Team: LANGUAGE <LL@li.org>\\n"
"Content-Type: text/plain; charset=CHARSET\\n"
"Content-Transfer-Encoding: ENCODING\\n"
"Generated-By: SVGHMI 1.0\\n"
def ImportMessages(self, msgs):
self.addentry("\n".join([line.text for line in msg]), msg.get("label"), msg.get("id"))
def addentry(self, msg, label, svgid):
self.__messages.setdefault(msg, set()).add(entry)
timestamp = time.strftime('%Y-%m-%d %H:%M+%Z')
print >> fp, pot_header % {'time': timestamp}
for k, v in self.__messages.items():
reverse.setdefault(tuple(keys), []).append((k, v))
d = {'label': label, 'svgid': svgid}
s = _(' %(label)s:%(svgid)d') % d
if len(locline) + len(s) <= 78:
if len(locline) > len(locpfx):
print >> fp, 'msgid', normalize(k)
print >> fp, 'msgstr ""\n'
def add(msgid, msgstr, fuzzy):
"Add a non-fuzzy translation to the dictionary."
self.__messages[msgid] = msgstr
# If we get a comment line after a msgstr, this is a new entry
if l[0] == '#' and section == STR:
self.add(msgid, msgstr, fuzzy)
if l[:2] == '#,' and 'fuzzy' in l:
# Now we are in a msgid section, output previous section
if l.startswith('msgid') and not l.startswith('msgid_plural'):
self.add(msgid, msgstr, fuzzy)
# This is a message with plural forms
elif l.startswith('msgid_plural'):
print >> sys.stderr, 'msgid_plural not preceded by msgid on %s:%d' %\
msgid += '\0' # separator of singular and plural
# Now we are in a msgstr section
elif l.startswith('msgstr'):
if l.startswith('msgstr['):
print >> sys.stderr, 'plural without msgid_plural on %s:%d' %\
msgstr += '\0' # Separator of the various plural forms
print >> sys.stderr, 'indexed msgstr required for plural on %s:%d' %\
print >> sys.stderr, 'Syntax error on %s:%d' % (infile, lno), \
self.add(msgid, msgstr, fuzzy)