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