From 0c5806e12ce6461ccd048dd6626450acc09f2e05 Mon Sep 17 00:00:00 2001 From: A_D Date: Sun, 6 Jun 2021 12:35:31 +0200 Subject: [PATCH] Made json output easier to work with --- scripts/find_localised_strings.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/find_localised_strings.py b/scripts/find_localised_strings.py index 87c19825..6516b720 100644 --- a/scripts/find_localised_strings.py +++ b/scripts/find_localised_strings.py @@ -128,18 +128,19 @@ if __name__ == '__main__': print(f"No longer used: {old}") elif args.json: - to_print = json.dumps({ - str(path): [{ + to_print_data = [ + { + "path": str(path), "string": get_arg(c), "reconstructed": ast.unparse(c), "start_line": c.lineno, "start_offset": c.col_offset, "end_line": c.end_lineno, "end_offset": c.end_col_offset, - } for c in calls] for (path, calls) in res.items() if len(calls) > 0 - }, indent=2) + } for (path, calls) in res.items() for c in calls + ] - print(to_print) + print(json.dumps(to_print_data, indent=2)) elif args.lang: for path, calls in res.items():