|
|
@ -140,26 +140,22 @@ os.system(cmd) |
|
|
|
print("Finished creating POT file") |
|
|
|
|
|
|
|
print("Post-process POT file") |
|
|
|
src = open("%s/%s.pot.tmp" % (PO_DIR, DOMAIN), "r") |
|
|
|
dst = open("%s/%s.pot" % (PO_DIR, DOMAIN), "w") |
|
|
|
dst.write(HEADER.replace("__TYPE__", "MAIN")) |
|
|
|
header = True |
|
|
|
|
|
|
|
for line in src: |
|
|
|
with open("%s/%s.pot.tmp" % (PO_DIR, DOMAIN), "r") as source_pot, open("%s/%s.pot" % (PO_DIR, DOMAIN), "w") as dest_pot: |
|
|
|
dest_pot.write(HEADER.replace("__TYPE__", "MAIN")) |
|
|
|
header = True |
|
|
|
for line in source_pot: |
|
|
|
if line.startswith("#:"): |
|
|
|
line = line.replace("\\", "/") |
|
|
|
if header: |
|
|
|
dst.write("\n\n") |
|
|
|
dest_pot.write("\n") |
|
|
|
header = False |
|
|
|
if header: |
|
|
|
if not ('"POT-Creation-Date:' in line or '"Generated-By:' in line): |
|
|
|
# Skip header generated by pygettext |
|
|
|
continue |
|
|
|
elif line.startswith("#:"): |
|
|
|
line = get_context(line) |
|
|
|
dst.write(line) |
|
|
|
dest_pot.write(line) |
|
|
|
|
|
|
|
src.close() |
|
|
|
dst.close() |
|
|
|
os.remove("%s/%s.pot.tmp" % (PO_DIR, DOMAIN)) |
|
|
|
print("Finished post-process POT file") |
|
|
|
|
|
|
|