Better sort in translation files, remove unwanted headers

This commit is contained in:
Yohann D'ANELLO 2020-12-05 13:13:04 +01:00
parent 25c42ea9e8
commit 013e81b3c0
1 changed files with 6 additions and 0 deletions

View File

@ -3,6 +3,7 @@
import gettext as gt import gettext as gt
import os import os
import re
import subprocess import subprocess
from pathlib import Path from pathlib import Path
from typing import Any, List from typing import Any, List
@ -68,9 +69,14 @@ class Translator:
"--copyright-holder=ÿnérant, eichhornchen, " "--copyright-holder=ÿnérant, eichhornchen, "
"nicomarg, charlse", "nicomarg, charlse",
"--msgid-bugs-address=squirrel-battle@crans.org", "--msgid-bugs-address=squirrel-battle@crans.org",
"--sort-by-file",
"-o", file_name] "-o", file_name]
if file_name.is_file(): if file_name.is_file():
args.append("--join-existing") args.append("--join-existing")
with open(file_name, "r") as f:
content = f.read()
with open(file_name, "w") as f:
f.write(re.sub("#:.*\n", "", content))
print(f"Make {language} messages...") print(f"Make {language} messages...")
subprocess.Popen(args, stdin=find.stdout).wait() subprocess.Popen(args, stdin=find.stdout).wait()