From 7c4d85cc85e19d43e21bca115cf5f8788467a43e Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Thu, 9 Feb 2023 14:43:31 +0800 Subject: [PATCH] Handle grouping in import options --- scripts/extract_properties.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/extract_properties.py b/scripts/extract_properties.py index 58506f3..4aa649f 100644 --- a/scripts/extract_properties.py +++ b/scripts/extract_properties.py @@ -58,7 +58,7 @@ message_patterns = { r"(ADD_PROPERTYI?|ImportOption|ExportOption)\(PropertyInfo\(" + r"Variant::[_A-Z0-9]+" # Name + r', "(?P[^"]+)"' # Type - + r'(, [_A-Z0-9]+(, "([^"\\]|\\.)*"(, (?P[_A-Z0-9]+))?)?|\))' # [, hint[, hint string[, usage]]]. + + r'(, [_A-Z0-9]+(, "(?P(?:[^"\\]|\\.)*)"(, (?P[_A-Z0-9]+))?)?|\))' # [, hint[, hint string[, usage]]]. ): ExtractType.PROPERTY_PATH, re.compile(r'ADD_ARRAY\("(?P[^"]+)", '): ExtractType.PROPERTY_PATH, re.compile(r'ADD_ARRAY_COUNT(_WITH_USAGE_FLAGS)?\("(?P[^"]+)", '): ExtractType.TEXT, @@ -154,7 +154,13 @@ def process_file(f, fname): if extract_type == ExtractType.TEXT: _add_message(msg, msg_plural, msgctx, location, translator_comment) elif extract_type == ExtractType.PROPERTY_PATH: - if captures.get("usage") == "PROPERTY_USAGE_NO_EDITOR": + usage = captures.get("usage") + if usage == "PROPERTY_USAGE_NO_EDITOR": + continue + if usage == "PROPERTY_USAGE_GROUP": + _add_message(msg, msg_plural, msgctx, location, translator_comment) + current_group = captures["hint_string"] + current_subgroup = "" continue if current_subgroup: