From 0a9f97f4231dcfdfa58ecf501aedc54b9c7fbcfd Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Wed, 30 Mar 2022 18:21:46 +0800 Subject: [PATCH] Add more patterns for property path extraction --- editor/editor_property_name_processor.cpp | 5 +++++ editor/translations/extract.py | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/editor/editor_property_name_processor.cpp b/editor/editor_property_name_processor.cpp index af4ae3e576b..5e6c35806c3 100644 --- a/editor/editor_property_name_processor.cpp +++ b/editor/editor_property_name_processor.cpp @@ -123,6 +123,7 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() { capitalize_string_remaps["dof"] = "DoF"; capitalize_string_remaps["dpi"] = "DPI"; capitalize_string_remaps["dtls"] = "DTLS"; + capitalize_string_remaps["erp"] = "ERP"; capitalize_string_remaps["etc"] = "ETC"; capitalize_string_remaps["etc2"] = "ETC2"; capitalize_string_remaps["fbx"] = "FBX"; @@ -140,10 +141,12 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() { capitalize_string_remaps["gles3"] = "GLES3"; capitalize_string_remaps["gpu"] = "GPU"; capitalize_string_remaps["gui"] = "GUI"; + capitalize_string_remaps["guid"] = "GUID"; capitalize_string_remaps["hdr"] = "HDR"; capitalize_string_remaps["hidpi"] = "hiDPI"; capitalize_string_remaps["hipass"] = "High-pass"; capitalize_string_remaps["hsv"] = "HSV"; + capitalize_string_remaps["html"] = "HTML"; capitalize_string_remaps["http"] = "HTTP"; capitalize_string_remaps["id"] = "ID"; capitalize_string_remaps["igd"] = "IGD"; @@ -157,6 +160,7 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() { capitalize_string_remaps["iphone"] = "iPhone"; capitalize_string_remaps["ipv6"] = "IPv6"; capitalize_string_remaps["ir"] = "IR"; + capitalize_string_remaps["itunes"] = "iTunes"; capitalize_string_remaps["jit"] = "JIT"; capitalize_string_remaps["k1"] = "K1"; capitalize_string_remaps["k2"] = "K2"; @@ -205,6 +209,7 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() { capitalize_string_remaps["url"] = "URL"; capitalize_string_remaps["urls"] = "URLs"; capitalize_string_remaps["us"] = String::utf8("(µs)"); // Unit. + capitalize_string_remaps["usb"] = "USB"; capitalize_string_remaps["usec"] = String::utf8("(µsec)"); // Unit. capitalize_string_remaps["uuid"] = "UUID"; capitalize_string_remaps["uv"] = "UV"; diff --git a/editor/translations/extract.py b/editor/translations/extract.py index 4a7e87e2717..eaaec217889 100755 --- a/editor/translations/extract.py +++ b/editor/translations/extract.py @@ -113,8 +113,12 @@ message_patterns = { r'RTRN\("(?P([^"\\]|\\.)*)", "(?P([^"\\]|\\.)*)",[^,)]+?(, "(?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)?(_BASIC)?\("(?P[^".]+?)",'): ExtractType.PROPERTY_PATH, + re.compile(r'GLOBAL_DEF_BASIC\(vformat\("(?Player_names/\w+)/layer_%d"'): ExtractType.PROPERTY_PATH, re.compile(r'EDITOR_DEF(_RST)?\("(?P[^"]+?)",'): ExtractType.PROPERTY_PATH, + re.compile( + r'EDITOR_SETTING(_USAGE)?\(Variant::[_A-Z0-9]+, [_A-Z0-9]+, "(?P[^"]+?)",' + ): ExtractType.PROPERTY_PATH, re.compile( r'(ADD_PROPERTYI?|ImportOption|ExportOption)\(PropertyInfo\(Variant::[_A-Z0-9]+, "(?P[^"]+?)"[,)]' ): ExtractType.PROPERTY_PATH, @@ -122,6 +126,7 @@ message_patterns = { r"(?!#define )LIMPL_PROPERTY(_RANGE)?\(Variant::[_A-Z0-9]+, (?P[^,]+?)," ): ExtractType.PROPERTY_PATH, re.compile(r'ADD_GROUP\("(?P[^"]+?)", "(?P[^"]*?)"\)'): ExtractType.GROUP, + re.compile(r'#define WRTC_\w+ "(?P[^"]+?)"'): ExtractType.PROPERTY_PATH, }