Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2021-03-03 21:58:33 +0300
committerHans Goudey <h.goudey@me.com>2021-03-03 21:58:33 +0300
commitf53221bff7ffdcfb3acf03389450ed5ffb8f7964 (patch)
treeed2d00089bf910efd5931c9f1b3edbdcf396e4ca /source/blender/editors
parent93cdf461f3a66fb43716ddb99cf186fd0ff9ed91 (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')
-rw-r--r--source/blender/editors/space_node/node_draw.cc9
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());
}