diff --git a/scripts/sync_translations.py b/scripts/sync_translations.py index 9322d944..5c69e645 100644 --- a/scripts/sync_translations.py +++ b/scripts/sync_translations.py @@ -21,7 +21,8 @@ data = json.load(f) for fid, samples in data.items(): if samples: - samples = [s for s in samples if s] # s may be None + samples = [s.strip() for s in samples + if s and s.strip() != "[UNUSED]"] # s may be None with open(f"{locale}/{lang}/{fid}", "w") as f: f.write("\n".join(sorted(samples))) @@ -30,7 +31,8 @@ data = json.load(f) for fid, samples in data.items(): if samples: - samples = [s for s in samples if s] # s may be None + samples = [s.strip() for s in samples + if s and s.strip() != "[UNUSED]"] # s may be None with open(f"{locale}/{lang}/{fid}", "w") as f: f.write("\n".join(sorted(samples))) @@ -39,7 +41,8 @@ data = json.load(f) for fid, samples in data.items(): if samples: - samples = [s for s in samples if s] # s may be None + samples = [s.strip() for s in samples + if s and s.strip() != "[UNUSED]"] # s may be None with open(f"{locale}/{lang}/{fid}", "w") as f: f.write("\n".join(sorted(samples))) @@ -48,7 +51,8 @@ data = json.load(f) for fid, samples in data.items(): if samples: - samples = [s for s in samples if s] # s may be None + samples = [s.strip() for s in samples + if s and s.strip() != "[UNUSED]"] # s may be None with open(f"{locale}/{lang}/{fid}", "w") as f: f.write("\n".join(sorted(samples)))