[Bf-blender-cvs] [61e2e609a16] master: I18N Messages: fix confusion with Light meanings.

Bastien Montagne noreply at git.blender.org
Tue Feb 12 22:15:52 CET 2019


Commit: 61e2e609a168cf12f107dbf9a24d94cca17d4c58
Author: Bastien Montagne
Date:   Tue Feb 12 22:13:42 2019 +0100
Branches: master
https://developer.blender.org/rB61e2e609a168cf12f107dbf9a24d94cca17d4c58

I18N Messages: fix confusion with Light meanings.

Using ID_LIGHT or ID_ID for "Lamp" meaning, "Light" without context
being for 'not heavy'.

That rename of data-block was not really nice on that side of things :/

Related to T43295.

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

M	source/blender/blenkernel/intern/object.c
M	source/blender/editors/interface/interface_templates.c
M	source/blender/editors/object/object_add.c
M	source/blender/editors/object/object_select.c
M	source/blender/editors/object/object_shader_fx.c
M	source/blender/makesrna/intern/rna_lamp.c
M	source/blender/makesrna/intern/rna_object.c
M	source/blender/makesrna/intern/rna_shader_fx.c
M	source/blender/makesrna/intern/rna_space.c
M	source/blender/makesrna/intern/rna_userdef.c

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

diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 3d6cc05986b..fe04fa6172f 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -770,7 +770,7 @@ static const char *get_obdata_defname(int type)
 		case OB_FONT: return DATA_("Text");
 		case OB_MBALL: return DATA_("Mball");
 		case OB_CAMERA: return DATA_("Camera");
-		case OB_LAMP: return DATA_("Light");
+		case OB_LAMP: return CTX_DATA_(BLT_I18NCONTEXT_ID_LIGHT, "Light");
 		case OB_LATTICE: return DATA_("Lattice");
 		case OB_ARMATURE: return DATA_("Armature");
 		case OB_SPEAKER: return DATA_("Speaker");
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index bd2405ccae1..0262237a051 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -2268,7 +2268,8 @@ void uiTemplatePreview(
 				          pr_texture, 10, TEX_PR_OTHER, 0, 0, "");
 			}
 			else if (GS(parent->name) == ID_LA) {
-				uiDefButS(block, UI_BTYPE_ROW, B_MATPRV, IFACE_("Light"),  0, 0, UI_UNIT_X * 10, UI_UNIT_Y,
+				uiDefButS(block, UI_BTYPE_ROW, B_MATPRV, CTX_IFACE_(BLT_I18NCONTEXT_ID_LIGHT, "Light"),
+				          0, 0, UI_UNIT_X * 10, UI_UNIT_Y,
 				          pr_texture, 10, TEX_PR_OTHER, 0, 0, "");
 			}
 			else if (GS(parent->name) == ID_WO) {
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 71575c31937..2931fb89d7e 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -464,7 +464,8 @@ void OBJECT_OT_add(wmOperatorType *ot)
 
 	/* properties */
 	ED_object_add_unit_props_radius(ot);
-	RNA_def_enum(ot->srna, "type", rna_enum_object_type_items, 0, "Type", "");
+	PropertyRNA *prop = RNA_def_enum(ot->srna, "type", rna_enum_object_type_items, 0, "Type", "");
+	RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_ID);
 
 	ED_object_add_generic_props(ot, true);
 }
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c
index 1eccdfbd519..aed074907b7 100644
--- a/source/blender/editors/object/object_select.c
+++ b/source/blender/editors/object/object_select.c
@@ -427,6 +427,7 @@ void OBJECT_OT_select_by_type(wmOperatorType *ot)
 	/* properties */
 	RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend selection instead of deselecting everything first");
 	ot->prop = RNA_def_enum(ot->srna, "type", rna_enum_object_type_items, 1, "Type", "");
+	RNA_def_property_translation_context(ot->prop, BLT_I18NCONTEXT_ID_ID);
 }
 
 /*********************** Selection by Links *********************/
diff --git a/source/blender/editors/object/object_shader_fx.c b/source/blender/editors/object/object_shader_fx.c
index 7a70e9136f9..a19c79d2829 100644
--- a/source/blender/editors/object/object_shader_fx.c
+++ b/source/blender/editors/object/object_shader_fx.c
@@ -36,6 +36,8 @@
 #include "BLI_string_utf8.h"
 #include "BLI_utildefines.h"
 
+#include "BLT_translation.h"
+
 #include "BKE_context.h"
 #include "BKE_main.h"
 #include "BKE_shader_fx.h"
