I18n: disambiguate and extract a few messages #111146

Merged
Bastien Montagne merged 3 commits from pioverfour/blender:dp_disambiguate into main 2023-09-04 16:16:36 +02:00
22 changed files with 84 additions and 47 deletions
Showing only changes of commit cabc4aa3a5 - Show all commits

View File

@ -794,13 +794,20 @@ class SEQUENCER_MT_add_effect(Menu):
layout.operator_context = 'INVOKE_REGION_WIN'
col = layout.column()
col.operator("sequencer.effect_strip_add", text="Add").type = 'ADD'
col.operator("sequencer.effect_strip_add", text="Subtract").type = 'SUBTRACT'
col.operator("sequencer.effect_strip_add", text="Multiply").type = 'MULTIPLY'
col.operator("sequencer.effect_strip_add", text="Over Drop").type = 'OVER_DROP'
col.operator("sequencer.effect_strip_add", text="Alpha Over").type = 'ALPHA_OVER'
col.operator("sequencer.effect_strip_add", text="Alpha Under").type = 'ALPHA_UNDER'
col.operator("sequencer.effect_strip_add", text="Color Mix").type = 'COLORMIX'
col.operator("sequencer.effect_strip_add", text="Add",
text_ctxt=i18n_contexts.id_sequence).type = 'ADD'
col.operator("sequencer.effect_strip_add", text="Subtract",
text_ctxt=i18n_contexts.id_sequence).type = 'SUBTRACT'
col.operator("sequencer.effect_strip_add", text="Multiply",
text_ctxt=i18n_contexts.id_sequence).type = 'MULTIPLY'
col.operator("sequencer.effect_strip_add", text="Over Drop",
text_ctxt=i18n_contexts.id_sequence).type = 'OVER_DROP'
col.operator("sequencer.effect_strip_add", text="Alpha Over",
text_ctxt=i18n_contexts.id_sequence).type = 'ALPHA_OVER'
col.operator("sequencer.effect_strip_add", text="Alpha Under",
text_ctxt=i18n_contexts.id_sequence).type = 'ALPHA_UNDER'
col.operator("sequencer.effect_strip_add", text="Color Mix",
text_ctxt=i18n_contexts.id_sequence).type = 'COLORMIX'
col.enabled = selected_sequences_len(context) >= 2
layout.separator()

View File

@ -15,6 +15,8 @@
#include "BLI_math_rotation.h"
#include "BLI_string_utils.h"
#include "BLT_translation.h"
#include "BKE_freestyle.h"
#include "BKE_lib_id.h"
#include "BKE_linestyle.h"
@ -166,7 +168,7 @@ FreestyleLineSet *BKE_freestyle_lineset_add(Main *bmain, FreestyleConfig *config
BLI_addtail(&config->linesets, (void *)lineset);
BKE_freestyle_lineset_set_active_index(config, lineset_index);
lineset->linestyle = BKE_linestyle_new(bmain, "LineStyle");
lineset->linestyle = BKE_linestyle_new(bmain, DATA_("LineStyle"));
lineset->flags |= FREESTYLE_LINESET_ENABLED;
lineset->selection = FREESTYLE_SEL_VISIBILITY | FREESTYLE_SEL_EDGE_TYPES |
FREESTYLE_SEL_IMAGE_BORDER;
@ -180,10 +182,10 @@ FreestyleLineSet *BKE_freestyle_lineset_add(Main *bmain, FreestyleConfig *config
STRNCPY(lineset->name, name);
}
else if (lineset_index > 0) {
SNPRINTF(lineset->name, "LineSet %i", lineset_index + 1);
SNPRINTF(lineset->name, DATA_("LineSet %i"), lineset_index + 1);
}
else {
STRNCPY(lineset->name, "LineSet");
STRNCPY(lineset->name, DATA_("LineSet"));
}
BKE_freestyle_lineset_unique_name(config, lineset);

View File

@ -711,7 +711,7 @@ static LineStyleModifier *new_modifier(const char *name, int type, size_t size)
}
m = (LineStyleModifier *)MEM_callocN(size, "line style modifier");
m->type = type;
STRNCPY(m->name, name);
STRNCPY(m->name, DATA_(name));
m->influence = 1.0f;
m->flags = LS_MODIFIER_ENABLED | LS_MODIFIER_EXPANDED;

View File

