[Bf-blender-cvs] [75c772391d3] master: I18n: construct report verbosely when moving objects to collection

Damien Picard noreply at git.blender.org
Mon Jan 30 09:46:02 CET 2023


Commit: 75c772391d358e8b69caab05aa4d48b39aab9669
Author: Damien Picard
Date:   Mon Jan 30 09:31:25 2023 +0100
Branches: master
https://developer.blender.org/rB75c772391d358e8b69caab05aa4d48b39aab9669

I18n: construct report verbosely when moving objects to collection

When moving or linking an object to a collection, the report was not
properly translatable. In French for instance, it would give
nonsensical half-translated sentences such as "<Object> moved vers
<collection>", instead of "<Object> déplacé vers <collection>".

Instead, separate the report into the four possible translations (one
or multiple objects, linking or moving). This is very verbose and less
legible, but it ensure the sentences can be properly translated,
including plurals in languages which use grammatical agreement.

In addition, use BKE_collection_ui_name_get() to get the collection
name, because the Scene Collection's name is hardcoded, but it can be
localized.

Reviewed By: mont29

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

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

M	source/blender/editors/object/object_edit.c

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

diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 2939c31bc5c..d1473f8dd7a 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -1927,7 +1927,7 @@ static int move_to_collection_exec(bContext *C, wmOperator *op)
                 RPT_ERROR,
                 "%s already in %s",
                 single_object->id.name + 2,
-                collection->id.name + 2);
+                BKE_collection_ui_name_get(collection));
     BLI_freelistN(&objects);
     return OPERATOR_CANCELLED;
   }
@@ -1944,12 +1944,32 @@ static int move_to_collection_exec(bContext *C, wmOperator *op)
   }
   BLI_freelistN(&objects);
 
-  BKE_reportf(op->reports,
-              RPT_INFO,
-              "%s %s to %s",
-              (single_object != NULL) ? single_object->id.name + 2 : "Objects",
-              is_link ? "linked" : "moved",
-              collection->id.name + 2);
+  if (is_link) {
+    if (single_object != NULL) {
+      BKE_reportf(op->reports,
+                  RPT_INFO,
+                  "%s linked to %s",
+                  single_object->id.name + 2,
+                  BKE_collection_ui_name_get(collection));
+    }
+    else {
+      BKE_reportf(
+          op->reports, RPT_INFO, "Objects linked to %s", BKE_collection_ui_name_get(collection));
+    }
+  }
+  else {
+    if (single_object != NULL) {
+      BKE_reportf(op->reports,
+                  RPT_INFO,
+                  "%s moved to %s",
+                  single_object->id.name + 2,
+                  BKE_collection_ui_name_get(collection));
+    }
+    else {
+      BKE_reportf(
+          op->reports, RPT_INFO, "Objects moved to %s", BKE_collection_ui_name_get(collection));
+    }
+  }
 
   DEG_relations_tag_update(bmain);
   DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE | ID_RECALC_SELECT);



More information about the Bf-blender-cvs mailing list