Merge pull request #1 from timothyqiu/import-options-group

Handle grouping in import options
This commit is contained in:
Rémi Verschelde
2023-02-09 12:59:44 +01:00
committed by GitHub

View File

@@ -58,7 +58,7 @@ message_patterns = {
r"(ADD_PROPERTYI?|ImportOption|ExportOption)\(PropertyInfo\("
+ r"Variant::[_A-Z0-9]+" # Name
+ r', "(?P<message>[^"]+)"' # Type
+ r'(, [_A-Z0-9]+(, "([^"\\]|\\.)*"(, (?P<usage>[_A-Z0-9]+))?)?|\))' # [, hint[, hint string[, usage]]].
+ r'(, [_A-Z0-9]+(, "(?P<hint_string>(?:[^"\\]|\\.)*)"(, (?P<usage>[_A-Z0-9]+))?)?|\))' # [, hint[, hint string[, usage]]].
): ExtractType.PROPERTY_PATH,
re.compile(r'ADD_ARRAY\("(?P<message>[^"]+)", '): ExtractType.PROPERTY_PATH,
re.compile(r'ADD_ARRAY_COUNT(_WITH_USAGE_FLAGS)?\("(?P<message>[^"]+)", '): 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: