From b8dddbbfacc396a7ebc44e85f922d01571d59447 Mon Sep 17 00:00:00 2001 From: miro Date: Thu, 16 May 2024 22:30:37 +0100 Subject: [PATCH] translations/allow_UNUSED_keywords --- scripts/sync_translations.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/sync_translations.py b/scripts/sync_translations.py index 9322d94..5c69e64 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)))