From 14c13f7c4a57be298486b478e9788600117bff8c Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Tue, 29 Mar 2022 19:21:08 +0800 Subject: [PATCH] Strip feature tag manually when extracting property paths --- editor/translations/extract.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/editor/translations/extract.py b/editor/translations/extract.py index abc4dc81d2b..b759f885625 100755 --- a/editor/translations/extract.py +++ b/editor/translations/extract.py @@ -99,7 +99,7 @@ message_patterns = { re.compile(r'TTR\("(?P([^"\\]|\\.)*)"(, "(?P([^"\\]|\\.)*)")?\)'): ExtractType.TEXT, re.compile(r'TTRC\("(?P([^"\\]|\\.)*)"\)'): ExtractType.TEXT, re.compile(r'_initial_set\("(?P[^"]+?)",'): ExtractType.PROPERTY_PATH, - re.compile(r'GLOBAL_DEF(_RST)?(_NOVAL)?\("(?P[^".]+?)",'): ExtractType.PROPERTY_PATH, + re.compile(r'GLOBAL_DEF(_RST)?(_NOVAL)?\("(?P[^"]+?)",'): ExtractType.PROPERTY_PATH, re.compile(r'GLOBAL_DEF\("(?Player_names/\w+)/layer_"'): ExtractType.PROPERTY_PATH, re.compile(r'EDITOR_DEF(_RST)?\("(?P[^"]+?)",'): ExtractType.PROPERTY_PATH, re.compile( @@ -218,6 +218,8 @@ def process_file(f, fname): msg = msg[len(current_group) :] else: current_group = "" + if "." in msg: # Strip feature tag. + msg = msg.split(".", 1)[0] for part in msg.split("/"): _add_message(_process_editor_string(part), msgctx, location, translator_comment) elif extract_type == ExtractType.GROUP: