I18n: extract and disambiguate a few messages
Extract:
- Compositor error messages.
- `bUnitDef`s were broken after cleanup commit 2b77cd726d. Since each
unit's "display name" is now preceded by a consistent "name_display"
comment, the regex which extracts the unit is greatly simplified.
It now relies on the presence of the comment instead of the struct
order.
- "Preset" menu and "Apply Preset" button from the curveprofile
template.
- Operator labels from the catalog context menu.
Disambiguate:
- "Bake Data": can mean "Which data to bake" (verb), or "The data that
were baked" (noun).
- "Cache" in the Simulation Nodes panel is a verb, not a noun.
- "Mix" in the snapping menu is a noun, not a verb.
- "Top" and "Bottom" can mean the upper part of an object or the
highest point or element of something like a menu or list.
Pull Request: https://projects.blender.org/blender/blender/pulls/115963
This commit is contained in:
committed by
Bastien Montagne
parent
4ef5d9f60f
commit
faefaa4447
@@ -252,12 +252,18 @@ PYGETTEXT_KEYWORDS = (() +
|
||||
for it in ("BKE_report", "BKE_reportf", "BKE_reports_prepend", "BKE_reports_prependf",
|
||||
"CTX_wm_operator_poll_msg_set", "WM_report", "WM_reportf")) +
|
||||
|
||||
# bmesh operator errors
|
||||
tuple(("{}\\((?:[^\"',]+,){{3}}\\s*" + _msg_re + r"\s*\)").format(it)
|
||||
for it in ("BMO_error_raise",)) +
|
||||
|
||||
# Modifier errors
|
||||
tuple(("{}\\((?:[^\"',]+,){{2}}\\s*" + _msg_re + r"\s*(?:\)|,)").format(it)
|
||||
for it in ("BKE_modifier_set_error",)) +
|
||||
|
||||
# Compositor error messages
|
||||
tuple((r"\.{}\(\s*" + _msg_re + r"\s*\)").format(it)
|
||||
for it in ("set_info_message",)) +
|
||||
|
||||
# This one is a tad more risky, but in practice would not expect a name/uid string parameter
|
||||
# (the second one in those functions) to ever have a comma in it, so think this is fine.
|
||||
tuple(("{}\\((?:[^,]+,){{2}}\\s*" + _msg_re + r"\s*(?:\)|,)").format(it)
|
||||
@@ -297,13 +303,8 @@ PYGETTEXT_KEYWORDS = (() +
|
||||
# Geometry Nodes field inputs
|
||||
((r"FieldInput\(CPPType::get<.*?>\(\),\s*" + _msg_re + r"\s*\)"),) +
|
||||
|
||||
# bUnitDef unit names.
|
||||
# NOTE: regex is a bit more complex than it would need too. Since the actual
|
||||
# identifier (`B_UNIT_DEF_`) is at the end, if it's simpler/too general it
|
||||
# becomes extremely slow to process some (unrelated) source files.
|
||||
((r"\{(?:(?:\s*\"[^\",]+\"\s*,)|(?:\s*\"\\\"\",)|(?:\s*nullptr\s*,)){4}\s*" +
|
||||
_msg_re + r"\s*,(?:(?:\s*\"[^\"',]+\"\s*,)|(?:\s*nullptr\s*,))(?:[^,]+,){2}"
|
||||
+ "(?:\|?\s*B_UNIT_DEF_[_A-Z]+\s*)+\}"),) +
|
||||
# bUnitDef unit names
|
||||
((r"/\*name_display\*/\s*" + _msg_re + r"\s*,"),) +
|
||||
|
||||
tuple((r"{}\(\s*" + _msg_re + r"\s*,\s*(?:" +
|
||||
r"\s*,\s*)?(?:".join(_ctxt_re_gen(i) for i in range(PYGETTEXT_MAX_MULTI_CTXT)) + r")?\s*\)").format(it)
|
||||
|
||||
@@ -13,7 +13,10 @@ from bpy.props import (
|
||||
EnumProperty,
|
||||
StringProperty,
|
||||
)
|
||||
from bpy.app.translations import pgettext_tip as tip_
|
||||
from bpy.app.translations import (
|
||||
pgettext_tip as tip_,
|
||||
contexts as i18n_contexts,
|
||||
)
|
||||
|
||||
|
||||
class ANIM_OT_keying_set_export(Operator):
|
||||
@@ -238,6 +241,7 @@ class NLA_OT_bake(Operator):
|
||||
)
|
||||
bake_types: EnumProperty(
|
||||
name="Bake Data",
|
||||
translation_context=i18n_contexts.id_action,
|
||||
description="Which data's transformations to bake",
|
||||
options={'ENUM_FLAG'},
|
||||
items=(
|
||||
|
||||
@@ -5,7 +5,10 @@
|
||||
from bpy.types import (
|
||||
Panel,
|
||||
)
|
||||
from bpy.app.translations import pgettext_iface as iface_
|
||||
from bpy.app.translations import (
|
||||
pgettext_iface as iface_,
|
||||
contexts as i18n_contexts,
|
||||
)
|
||||
|
||||
|
||||
class PHYSICS_PT_geometry_nodes(Panel):
|
||||
@@ -35,16 +38,16 @@ class PHYSICS_PT_geometry_nodes(Panel):
|
||||
calc_text = iface_("Calculate to Frame")
|
||||
bake_text = iface_("Bake")
|
||||
|
||||
layout.operator("object.simulation_nodes_cache_calculate_to_frame", text=calc_text).selected = True
|
||||
layout.operator("object.simulation_nodes_cache_calculate_to_frame", text=calc_text, translate=False).selected = True
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.operator("object.simulation_nodes_cache_bake", text=bake_text).selected = True
|
||||
row.operator("object.simulation_nodes_cache_bake", text=bake_text, translate=False).selected = True
|
||||
row.operator("object.simulation_nodes_cache_delete", text="", icon='TRASH').selected = True
|
||||
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False
|
||||
ob = context.object
|
||||
layout.prop(ob, "use_simulation_cache", text="Cache")
|
||||
layout.prop(ob, "use_simulation_cache", text="Cache", text_ctxt=i18n_contexts.id_simulation)
|
||||
|
||||
|
||||
classes = (
|
||||
|
||||
@@ -702,7 +702,7 @@ class VIEW3D_HT_header(Header):
|
||||
icon = snap_items[elem].icon
|
||||
break
|
||||
else:
|
||||
text = "Mix"
|
||||
text = iface_("Mix", i18n_contexts.editor_view3d)
|
||||
icon = 'NONE'
|
||||
del snap_items, snap_elements
|
||||
|
||||
@@ -714,6 +714,7 @@ class VIEW3D_HT_header(Header):
|
||||
panel="VIEW3D_PT_snapping",
|
||||
icon=icon,
|
||||
text=text,
|
||||
translate=False,
|
||||
)
|
||||
|
||||
# Proportional editing
|
||||
|
||||
@@ -81,7 +81,10 @@
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
/* Define a single unit. */
|
||||
/* Define a single unit.
|
||||
* When changing the format, please check that the PYGETTEXT_KEYWORDS regex
|
||||
* used to extract the unit names for translation still works
|
||||
* in scripts/modules/bl_i18n_utils/settings.py. */
|
||||
struct bUnitDef {
|
||||
const char *name;
|
||||
/** Abused a bit for the display name. */
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
#include "BLF_api.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "BKE_colortools.h"
|
||||
#include "BKE_context.hh"
|
||||
#include "BKE_curve.hh"
|
||||
@@ -1151,7 +1153,7 @@ void DRW_draw_region_engine_info(int xoffset, int *yoffset, int line_height)
|
||||
BLF_shadow(font_id, 5, blender::float4{0.0f, 0.0f, 0.0f, 1.0f});
|
||||
BLF_shadow_offset(font_id, 1, -1);
|
||||
|
||||
const char *buf_step = data->info;
|
||||
const char *buf_step = IFACE_(data->info);
|
||||
do {
|
||||
const char *buf = buf_step;
|
||||
buf_step = BLI_strchr_or_end(buf, '\n');
|
||||
|
||||
@@ -5301,8 +5301,15 @@ static void CurveProfile_buttons_layout(uiLayout *layout, PointerRNA *ptr, RNAUp
|
||||
/* There is probably potential to use simpler "uiItemR" functions here, but automatic updating
|
||||
* after a preset is selected would be more complicated. */
|
||||
uiLayout *row = uiLayoutRow(layout, true);
|
||||
bt = uiDefBlockBut(
|
||||
block, CurveProfile_buttons_presets, profile, "Preset", 0, 0, UI_UNIT_X, UI_UNIT_X, "");
|
||||
bt = uiDefBlockBut(block,
|
||||
CurveProfile_buttons_presets,
|
||||
profile,
|
||||
IFACE_("Preset"),
|
||||
0,
|
||||
0,
|
||||
UI_UNIT_X,
|
||||
UI_UNIT_X,
|
||||
"");
|
||||
UI_but_funcN_set(bt, rna_update_cb, MEM_dupallocN(cb), nullptr);
|
||||
|
||||
/* Show a "re-apply" preset button when it has been changed from the preset. */
|
||||
@@ -5313,7 +5320,7 @@ static void CurveProfile_buttons_layout(uiLayout *layout, PointerRNA *ptr, RNAUp
|
||||
UI_BTYPE_BUT,
|
||||
0,
|
||||
ICON_NONE,
|
||||
"Apply Preset",
|
||||
IFACE_("Apply Preset"),
|
||||
0,
|
||||
0,
|
||||
UI_UNIT_X,
|
||||
|
||||
@@ -294,7 +294,7 @@ void AssetCatalogTreeViewItem::build_context_menu(bContext &C, uiLayout &column)
|
||||
|
||||
uiItemFullO(&column,
|
||||
"ASSET_OT_catalog_new",
|
||||
"New Catalog",
|
||||
IFACE_("New Catalog"),
|
||||
ICON_NONE,
|
||||
nullptr,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
@@ -306,14 +306,14 @@ void AssetCatalogTreeViewItem::build_context_menu(bContext &C, uiLayout &column)
|
||||
BLI_uuid_format(catalog_id_str_buffer, catalog_item_.get_catalog_id());
|
||||
uiItemFullO(&column,
|
||||
"ASSET_OT_catalog_delete",
|
||||
"Delete Catalog",
|
||||
IFACE_("Delete Catalog"),
|
||||
ICON_NONE,
|
||||
nullptr,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&props);
|
||||
RNA_string_set(&props, "catalog_id", catalog_id_str_buffer);
|
||||
uiItemO(&column, "Rename", ICON_NONE, "UI_OT_view_item_rename");
|
||||
uiItemO(&column, IFACE_("Rename"), ICON_NONE, "UI_OT_view_item_rename");
|
||||
|
||||
/* Doesn't actually exist right now, but could be defined in Python. Reason that this isn't done
|
||||
* in Python yet is that catalogs are not exposed in BPY, and we'd somehow pass the clicked on
|
||||
|
||||
@@ -42,7 +42,7 @@ static void node_declare(NodeDeclarationBuilder &b)
|
||||
node_storage(node).mode = GEO_NODE_EXTRUDE_MESH_FACES;
|
||||
});
|
||||
b.add_output<decl::Geometry>("Mesh").propagate_all();
|
||||
b.add_output<decl::Bool>("Top").field_on_all();
|
||||
b.add_output<decl::Bool>("Top").field_on_all().translation_context(BLT_I18NCONTEXT_ID_NODETREE);
|
||||
b.add_output<decl::Bool>("Side").field_on_all();
|
||||
}
|
||||
|
||||
|
||||
@@ -52,8 +52,9 @@ static void node_declare(NodeDeclarationBuilder &b)
|
||||
.subtype(PROP_DISTANCE)
|
||||
.description("Height of the generated cone");
|
||||
b.add_output<decl::Geometry>("Mesh");
|
||||
b.add_output<decl::Bool>("Top").field_on_all();
|
||||
b.add_output<decl::Bool>("Bottom").field_on_all();
|
||||
b.add_output<decl::Bool>("Top").field_on_all().translation_context(BLT_I18NCONTEXT_ID_NODETREE);
|
||||
b.add_output<decl::Bool>("Bottom").field_on_all().translation_context(
|
||||
BLT_I18NCONTEXT_ID_NODETREE);
|
||||
b.add_output<decl::Bool>("Side").field_on_all();
|
||||
b.add_output<decl::Vector>("UV Map").field_on_all();
|
||||
}
|
||||
|
||||
@@ -47,9 +47,10 @@ static void node_declare(NodeDeclarationBuilder &b)
|
||||
.subtype(PROP_DISTANCE)
|
||||
.description("The height of the cylinder");
|
||||
b.add_output<decl::Geometry>("Mesh");
|
||||
b.add_output<decl::Bool>("Top").field_on_all();
|
||||
b.add_output<decl::Bool>("Top").field_on_all().translation_context(BLT_I18NCONTEXT_ID_NODETREE);
|
||||
b.add_output<decl::Bool>("Side").field_on_all();
|
||||
b.add_output<decl::Bool>("Bottom").field_on_all();
|
||||
b.add_output<decl::Bool>("Bottom").field_on_all().translation_context(
|
||||
BLT_I18NCONTEXT_ID_NODETREE);
|
||||
b.add_output<decl::Vector>("UV Map").field_on_all();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user