[Bf-blender-cvs] [7099d5b6612] master: Fix: Missing translations from operator descriptions

Hans Goudey noreply at git.blender.org
Fri Feb 4 14:32:09 CET 2022


Commit: 7099d5b66129deba2d28102ea339b1d5339233fe
Author: Hans Goudey
Date:   Fri Feb 4 07:31:53 2022 -0600
Branches: master
https://developer.blender.org/rB7099d5b66129deba2d28102ea339b1d5339233fe

Fix: Missing translations from operator descriptions

The strings in the `get_description` functions for operators need
translation, they are not found by the translation system automatically,
and there is no translation applied afterwards either (as far as I could
tell). Some used `N_` before, but most did nothing.

Differential Revision: https://developer.blender.org/D14011

===================================================================

M	source/blender/editors/asset/CMakeLists.txt
M	source/blender/editors/asset/intern/asset_ops.cc
M	source/blender/editors/mesh/editmesh_select.c
M	source/blender/editors/object/object_data_transfer.c
M	source/blender/editors/object/object_modifier.c
M	source/blender/editors/object/object_vgroup.c
M	source/blender/editors/render/render_opengl.cc
M	source/blender/editors/space_action/action_edit.c
M	source/blender/editors/space_graph/graph_edit.c
M	source/blender/editors/space_graph/graph_slider_ops.c
M	source/blender/windowmanager/intern/wm_files.c

===================================================================

diff --git a/source/blender/editors/asset/CMakeLists.txt b/source/blender/editors/asset/CMakeLists.txt
index 086fab4ab47..d91102528e5 100644
--- a/source/blender/editors/asset/CMakeLists.txt
+++ b/source/blender/editors/asset/CMakeLists.txt
@@ -21,6 +21,7 @@ set(INC
   ../../blenkernel
   ../../blenlib
   ../../blenloader
+  ../../blentranslation
   ../../makesdna
   ../../makesrna
   ../../windowmanager
diff --git a/source/blender/editors/asset/intern/asset_ops.cc b/source/blender/editors/asset/intern/asset_ops.cc
index f7755aa9fea..0469f14487d 100644
--- a/source/blender/editors/asset/intern/asset_ops.cc
+++ b/source/blender/editors/asset/intern/asset_ops.cc
@@ -39,6 +39,8 @@
 /* XXX needs access to the file list, should all be done via the asset system in future. */
 #include "ED_fileselect.h"
 
+#include "BLT_translation.h"
+
 #include "RNA_access.h"
 #include "RNA_define.h"
 
@@ -342,8 +344,8 @@ static bool asset_clear_poll(bContext *C)
   IDVecStats ctx_stats = asset_operation_get_id_vec_stats_from_context(C);
 
   if (!ctx_stats.has_asset) {
-    const char *msg_single = "Data-block is not marked as asset";
-    const char *msg_multiple = "No data-block selected that is marked as asset";
+    const char *msg_single = TIP_("Data-block is not marked as asset");
+    const char *msg_multiple = TIP_("No data-block selected that is marked as asset");
     CTX_wm_operator_poll_msg_set(C, ctx_stats.is_single ? msg_single : msg_multiple);
     return false;
   }
@@ -365,8 +367,8 @@ static char *asset_clear_get_description(struct bContext *UNUSED(C),
   }
 
   return BLI_strdup(
-      "Delete all asset metadata, turning the selected asset data-blocks back into normal "
-      "data-blocks, and set Fake User to ensure the data-blocks will still be saved");
+      TIP_("Delete all asset metadata, turning the selected asset data-blocks back into normal "
+           "data-blocks, and set Fake User to ensure the data-blocks will still be saved"));
 }
 
 static void ASSET_OT_clear(wmOperatorType *ot)
diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c
index 9396c9e53ea..8383492e459 100644
--- a/source/blender/editors/mesh/editmesh_select.c
+++ b/source/blender/editors/mesh/editmesh_select.c
@@ -1408,15 +1408,15 @@ static char *edbm_select_mode_get_description(struct bContext *UNUSED(C),
       !RNA_struct_property_is_set(values, "action")) {
     switch (type) {
       case SCE_SELECT_VERTEX:
-        return BLI_strdup(
-            N_("Vertex select - Shift-Click for multiple modes, Ctrl-Click contracts selection"));
+        return BLI_strdup(TIP_(
+            "Vertex select - Shift-Click for multiple modes, Ctrl-Click contracts selection"));
       case SCE_SELECT_EDGE:
         return BLI_strdup(
-            N_("Edge select - Shift-Click for multiple modes, "
-               "Ctrl-Click expands/contracts selection depending on the current mode"));
+            TIP_("Edge select - Shift-Click for multiple modes, "
+                 "Ctrl-Click expands/contracts selection depending on the current mode"));
       case SCE_SELECT_FACE:
         return BLI_strdup(
-            N_("Face select - Shift-Click for multiple modes, Ctrl-Click expands selection"));
+            TIP_("Face select - Shift-Click for multiple modes, Ctrl-Click expands selection"));
     }
   }
 
diff --git a/source/blender/editors/object/object_data_transfer.c b/source/blender/editors/object/object_data_transfer.c
index 595822de1e7..3744cbee3a4 100644
--- a/source/blender/editors/object/object_data_transfer.c
+++ b/source/blender/editors/object/object_data_transfer.c
@@ -43,6 +43,8 @@
 #include "DEG_depsgraph.h"
 #include "DEG_depsgraph_query.h"
 
+#include "BLT_translation.h"
+
 #include "RNA_access.h"
 #include "RNA_define.h"
 #include "RNA_enum_types.h"