@ -125,6 +125,7 @@ const char *BLT_translate_do_new_dataname(const char *msgctxt, const char *msgid
/* Editors-types contexts. */
#define BLT_I18NCONTEXT_EDITOR_FILEBROWSER "File browser"
#define BLT_I18NCONTEXT_EDITOR_PREFERENCES "Preferences"
#define BLT_I18NCONTEXT_EDITOR_VIEW3D "View3D"
/* Generic contexts. */
@ -197,6 +198,7 @@ typedef struct {
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_WORKSPACE, "id_workspace"), \
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_WORLD, "id_world"), \
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_EDITOR_FILEBROWSER, "editor_filebrowser"), \
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_EDITOR_PREFERENCES, "editor_preferences"), \

See comment where it's used, think this is not needed.

See comment where it's used, think this is not needed.
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_EDITOR_VIEW3D, "editor_view3d"), \
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_AMOUNT, "amount"), \
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_COLOR, "color"), \

View File

@ -2257,7 +2257,7 @@ static int freestyle_linestyle_new_exec(bContext *C, wmOperator *op)
lineset->linestyle = (FreestyleLineStyle *)BKE_id_copy(bmain, &lineset->linestyle->id);
}
else {
lineset->linestyle = BKE_linestyle_new(bmain, "LineStyle");
lineset->linestyle = BKE_linestyle_new(bmain, DATA_("LineStyle"));
}
DEG_id_tag_update(&lineset->linestyle->id, 0);
WM_event_add_notifier(C, NC_LINESTYLE, lineset->linestyle);

View File

@ -1552,12 +1552,13 @@ void SEQUENCER_OT_effect_strip_add(wmOperatorType *ot)
/* Flags. */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_enum(ot->srna,
"type",
sequencer_prop_effect_types,
SEQ_TYPE_CROSS,
"Type",
"Sequencer effect type");
prop = RNA_def_enum(ot->srna,
"type",
sequencer_prop_effect_types,
SEQ_TYPE_CROSS,
"Type",
"Sequencer effect type");
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SEQUENCE);
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME | SEQPROP_ENDFRAME);
/* Only used when strip is of the Color type. */
prop = RNA_def_float_color(ot->srna,

View File

@ -2894,6 +2894,7 @@ void SEQUENCER_OT_change_effect_type(wmOperatorType *ot)
SEQ_TYPE_CROSS,
"Type",
"Sequencer effect type");
RNA_def_property_translation_context(ot->prop, BLT_I18NCONTEXT_ID_SEQUENCE);
}
/** \} */

View File

@ -1513,6 +1513,7 @@ static void rna_def_gpencil_options(BlenderRNA *brna)
prop,
"Smooth",
"Amount of smoothing to apply after finish newly created strokes, to reduce jitter/noise");
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_AMOUNT);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, nullptr);
@ -1925,6 +1926,7 @@ static void rna_def_gpencil_options(BlenderRNA *brna)
RNA_def_property_enum_sdna(prop, nullptr, "caps_type");
RNA_def_property_enum_items(prop, rna_enum_gpencil_brush_caps_types_items);
RNA_def_property_ui_text(prop, "Caps Type", "The shape of the start and end of the stroke");
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_GPENCIL);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
prop = RNA_def_property(srna, "fill_draw_mode", PROP_ENUM, PROP_NONE);
@ -2627,6 +2629,7 @@ static void rna_def_brush(BlenderRNA *brna)
prop = RNA_def_property(srna, "curves_sculpt_tool", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, rna_enum_brush_curves_sculpt_tool_items);
RNA_def_property_ui_text(prop, "Curves Sculpt Tool", "");
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVES);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
/** End per mode tool properties. */
@ -2653,6 +2656,7 @@ static void rna_def_brush(BlenderRNA *brna)
prop = RNA_def_property(srna, "mask_tool", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, brush_mask_tool_items);
RNA_def_property_ui_text(prop, "Mask Tool", "");
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_MASK);
RNA_def_property_update(prop, 0, "rna_Brush_update");
prop = RNA_def_property(srna, "curve_preset", PROP_ENUM, PROP_NONE);

View File

@ -909,6 +909,7 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna)
RNA_def_property_enum_sdna(prop, nullptr, "proximity_falloff");
RNA_def_property_enum_items(prop, prop_dynamicpaint_prox_falloff);
RNA_def_property_ui_text(prop, "Falloff", "Proximity falloff type");
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_BRUSH);
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
prop = RNA_def_property(srna, "use_proximity_project", PROP_BOOLEAN, PROP_NONE);

View File

