I18n: disambiguate message "World"

The confusion is about World as an ID type, and the World coordinates.

Use no context for the latter, and either `BLT_I18NCONTEXT_ID_WORLD`,
or other more fine-grained contexts when needed as part of enums for the
former.

The message from the custom HDRI installation operator cannot be
disambiguated right now, because Python enums don't support contexts.

Ref T43295

Reviewed By: mont29

Maniphest Tasks: T43295

Differential Revision: https://developer.blender.org/D16194
This commit is contained in:
Damien Picard 2022-10-10 17:33:24 +02:00 committed by Bastien Montagne
parent 962b647690
commit 7d7318f6c5
Notes: blender-bot 2024-02-23 11:57:10 +01:00
Referenced by issue #43295, Translation disambiguation requests
Referenced by pull request #118653, Fix #118643: Translation of enum button tooltip not working in cases
Referenced by commit 199f8ad817, Fix #118643: Translation of enum button tooltip not working in cases
5 changed files with 10 additions and 2 deletions

View File

@ -3269,7 +3269,7 @@ void uiTemplatePreview(uiLayout *layout,
uiDefButS(block,
UI_BTYPE_ROW,
B_MATPRV,
IFACE_("World"),
CTX_IFACE_(BLT_I18NCONTEXT_ID_WORLD, "World"),
0,
0,
UI_UNIT_X * 10,

View File

@ -879,7 +879,7 @@ static int new_world_exec(bContext *C, wmOperator * /*op*/)
wo = new_wo;
}
else {
wo = BKE_world_add(bmain, DATA_("World"));
wo = BKE_world_add(bmain, CTX_DATA_(BLT_I18NCONTEXT_ID_WORLD, "World"));
ED_node_shader_default(C, &wo->id);
wo->use_nodes = true;
}

View File

@ -7861,6 +7861,7 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
RNA_def_property_ui_text(prop, "World", "World used for rendering the scene");
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_WORLD);
RNA_def_property_update(prop, NC_SCENE | ND_WORLD, "rna_Scene_world_update");
prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE);

View File

@ -4087,6 +4087,7 @@ static void rna_def_space_view3d_shading(BlenderRNA *brna)
prop = RNA_def_property(srna, "background_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, background_type_items);
RNA_def_property_ui_text(prop, "Background", "Way to display the background");
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_EDITOR_VIEW3D);
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D | NS_VIEW3D_SHADING, NULL);
prop = RNA_def_property(srna, "background_color", PROP_FLOAT, PROP_COLOR);
@ -5265,6 +5266,7 @@ static void rna_def_space_properties(BlenderRNA *brna)
RNA_def_property_enum_funcs(
prop, NULL, "rna_SpaceProperties_context_set", "rna_SpaceProperties_context_itemf");
RNA_def_property_ui_text(prop, "", "");
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_ID);
RNA_def_property_update(
prop, NC_SPACE | ND_SPACE_PROPERTIES, "rna_SpaceProperties_context_update");
@ -6562,6 +6564,7 @@ static void rna_def_fileselect_entry(BlenderRNA *brna)
prop,
"Data-block Type",
"The type of the data-block, if the file represents one ('NONE' otherwise)");
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_ID);
prop = RNA_def_property(srna, "local_id", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "ID");
@ -7314,12 +7317,14 @@ static void rna_def_space_node(BlenderRNA *brna)
RNA_def_property_enum_sdna(prop, NULL, "texfrom");
RNA_def_property_enum_items(prop, texture_id_type_items);
RNA_def_property_ui_text(prop, "Texture Type", "Type of data to take texture from");
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_ID);
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE, NULL);
prop = RNA_def_property(srna, "shader_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "shaderfrom");
RNA_def_property_enum_items(prop, shader_type_items);
RNA_def_property_ui_text(prop, "Shader Type", "Type of data to take shader from");
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_ID);
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE, NULL);
prop = RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE);

View File

@ -4057,6 +4057,7 @@ static void rna_def_userdef_studiolights(BlenderRNA *brna)
STUDIOLIGHT_TYPE_WORLD,
"Type",
"The type for the new studio light");
RNA_def_property_translation_context(parm, BLT_I18NCONTEXT_ID_LIGHT);
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
parm = RNA_def_pointer(func, "studio_light", "StudioLight", "", "Newly created StudioLight");
RNA_def_function_return(func, parm);
@ -4117,6 +4118,7 @@ static void rna_def_userdef_studiolight(BlenderRNA *brna)
RNA_def_property_enum_funcs(prop, "rna_UserDef_studiolight_type_get", NULL, NULL);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Type", "");
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_LIGHT);
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_property_string_funcs(