diff options
author | Hans Goudey <h.goudey@me.com> | 2021-03-03 21:58:33 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-03-03 21:58:33 +0300 |
commit | f53221bff7ffdcfb3acf03389450ed5ffb8f7964 (patch) | |
tree | ed2d00089bf910efd5931c9f1b3edbdcf396e4ca /source/blender/editors/space_node/node_draw.cc | |
parent | 93cdf461f3a66fb43716ddb99cf186fd0ff9ed91 (diff) |
UI: Allow translation for node error messages
This commit exposes the strings used in the node error messages for
localization. It also changes the message tooltip creation to
automatically add the period at the end, to be more consistent with
the (arguably bad) design of other tooltips in Blender.
Calling `TIP_` directly in the node implementation files allows us to
continue using `std::string` concatenation instead of passing variadic
arguments. It's also more explicit about which part of the message is
translated and which isn't. The files already include the translation
header anyway.
Diffstat (limited to 'source/blender/editors/space_node/node_draw.cc')
-rw-r--r-- | source/blender/editors/space_node/node_draw.cc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc index 162f3878f7e..5a0cacf070b 100644 --- a/source/blender/editors/space_node/node_draw.cc +++ b/source/blender/editors/space_node/node_draw.cc @@ -1236,16 +1236,15 @@ static char *node_errors_tooltip_fn(bContext *UNUSED(C), void *argN, const char for (const NodeWarning &warning : warnings.drop_back(1)) { complete_string += warning.message; + /* Adding the period is not ideal for multi-line messages, but it is consistent + * with other tooltip implementations in Blender, so it is added here. */ + complete_string += '.'; complete_string += '\n'; } + /* Let the tooltip system automatically add the last period. */ complete_string += warnings.last().message; - /* Remove the last period-- the tooltip system adds this automatically. */ - if (complete_string.back() == '.') { - complete_string.pop_back(); - } - return BLI_strdupn(complete_string.c_str(), complete_string.size()); } |