@@ -254,8 +256,6 @@ static const EnumPropertyItem *shaderfx_add_itemf(
 
 void OBJECT_OT_shaderfx_add(wmOperatorType *ot)
 {
-	PropertyRNA *prop;
-
 	/* identifiers */
 	ot->name = "Add Effect";
 	ot->description = "Add a visual effect to the active object";
@@ -270,9 +270,9 @@ void OBJECT_OT_shaderfx_add(wmOperatorType *ot)
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	/* properties */
-	prop = RNA_def_enum(ot->srna, "type", rna_enum_object_shaderfx_type_items, eShaderFxType_Blur, "Type", "");
-	RNA_def_enum_funcs(prop, shaderfx_add_itemf);
-	ot->prop = prop;
+	ot->prop = RNA_def_enum(ot->srna, "type", rna_enum_object_shaderfx_type_items, eShaderFxType_Blur, "Type", "");
+	RNA_def_enum_funcs(ot->prop, shaderfx_add_itemf);
+	RNA_def_property_translation_context(ot->prop, BLT_I18NCONTEXT_ID_ID);  /* Abused, for "Light"... */
 }
 
 /************************ generic functions for operators using names and data context *********************/
diff --git a/source/blender/makesrna/intern/rna_lamp.c b/source/blender/makesrna/intern/rna_lamp.c
index 8ee80cefda0..0aa1a32b993 100644
--- a/source/blender/makesrna/intern/rna_lamp.c
+++ b/source/blender/makesrna/intern/rna_lamp.c
@@ -120,6 +120,7 @@ static void rna_def_light(BlenderRNA *brna)
 	RNA_def_struct_sdna(srna, "Lamp");
 	RNA_def_struct_refine_func(srna, "rna_Light_refine");
 	RNA_def_struct_ui_text(srna, "Light", "Light data-block for lighting a scene");
+	RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_ID_LIGHT);
 	RNA_def_struct_ui_icon(srna, ICON_LIGHT_DATA);
 
 	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 01d4b543f74..97b3223d646 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -36,6 +36,8 @@
 
 #include "BLI_utildefines.h"
 
+#include "BLT_translation.h"
+
 #include "BKE_camera.h"
 #include "BKE_collection.h"
 #include "BKE_paint.h"
@@ -2142,6 +2144,7 @@ static void rna_def_object(BlenderRNA *brna)
 	RNA_def_property_enum_items(prop, rna_enum_object_type_items);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Type", "Type of Object");
+	RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_ID);
 
 	prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "mode");
diff --git a/source/blender/makesrna/intern/rna_shader_fx.c b/source/blender/makesrna/intern/rna_shader_fx.c
index 62c1ea6d334..d989bf90c9d 100644
--- a/source/blender/makesrna/intern/rna_shader_fx.c
+++ b/source/blender/makesrna/intern/rna_shader_fx.c
@@ -657,6 +657,7 @@ void RNA_def_shader_fx(BlenderRNA *brna)
 	RNA_def_property_enum_sdna(prop, NULL, "type");
 	RNA_def_property_enum_items(prop, rna_enum_object_shaderfx_type_items);
 	RNA_def_property_ui_text(prop, "Type", "");
+	RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_ID);  /* Abused, for "Light"... */
 
 	/* flags */
 	prop = RNA_def_property(srna, "show_viewport", PROP_BOOLEAN, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index d36a27bcd4c..ddf6ca0d2f0 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -2399,6 +2399,7 @@ static void rna_def_space_outliner(BlenderRNA *brna)
 	RNA_def_property_enum_sdna(prop, NULL, "filter_id_type");
 	RNA_def_property_enum_items(prop, rna_enum_id_type_items);
 	RNA_def_property_ui_text(prop, "Filter ID Type", "Data-block type to show");
+	RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_ID);
 }
 
 static void rna_def_space_view3d_shading(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index d3986dd91d0..714f11a5ee0 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -30,6 +30,8 @@
 #include "BLI_utildefines.h"
 #include "BLI_math_base.h"
 
+#include "BLT_translation.h"
+
 #include "BKE_appdir.h"
 #include "BKE_sound.h"
 #include "BKE_addon.h"
@@ -1852,6 +1854,7 @@ static void rna_def_userdef_theme_space_view3d(BlenderRNA *brna)
 	RNA_def_property_float_sdna(prop, NULL, "lamp");
 	RNA_def_property_array(prop, 4);
 	RNA_def_property_ui_text(prop, "Light", "");
+	RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_LIGHT);
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
 	prop = RNA_def_property(srna, "speaker", PROP_FLOAT, PROP_COLOR_GAMMA);



More information about the Bf-blender-cvs mailing list