@ -1673,12 +1673,14 @@ static void rna_def_gpencil_stroke(BlenderRNA *brna)
RNA_def_property_enum_sdna(prop, nullptr, "caps[0]");
RNA_def_property_enum_items(prop, rna_enum_gpencil_caps_modes_items);
RNA_def_property_ui_text(prop, "Start Cap", "Stroke start extreme cap style");
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_GPENCIL);
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
prop = RNA_def_property(srna, "end_cap_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, nullptr, "caps[1]");
RNA_def_property_enum_items(prop, rna_enum_gpencil_caps_modes_items);
RNA_def_property_ui_text(prop, "End Cap", "Stroke end extreme cap style");
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_GPENCIL);
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
/* No fill: The stroke never must fill area and must use fill color as stroke color

View File

@ -12,6 +12,8 @@
#include "BLI_math_rotation.h"
#include "BLI_utildefines.h"
#include "BLT_translation.h"
#include "RNA_define.hh"
#include "RNA_enum_types.hh"
@ -595,6 +597,7 @@ static void rna_def_linestyle_mtex(BlenderRNA *brna)
prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, prop_mapping_items);
RNA_def_property_ui_text(prop, "Mapping", "");
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_IMAGE);
RNA_def_property_update(prop, 0, "rna_LineStyle_update");
/* map to */
@ -1336,6 +1339,7 @@ static void rna_def_linestyle_modifiers(BlenderRNA *brna)
prop = RNA_def_property(srna, "smooth", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, nullptr, "flags", LS_MODIFIER_SPATIAL_NOISE_SMOOTH);
RNA_def_property_ui_text(prop, "Smooth", "If true, the spatial noise is smooth");
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_FREESTYLELINESTYLE);
RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
prop = RNA_def_property(srna, "use_pure_random", PROP_BOOLEAN, PROP_NONE);

View File

@ -893,6 +893,7 @@ static void rna_def_maskSpline(BlenderRNA *brna)
RNA_def_property_enum_items(prop, spline_offset_mode_items);
RNA_def_property_ui_text(
prop, "Feather Offset", "The method used for calculating the feather offset");
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_MASK);
RNA_def_property_update(prop, 0, "rna_Mask_update_data");
/* weight interpolation */

View File

@ -884,6 +884,7 @@ void RNA_def_material(BlenderRNA *brna)
RNA_def_property_enum_sdna(prop, nullptr, "pr_type");
RNA_def_property_enum_items(prop, preview_type_items);
RNA_def_property_ui_text(prop, "Preview Render Type", "Type of preview render");
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_MATERIAL);
RNA_def_property_update(prop, 0, "rna_Material_update_previews");
prop = RNA_def_property(srna, "use_preview_world", PROP_BOOLEAN, PROP_NONE);

View File

@ -4812,6 +4812,7 @@ static void rna_def_modifier_solidify(BlenderRNA *brna)
prop = RNA_def_property(srna, "nonmanifold_boundary_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, nonmanifold_boundary_mode_items);
RNA_def_property_ui_text(prop, "Boundary Shape", "Selects the boundary adjustment algorithm");
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_MESH);
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "nonmanifold_merge_threshold", PROP_FLOAT, PROP_DISTANCE);

View File

@ -4817,6 +4817,7 @@ static void def_sh_tex_image(StructRNA *srna)
RNA_def_property_enum_items(prop, prop_projection_items);
RNA_def_property_ui_text(
prop, "Projection", "Method to project 2D image on object with a 3D texture vector");
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_IMAGE);
RNA_def_property_update(prop, 0, "rna_Node_update");
prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
@ -5984,6 +5985,7 @@ static void def_cmp_blur(StructRNA *srna)
RNA_def_property_enum_sdna(prop, nullptr, "filtertype");
RNA_def_property_enum_items(prop, filter_type_items);
RNA_def_property_ui_text(prop, "Filter Type", "");
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_NODETREE);
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
prop = RNA_def_property(srna, "use_bokeh", PROP_BOOLEAN, PROP_NONE);

View File

@ -2224,6 +2224,7 @@ static void rna_def_particle_settings_mtex(BlenderRNA *brna)
prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, prop_mapping_items);
RNA_def_property_ui_text(prop, "Mapping", "");
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_IMAGE);
RNA_def_property_update(prop, 0, "rna_Particle_reset");
/* map to */

View File

@ -556,6 +556,7 @@ static void rna_def_texmapping(BlenderRNA *brna)
prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, prop_mapping_items);
RNA_def_property_ui_text(prop, "Mapping", "");
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_IMAGE);
RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
}

View File

