I18n: Translate Geometry Nodes modifier warnings

Geometry Nodes can generate warnings inside node trees using a Warning
node. This is used to report warnings in the modifier interface.

This commit allows translation of these warnings in the interface
template, and extracts the messages from built-in asset node groups,
by looking at each warning node.

Pull Request: https://projects.blender.org/blender/blender/pulls/147584
This commit is contained in:
Damien Picard
2025-10-07 20:22:35 +02:00
committed by Gitea
parent c35de6f92d
commit 2750cc1a70
2 changed files with 12 additions and 1 deletions

View File

@@ -1087,6 +1087,10 @@ def dump_asset_messages(msgs, reports, settings):
socket_data = asset_data.setdefault("sockets", [])
socket_data.append((interface.name, interface.description))
assets.append(asset_data)
for node in asset.nodes:
if node.bl_idname == "GeometryNodeWarning" and node.inputs['Message'].default_value:
warning_data = asset_data.setdefault("warnings", [])
warning_data.append(node.inputs['Message'].default_value)
for asset_file in sorted(asset_files):
for asset in sorted(asset_files[asset_file], key=lambda a: a["name"]):
@@ -1114,6 +1118,13 @@ def dump_asset_messages(msgs, reports, settings):
msgs, settings.DEFAULT_CONTEXT, socket_description, msgsrc,
reports, None, settings,
)
if "warnings" in asset:
for warning in sorted(asset["warnings"]):
msgsrc = f"Warning from node group {name}, file {asset_file}"
process_msg(
msgs, settings.DEFAULT_CONTEXT, warning, msgsrc,
reports, None, settings,
)
def dump_addon_bl_info(msgs, reports, module, settings):

View File

@@ -806,7 +806,7 @@ static void draw_warnings(const bContext *C,
uiLayout *col = &panel.body->column(false);
for (const NodeWarning *warning : warnings) {
const int icon = node_warning_type_icon(warning->type);
col->label(warning->message, icon);
col->label(RPT_(warning->message), icon);
}
}