diff --git a/po/main/SABnzbd.pot b/po/main/SABnzbd.pot index 6a630f2..5a45445 100644 --- a/po/main/SABnzbd.pot +++ b/po/main/SABnzbd.pot @@ -12,9 +12,6 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2020-06-27 23:06+0200\n" -"Generated-By: pygettext.py 1.5\n" - #: SABnzbd.py [Error message] msgid "Failed to start web-interface" diff --git a/tools/extract_pot.py b/tools/extract_pot.py index 3fe1ed0..ab7280b 100755 --- a/tools/extract_pot.py +++ b/tools/extract_pot.py @@ -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: - if line.startswith("#:"): - line = line.replace("\\", "/") +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: + dest_pot.write("\n") + header = False if header: - dst.write("\n\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) + elif line.startswith("#:"): + line = get_context(line) + dest_pot.write(line) -src.close() -dst.close() os.remove("%s/%s.pot.tmp" % (PO_DIR, DOMAIN)) print("Finished post-process POT file")