- input = open(src)
- for lineno, line in enumerate(input.readlines()):
- if Style.match(line):
- (string,) = Style.match(line).groups()
+ readingDescription = False
+ descStartLine = -1
+ descLines = []
+ lineno = 0
+ for line in open(src).readlines():
+ lineno += 1
+ if readingDescription:
+ res = DescEnd.search(line)
+ if res != None:
+ readingDescription = False
+ desc = " ".join(descLines)
+ print >> out, '#: %s:%d\nmsgid "%s"\nmsgstr ""\n' % \
+ (relativePath(src, base), lineno + 1, desc)
+ continue
+ descLines.append(line[1:].strip())
+ continue
+ res = DescBegin.search(line)
+ if res != None:
+ readingDescription = True
+ descStartLine = lineno
+ continue
+ res = NameRE.search(line)
+ if res != None:
+ string = res.group(1)
+ string = string.replace('\\', '\\\\').replace('"', '')
+ if string != "":
+ print >> out, '#: %s:%d\nmsgid "%s"\nmsgstr ""\n' % \
+ (relativePath(src, base), lineno + 1, string)
+ continue
+ res = Style.search(line)
+ if res != None:
+ string = res.group(1)