@ -251,7 +251,7 @@ static StructRNA *rna_Panel_register(Main *bmain,
StructCallbackFunc call,
StructFreeFunc free)
{
const char *error_prefix = "Registering panel class:";
const char *error_prefix = TIP_("Registering panel class:");
ARegionType *art;
PanelType *pt, *parent = nullptr, dummy_pt = {nullptr};
Panel dummy_panel = {nullptr};

View File

@ -5145,6 +5145,7 @@ static void rna_def_userdef_view(BlenderRNA *brna)
prop, "rna_lang_enum_properties_get_no_international", nullptr, nullptr);
# endif
RNA_def_property_ui_text(prop, "Language", "Language used for translation");
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_EDITOR_PREFERENCES);
RNA_def_property_update(prop, NC_WINDOW, "rna_userdef_language_update");
prop = RNA_def_property(srna, "use_translate_tooltips", PROP_BOOLEAN, PROP_NONE);

View File

@ -11,6 +11,8 @@
#include "BLI_utildefines.h"
#include "BLT_translation.h"
#include "BKE_report.h"
#include "RNA_define.hh"
@ -151,8 +153,11 @@ static PointerRNA rna_gizmo_target_set_operator(wmGizmo *gz,
ot = WM_operatortype_find(opname, false); /* print error next */
if (!ot || !ot->srna) {
BKE_reportf(
reports, RPT_ERROR, "%s '%s'", ot ? "unknown operator" : "operator missing srna", opname);
BKE_reportf(reports,
RPT_ERROR,
"%s '%s'",
ot ? TIP_("unknown operator") : TIP_("operator missing srna"),
opname);
return PointerRNA_NULL;
}

View File

@ -52,7 +52,7 @@ std::optional<eCustomDataType> node_socket_to_custom_data_type(const bNodeSocket
bool check_tool_context_and_error(GeoNodeExecParams &params)
{
if (!params.user_data()->operator_data) {
params.error_message_add(NodeWarningType::Error, "Node must be run as tool");
params.error_message_add(NodeWarningType::Error, TIP_("Node must be run as tool"));
params.set_default_remaining_outputs();
return false;
}

View File

@ -107,55 +107,55 @@ static const char *give_seqname_by_type(int type)
{
switch (type) {
case SEQ_TYPE_META:
return DATA_("Meta");
return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Meta");
case SEQ_TYPE_IMAGE:
return DATA_("Image");
return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Image");
case SEQ_TYPE_SCENE:
return DATA_("Scene");
return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Scene");
case SEQ_TYPE_MOVIE:
return DATA_("Movie");
return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Movie");
case SEQ_TYPE_MOVIECLIP:
return DATA_("Clip");
return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Clip");
case SEQ_TYPE_MASK:
return DATA_("Mask");
return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Mask");
case SEQ_TYPE_SOUND_RAM:
return DATA_("Audio");
return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Audio");
case SEQ_TYPE_CROSS:
return DATA_("Cross");
return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Cross");
pioverfour marked this conversation as resolved Outdated

Why do the above ones not need the sequence context too?

Why do the above ones not need the `sequence` context too?
case SEQ_TYPE_GAMCROSS:
return DATA_("Gamma Cross");
return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Gamma Cross");
case SEQ_TYPE_ADD:
return DATA_("Add");
return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Add");
case SEQ_TYPE_SUB:
return DATA_("Sub");
return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Sub");
case SEQ_TYPE_MUL:
return DATA_("Mul");
return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Mul");
case SEQ_TYPE_ALPHAOVER:
return DATA_("Alpha Over");
return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Alpha Over");
case SEQ_TYPE_ALPHAUNDER:
return DATA_("Alpha Under");
return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Alpha Under");
case SEQ_TYPE_OVERDROP:
return DATA_("Over Drop");
return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Over Drop");
case SEQ_TYPE_COLORMIX:
return DATA_("Color Mix");
return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Color Mix");
case SEQ_TYPE_WIPE:
return DATA_("Wipe");
return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Wipe");
case SEQ_TYPE_GLOW:
return DATA_("Glow");
return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Glow");
case SEQ_TYPE_TRANSFORM:
return DATA_("Transform");
return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Transform");
case SEQ_TYPE_COLOR:
return DATA_("Color");
return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Color");
case SEQ_TYPE_MULTICAM:
return DATA_("Multicam");
return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Multicam");
case SEQ_TYPE_ADJUSTMENT:
return DATA_("Adjustment");
return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Adjustment");
case SEQ_TYPE_SPEED:
return DATA_("Speed");
return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Speed");
case SEQ_TYPE_GAUSSIAN_BLUR:
return DATA_("Gaussian Blur");
return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Gaussian Blur");
case SEQ_TYPE_TEXT:
return DATA_("Text");
return CTX_DATA_(BLT_I18NCONTEXT_ID_SEQUENCE, "Text");
default:
return nullptr;
}