From 92ef6bc3ff030d43ecb85611f59ac8afc4d67ac8 Mon Sep 17 00:00:00 2001 From: josteph Date: Wed, 26 Dec 2018 19:06:29 +0000 Subject: [PATCH] pofix: Strip msgstr's when checking for duplicate msgid's --- utils/pofix.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/pofix.py b/utils/pofix.py index 7eb4416538f..7cc3820f8d9 100755 --- a/utils/pofix.py +++ b/utils/pofix.py @@ -297,6 +297,7 @@ except ImportError: def process_file(path): before = io.open(path, "r", encoding="utf-8").read() decommented = re.sub("#.*", "", before) + decommented_msgids = re.sub(r'^msgstr .*?' + '\n\n', '', decommented, flags = re.MULTILINE | re.DOTALL) lines = before.split('\n') if website_mode: stringfixes = website_stringfixes @@ -317,7 +318,7 @@ def process_file(path): #lead to "real" probs not found, the real check would be "does replacing #old with new lead to duplicate msgids? (including old ones marked with #~)" #which is not easily done in the current design... - elif new in decommented and old in decommented and not new in old: + elif new in decommented_msgids and old in decommented_msgids and not new in old: print ("pofix: %s already includes the new string\n\t\"%s\"\nbut also the old\n\t\"%s\"\nthis needs handfixing for now since it likely creates duplicate msgids." % (path, new, old)) else: for (i, line) in enumerate(lines):