equal
deleted
inserted
replaced
24 for match in re.finditer('i18n:(content|replace)="([^"]+)"', open(filepath).read()): |
24 for match in re.finditer('i18n:(content|replace)="([^"]+)"', open(filepath).read()): |
25 print >> output, '_("%s")' % match.group(2) |
25 print >> output, '_("%s")' % match.group(2) |
26 output.close() |
26 output.close() |
27 |
27 |
28 |
28 |
29 def add_msg(w, msgid): |
29 def add_msg(w, msgid, msgctx=None): |
30 """write an empty pot msgid definition""" |
30 """write an empty pot msgid definition""" |
31 if isinstance(msgid, unicode): |
31 if isinstance(msgid, unicode): |
32 msgid = msgid.encode('utf-8') |
32 msgid = msgid.encode('utf-8') |
|
33 if msgctx: |
|
34 if isinstance(msgctx, unicode): |
|
35 msgctx = msgctx.encode('utf-8') |
|
36 w('msgctxt "%s"\n' % msgctx) |
33 msgid = msgid.replace('"', r'\"').splitlines() |
37 msgid = msgid.replace('"', r'\"').splitlines() |
34 if len(msgid) > 1: |
38 if len(msgid) > 1: |
35 w('msgid ""\n') |
39 w('msgid ""\n') |
36 for line in msgid: |
40 for line in msgid: |
37 w('"%s"' % line.replace('"', r'\"')) |
41 w('"%s"' % line.replace('"', r'\"')) |