From c247f08855c876718432286ddca7a591c17a14e8 Mon Sep 17 00:00:00 2001 From: Binrui Dong Date: Sun, 28 Jan 2024 11:32:18 +0800 Subject: [PATCH] Extract UI widget clauses text for translation --- lang/string_extractor/parsers/widget.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lang/string_extractor/parsers/widget.py b/lang/string_extractor/parsers/widget.py index 942d20e7cae39..c348f9017f1dc 100644 --- a/lang/string_extractor/parsers/widget.py +++ b/lang/string_extractor/parsers/widget.py @@ -15,3 +15,13 @@ def parse_widget(json, origin): comment = "Text in portion of UI widget \"{}\"".format(id) if "text" in phrase: write_text(phrase["text"], origin, comment=comment) + if "default_clause" in json: + write_text(json["default_clause"]["text"], origin, + comment="Default clause of UI widget \"{}\"".format(id)) + if "clauses" in json: + for clause in json["clauses"]: + if "text" not in clause: + continue + write_text(clause["text"], origin, + comment="Clause text \"{}\" of UI widget \"{}\"" + .format(clause["id"], id))