From cba7aee8745541aa8fb0a8669e838d21c6a6a171 Mon Sep 17 00:00:00 2001 From: A_D Date: Thu, 10 Jun 2021 01:09:13 +0200 Subject: [PATCH] Fixed printed file line number sometimes off by one --- scripts/find_localised_strings.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/find_localised_strings.py b/scripts/find_localised_strings.py index 2bfc6b8b..5c43b458 100644 --- a/scripts/find_localised_strings.py +++ b/scripts/find_localised_strings.py @@ -84,7 +84,7 @@ def extract_comments(call: ast.Call, lines: list[str], file: pathlib.Path) -> Op comment = match.group(1).strip() if not comment.startswith('# LANG:'): - bad_comment = f'Unknown comment for {file}:{current} {line}' + bad_comment = f'Unknown comment for {file}:{call.lineno} {line}' continue out = comment.replace('# LANG:', '').strip() @@ -95,7 +95,7 @@ def extract_comments(call: ast.Call, lines: list[str], file: pathlib.Path) -> Op print(bad_comment, file=sys.stderr) if out is None: - print(f'No comment for {file}:{current} {line}', file=sys.stderr) + print(f'No comment for {file}:{call.lineno} {line}', file=sys.stderr) return out