Browse Source

Unify header used in POT-files

Removing header generated by pygettext so it doesn't change all the time
pull/1568/head
Safihre 5 years ago
parent
commit
f294f8c740
  1. 3
      po/main/SABnzbd.pot
  2. 18
      tools/extract_pot.py

3
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"

18
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:
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")

Loading…
Cancel
Save