I18n: extract and disambiguate a few messages #114159

Merged
Bastien Montagne merged 1 commits from pioverfour/blender:dp_disambiguate into main 2023-11-07 18:09:07 +01:00
5 changed files with 46 additions and 9 deletions

View File

@ -1076,7 +1076,7 @@ class USERPREF_PT_theme_text_style(ThemePanel, CenterAlignMixIn, Panel):
col = flow.column()
col.prop(font_style, "points")
col.prop(font_style, "character_weight", text="Weight")
col.prop(font_style, "character_weight", text="Weight", text_ctxt=i18n_contexts.id_text)
pioverfour marked this conversation as resolved Outdated

This is adding a new property to the UI... Should definitely not be part of this patch. And not for 4.0 at this stage of release process either.

This is _adding_ a new property to the UI... Should definitely not be part of this patch. And not for 4.0 at this stage of release process either.

I must have made a mistake while rebasing from main to 4.0; this should be solved when rebasing back to main.

I must have made a mistake while rebasing from main to 4.0; this should be solved when rebasing back to main.
col = flow.column(align=True)
col.prop(font_style, "shadow_offset_x", text="Shadow Offset X")

View File

@ -270,8 +270,8 @@ void BKE_id_attribute_calc_unique_name(ID *id, const char *name, char *outname)
const int name_maxncpy = CustomData_name_maxncpy_calc(name);
/* Set default name if none specified.
* NOTE: We only call IFACE_() if needed to avoid locale lookup overhead. */
BLI_strncpy_utf8(outname, (name && name[0]) ? name : IFACE_("Attribute"), name_maxncpy);
* NOTE: We only call DATA_() if needed to avoid locale lookup overhead. */
BLI_strncpy_utf8(outname, (name && name[0]) ? name : DATA_("Attribute"), name_maxncpy);
const char *defname = ""; /* Dummy argument, never used as `name` is never zero length. */
BLI_uniquename_cb(unique_name_cb, &data, defname, '.', outname, name_maxncpy);

View File

@ -24,6 +24,10 @@
#include "BKE_paint.hh"
#include "BKE_report.h"
#include "BLI_string.h"
#include "BLT_translation.h"
#include "RNA_access.hh"
#include "RNA_define.hh"
#include "RNA_enum_types.hh"
@ -241,6 +245,16 @@ static int geometry_attribute_add_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
static int geometry_attribute_add_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
PropertyRNA *prop;
prop = RNA_struct_find_property(op->ptr, "name");
if (!RNA_property_is_set(op->ptr, prop)) {
RNA_property_string_set(op->ptr, prop, DATA_("Attribute"));
}
return WM_operator_props_popup_confirm(C, op, event);
}
void GEOMETRY_OT_attribute_add(wmOperatorType *ot)
{
/* identifiers */
@ -251,7 +265,7 @@ void GEOMETRY_OT_attribute_add(wmOperatorType *ot)
/* api callbacks */
ot->poll = geometry_attributes_poll;
ot->exec = geometry_attribute_add_exec;
ot->invoke = WM_operator_props_popup_confirm;
ot->invoke = geometry_attribute_add_invoke;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@ -259,7 +273,10 @@ void GEOMETRY_OT_attribute_add(wmOperatorType *ot)
/* properties */
PropertyRNA *prop;
prop = RNA_def_string(ot->srna, "name", "Attribute", MAX_NAME, "Name", "Name of new attribute");
/* The default name of the new attribute can be translated if new data translation is enabled,
* but since the user can choose it at invoke time, the translation happens in the invoke
* callback instead of here. */
prop = RNA_def_string(ot->srna, "name", nullptr, MAX_NAME, "Name", "Name of new attribute");
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
prop = RNA_def_enum(ot->srna,
@ -348,6 +365,16 @@ static int geometry_color_attribute_add_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
static int geometry_color_attribute_add_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
PropertyRNA *prop;
prop = RNA_struct_find_property(op->ptr, "name");
if (!RNA_property_is_set(op->ptr, prop)) {
RNA_property_string_set(op->ptr, prop, DATA_("Color"));
}
return WM_operator_props_popup_confirm(C, op, event);
}
enum class ConvertAttributeMode {
Generic,
VertexGroup,
@ -454,7 +481,7 @@ void GEOMETRY_OT_color_attribute_add(wmOperatorType *ot)
/* api callbacks */
ot->poll = geometry_attributes_poll;
ot->exec = geometry_color_attribute_add_exec;
ot->invoke = WM_operator_props_popup_confirm;
ot->invoke = geometry_color_attribute_add_invoke;
ot->ui = geometry_color_attribute_add_ui;
/* flags */
@ -463,8 +490,11 @@ void GEOMETRY_OT_color_attribute_add(wmOperatorType *ot)
/* properties */
PropertyRNA *prop;
/* The default name of the new attribute can be translated if new data translation is enabled,
* but since the user can choose it at invoke time, the translation happens in the invoke
* callback instead of here. */
prop = RNA_def_string(
ot->srna, "name", "Color", MAX_NAME, "Name", "Name of new color attribute");
ot->srna, "name", nullptr, MAX_NAME, "Name", "Name of new color attribute");
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
prop = RNA_def_enum(ot->srna,

View File

@ -979,10 +979,16 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but, const wmEvent *ev
* which isn't cheap to check. */
uiLayout *sub = uiLayoutColumn(layout, true);
uiLayoutSetEnabled(sub, !id->asset_data);
uiItemO(sub, IFACE_("Mark as Asset"), ICON_ASSET_MANAGER, "ASSET_OT_mark_single");
uiItemO(sub,
CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Mark as Asset"),
ICON_ASSET_MANAGER,
"ASSET_OT_mark_single");
sub = uiLayoutColumn(layout, true);
uiLayoutSetEnabled(sub, id->asset_data);
uiItemO(sub, IFACE_("Clear Asset"), ICON_NONE, "ASSET_OT_clear_single");
uiItemO(sub,
CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Clear Asset"),
ICON_NONE,
"ASSET_OT_clear_single");
uiItemS(layout);
}

View File

@ -3471,6 +3471,7 @@ static void rna_def_tool_settings(BlenderRNA *brna)
RNA_def_property_enum_bitflag_sdna(prop, nullptr, "snap_anim_mode");
RNA_def_property_enum_items(prop, rna_enum_snap_animation_element_items);
RNA_def_property_ui_text(prop, "Snap Anim Element", "Type of element to snap to");
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_UNIT);
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, nullptr); /* header redraw */
/* image editor uses own set of snap modes */