@@ -610,8 +612,8 @@ static char *data_transfer_get_description(bContext *UNUSED(C),
   const bool reverse_transfer = RNA_boolean_get(ptr, "use_reverse_transfer");
 
   if (reverse_transfer) {
-    return BLI_strdup(
-        "Transfer data layer(s) (weights, edge sharp, etc.) from selected meshes to active one");
+    return BLI_strdup(TIP_(
+        "Transfer data layer(s) (weights, edge sharp, etc.) from selected meshes to active one"));
   }
 
   return NULL;
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 4ac2a9dca62..775fac96d57 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -84,6 +84,8 @@
 #include "DEG_depsgraph_build.h"
 #include "DEG_depsgraph_query.h"
 
+#include "BLT_translation.h"
+
 #include "RNA_access.h"
 #include "RNA_define.h"
 #include "RNA_enum_types.h"
@@ -1521,7 +1523,7 @@ static char *modifier_apply_as_shapekey_get_description(struct bContext *UNUSED(
   bool keep = RNA_boolean_get(values, "keep_modifier");
 
   if (keep) {
-    return BLI_strdup("Apply modifier as a new shapekey and keep it in the stack");
+    return BLI_strdup(TIP_("Apply modifier as a new shapekey and keep it in the stack"));
   }
 
   return NULL;
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index e21e815b56f..ed0f7b2fad0 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -64,6 +64,8 @@
 #include "DEG_depsgraph_build.h"
 #include "DEG_depsgraph_query.h"
 
+#include "BLT_translation.h"
+
 #include "DNA_armature_types.h"
 #include "RNA_access.h"
 #include "RNA_define.h"
@@ -3427,16 +3429,16 @@ static char *vertex_group_lock_description(struct bContext *UNUSED(C),
 
   switch (action) {
     case VGROUP_LOCK:
-      action_str = "Lock";
+      action_str = TIP_("Lock");
       break;
     case VGROUP_UNLOCK:
-      action_str = "Unlock";
+      action_str = TIP_("Unlock");
       break;
     case VGROUP_TOGGLE:
-      action_str = "Toggle locks of";
+      action_str = TIP_("Toggle locks of");
       break;
     case VGROUP_INVERT:
-      action_str = "Invert locks of";
+      action_str = TIP_("Invert locks of");
       break;
     default:
       return NULL;
@@ -3444,34 +3446,34 @@ static char *vertex_group_lock_description(struct bContext *UNUSED(C),
 
   switch (mask) {
     case VGROUP_MASK_ALL:
-      target_str = "all";
+      target_str = TIP_("all");
       break;
     case VGROUP_MASK_SELECTED:
-      target_str = "selected";
+      target_str = TIP_("selected");
       break;
     case VGROUP_MASK_UNSELECTED:
-      target_str = "unselected";
+      target_str = TIP_("unselected");
       break;
     case VGROUP_MASK_INVERT_UNSELECTED:
       switch (action) {
         case VGROUP_INVERT:
-          target_str = "selected";
+          target_str = TIP_("selected");
           break;
         case VGROUP_LOCK:
-          target_str = "selected and unlock unselected";
+          target_str = TIP_("selected and unlock unselected");
           break;
         case VGROUP_UNLOCK:
-          target_str = "selected and lock unselected";
+          target_str = TIP_("selected and lock unselected");
           break;
         default:
-          target_str = "all and invert unselected";
+          target_str = TIP_("all and invert unselected");
       }
       break;
     default:
       return NULL;
   }
 
-  return BLI_sprintfN("%s %s vertex groups of the active object", action_str, target_str);
+  return BLI_sprintfN(TIP_("%s %s vertex groups of the active object"), action_str, target_str);
 }
 
 void OBJECT_OT_vertex_group_lock(wmOperatorType *ot)
diff --git a/source/blender/editors/render/render_opengl.cc b/source/blender/editors/render/render_opengl.cc
index 8bd0244c899..c4ce8bac126 100644
--- a/source/blender/editors/render/render_opengl.cc
+++ b/source/blender/editors/render/render_opengl.cc
@@ -72,8 +72,11 @@
 #include "IMB_colormanagement.h"
 #include "IMB_imbuf.h"
 #include "IMB_imbuf_types.h"
+
 #include "RE_pipeline.h"
 
+#include "BLT_translation.h"
+
 #include "RNA_access.h"
 #include "RNA_define.h"
 
@@ -1326,12 +1329,12 @@ static char *screen_opengl_render_description(struct bContext *UNUSED(C),
   }
 
   if (RNA_boolean_get(ptr, "render_keyed_only")) {
-    return BLI_strdup(
+    return BLI_strdup(TIP_(
         "Render the viewport for the animation range of this scene, but only render keyframes of "
-        "selected objects");
+        "selected objects"));
   }
 
-  return BLI_strdup("Render the viewport for the animation range of this scene");
+  return BLI_strdup(TIP_("Render the viewport for the animation range of this scene"));
 }
 
 void RENDER_OT_opengl(wmOperatorType *ot)
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c
index 184d715a347..ba4ba04d548 100644
--- a/source/blender/editors/space_action/action_edit.c
+++ b/source/blender/editors/space_action/action_edit.c
@@ -658,7 +658,7 @@ static char *actkeys_paste_description(bContext *UNUSED(C),
 {
   /* Custom description if the 'flipped' option is used. */
   if (RNA_boolean_get(ptr, "flipped")) {
-    return BLI_strdup("Paste keyframes from mirrored bones if they exist");
+    return BLI_strdup(TIP_("Paste keyframes from mirrored bones if they exist"));
   }
 
   /* Use the default description in the other cases. */
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index 9675901ead3..63de7fb570e 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -586,7 +586,7 @@ static char *graphkeys_paste_description(bContext *UNUSED(C),
 {
   /* Custom description if the 'flipped' option is used. */
   if (RNA_boolean_get(ptr, "flipped")) {
-    return BLI_strdup("Paste keyframes from mirrored bones if they exist");
+    return BLI_strdup(TIP_("Paste keyframes from mirrored bones if they exist"));
   }
 
   /* Use the default description in the other cases. */
diff --git a/source/blender/editors/space_graph/graph_slider_ops.c b/source/blender/editors/space_graph/graph_slider_ops.c
index 4b8c983a761..44a8817fe7c 100644
--- a/source/blender/editors/space_graph

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list