I18n: various fixing.
* Reflect changes stated in prev commit about contexts in py code. * Add a "Plural" context, to handle cases where english does not mark plural at all (e.g. shorten labels of only one adjective). Not so happy with that, but can't see any other way to do it, for now. * Abuse "ID_CURVE" context for all falloff curves (this should solve some confusion issues, e.g. "sharp"...).
This commit is contained in:
parent
c54fba6a11
commit
5262fcd4d3
@ -24,6 +24,7 @@ from bpy.props import (FloatProperty,
|
||||
IntProperty,
|
||||
BoolProperty,
|
||||
)
|
||||
from bpy.app.translations import pgettext_data as data_
|
||||
|
||||
from bpy_extras import object_utils
|
||||
|
||||
@ -142,7 +143,7 @@ class AddTorus(Operator, object_utils.AddObjectHelper):
|
||||
self.major_segments,
|
||||
self.minor_segments)
|
||||
|
||||
mesh = bpy.data.meshes.new("Torus")
|
||||
mesh = bpy.data.meshes.new(data_("Torus"))
|
||||
|
||||
mesh.vertices.add(len(verts_loc) // 3)
|
||||
|
||||
|
@ -20,8 +20,7 @@
|
||||
|
||||
import bpy
|
||||
from bpy.types import Panel
|
||||
|
||||
i18n_default_ctxt = bpy.app.translations.contexts.default
|
||||
from bpy.app.translations import contexts as i18n_contexts
|
||||
|
||||
|
||||
class PhysicButtonsPanel():
|
||||
@ -39,20 +38,20 @@ def physics_add(self, layout, md, name, type, typeicon, toggles):
|
||||
sub = layout.row(align=True)
|
||||
if md:
|
||||
sub.context_pointer_set("modifier", md)
|
||||
sub.operator("object.modifier_remove", text=name, text_ctxt=i18n_default_ctxt, icon='X')
|
||||
sub.operator("object.modifier_remove", text=name, text_ctxt=i18n_contexts.default, icon='X')
|
||||
if(toggles):
|
||||
sub.prop(md, "show_render", text="")
|
||||
sub.prop(md, "show_viewport", text="")
|
||||
else:
|
||||
sub.operator("object.modifier_add", text=name, text_ctxt=i18n_default_ctxt, icon=typeicon).type = type
|
||||
sub.operator("object.modifier_add", text=name, text_ctxt=i18n_contexts.default, icon=typeicon).type = type
|
||||
|
||||
|
||||
def physics_add_special(self, layout, data, name, addop, removeop, typeicon):
|
||||
sub = layout.row(align=True)
|
||||
if data:
|
||||
sub.operator(removeop, text=name, text_ctxt=i18n_default_ctxt, icon='X')
|
||||
sub.operator(removeop, text=name, text_ctxt=i18n_contexts.default, icon='X')
|
||||
else:
|
||||
sub.operator(addop, text=name, text_ctxt=i18n_default_ctxt, icon=typeicon)
|
||||
sub.operator(addop, text=name, text_ctxt=i18n_context.default, icon=typeicon)
|
||||
|
||||
|
||||
class PHYSICS_PT_add(PhysicButtonsPanel, Panel):
|
||||
|
@ -20,6 +20,7 @@
|
||||
import bpy
|
||||
from bpy.types import Header, Menu, Panel
|
||||
from bpy.app.translations import pgettext_iface as iface_
|
||||
from bpy.app.translations import contexts as i18n_contexts
|
||||
|
||||
|
||||
def ui_style_items(col, context):
|
||||
@ -528,7 +529,7 @@ class USERPREF_PT_system(Panel):
|
||||
if system.use_international_fonts:
|
||||
column.prop(system, "language")
|
||||
row = column.row()
|
||||
row.label(text="Translate:", text_ctxt=bpy.app.translations.contexts.id_windowmanager)
|
||||
row.label(text="Translate:", text_ctxt=i18n_contexts.id_windowmanager)
|
||||
row = column.row(True)
|
||||
row.prop(system, "use_translate_interface", text="Interface", toggle=True)
|
||||
row.prop(system, "use_translate_tooltips", text="Tooltips", toggle=True)
|
||||
|
@ -20,8 +20,7 @@
|
||||
import bpy
|
||||
from bpy.types import Menu
|
||||
from bpy.app.translations import pgettext_iface as iface_
|
||||
|
||||
km_i18n_context = bpy.app.translations.contexts.id_windowmanager
|
||||
from bpy.app.translations import contexts as i18n_contexts
|
||||
|
||||
|
||||
class USERPREF_MT_keyconfigs(Menu):
|
||||
@ -81,7 +80,7 @@ class InputKeyMapPanel:
|
||||
|
||||
row = col.row()
|
||||
row.prop(km, "show_expanded_children", text="", emboss=False)
|
||||
row.label(text=km.name, text_ctxt=km_i18n_context)
|
||||
row.label(text=km.name, text_ctxt=i18n_contexts.id_windowmanager)
|
||||
|
||||
row.label()
|
||||
row.label()
|
||||
@ -112,7 +111,8 @@ class InputKeyMapPanel:
|
||||
# "Add New" at end of keymap item list
|
||||
col = self.indented_layout(col, level + 1)
|
||||
subcol = col.split(percentage=0.2).column()
|
||||
subcol.operator("wm.keyitem_add", text="Add New", text_ctxt=km_i18n_context, icon='ZOOMIN')
|
||||
subcol.operator("wm.keyitem_add", text="Add New", text_ctxt=i18n_contexts.id_windowmanager,
|
||||
icon='ZOOMIN')
|
||||
|
||||
col.separator()
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
import bpy
|
||||
from bpy.types import Header, Menu, Panel
|
||||
from bl_ui.properties_paint_common import UnifiedPaintPanel
|
||||
from bpy.app.translations import contexts as i18n_contexts
|
||||
|
||||
|
||||
class VIEW3D_HT_header(Header):
|
||||
@ -994,20 +995,20 @@ class VIEW3D_MT_object_apply(Menu):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
props = layout.operator("object.transform_apply", text="Location")
|
||||
props = layout.operator("object.transform_apply", text="Location", text_ctxt=i18n_contexts.default)
|
||||
props.location, props.rotation, props.scale = True, False, False
|
||||
|
||||
props = layout.operator("object.transform_apply", text="Rotation")
|
||||
props = layout.operator("object.transform_apply", text="Rotation", text_ctxt=i18n_contexts.default)
|
||||
props.location, props.rotation, props.scale = False, True, False
|
||||
|
||||
props = layout.operator("object.transform_apply", text="Scale")
|
||||
props = layout.operator("object.transform_apply", text="Scale", text_ctxt=i18n_contexts.default)
|
||||
props.location, props.rotation, props.scale = False, False, True
|
||||
props = layout.operator("object.transform_apply", text="Rotation & Scale")
|
||||
props = layout.operator("object.transform_apply", text="Rotation & Scale", text_ctxt=i18n_contexts.default)
|
||||
props.location, props.rotation, props.scale = False, True, True
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator("object.visual_transform_apply", text="Visual Transform")
|
||||
layout.operator("object.visual_transform_apply", text="Visual Transform", text_ctxt=i18n_contexts.default)
|
||||
layout.operator("object.duplicates_make_real")
|
||||
|
||||
|
||||
@ -1657,8 +1658,6 @@ class BoneOptions:
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
default_context = bpy.app.translations.contexts.default
|
||||
|
||||
options = [
|
||||
"show_wire",
|
||||
"use_deform",
|
||||
@ -1679,7 +1678,7 @@ class BoneOptions:
|
||||
|
||||
for opt in options:
|
||||
props = layout.operator("wm.context_collection_boolean_set", text=bone_props[opt].name,
|
||||
text_ctxt=default_context)
|
||||
text_ctxt=i18n_contexts.default)
|
||||
props.data_path_iter = data_path_iter
|
||||
props.data_path_item = opt_suffix + opt
|
||||
props.type = self.type
|
||||
@ -2544,7 +2543,7 @@ class VIEW3D_PT_view3d_meshdisplay(Panel):
|
||||
col = split.column()
|
||||
col.label()
|
||||
col.prop(mesh, "show_edge_seams", text="Seams")
|
||||
col.prop(mesh, "show_edge_sharp", text="Sharp")
|
||||
col.prop(mesh, "show_edge_sharp", text="Sharp", text_ctxt=i18n_contexts.plural)
|
||||
col.prop(mesh, "show_edge_bevel_weight", text="Weights")
|
||||
|
||||
col = layout.column()
|
||||
|
@ -138,6 +138,9 @@ const char *BLF_translate_do_new_dataname(const char *msgctxt, const char *msgid
|
||||
/* Default context for operator names/labels. */
|
||||
#define BLF_I18NCONTEXT_OPERATOR_DEFAULT "Operator"
|
||||
|
||||
/* Mark the msgid applies to several elements (needed in some cases, as english adjectives have no plural mark. :( */
|
||||
#define BLF_I18NCONTEXT_PLURAL "Plural"
|
||||
|
||||
/* ID-types contexts. */
|
||||
/* WARNING! Keep it in sync with idtypes in blenkernel/intern/idcode.c */
|
||||
#define BLF_I18NCONTEXT_ID_ACTION "Action"
|
||||
@ -187,6 +190,7 @@ typedef struct
|
||||
BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_DEFAULT, "default_real"), \
|
||||
BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_DEFAULT_BPYRNA, "default"), \
|
||||
BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "operator_default"), \
|
||||
BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_PLURAL, "plural"), \
|
||||
BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_ACTION, "id_action"), \
|
||||
BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_ARMATURE, "id_armature"), \
|
||||
BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_BRUSH, "id_brush"), \
|
||||
|
@ -43,6 +43,8 @@
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_rect.h"
|
||||
|
||||
#include "BLF_translation.h"
|
||||
|
||||
#include "BKE_brush.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_DerivedMesh.h"
|
||||
@ -375,6 +377,7 @@ static int brush_curve_preset_poll(bContext *C)
|
||||
|
||||
void BRUSH_OT_curve_preset(wmOperatorType *ot)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
static EnumPropertyItem prop_shape_items[] = {
|
||||
{CURVE_PRESET_SHARP, "SHARP", 0, "Sharp", ""},
|
||||
{CURVE_PRESET_SMOOTH, "SMOOTH", 0, "Smooth", ""},
|
||||
@ -391,7 +394,8 @@ void BRUSH_OT_curve_preset(wmOperatorType *ot)
|
||||
ot->exec = brush_curve_preset_exec;
|
||||
ot->poll = brush_curve_preset_poll;
|
||||
|
||||
RNA_def_enum(ot->srna, "shape", prop_shape_items, CURVE_PRESET_SMOOTH, "Mode", "");
|
||||
prop = RNA_def_enum(ot->srna, "shape", prop_shape_items, CURVE_PRESET_SMOOTH, "Mode", "");
|
||||
RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */
|
||||
}
|
||||
|
||||
|
||||
|
@ -446,7 +446,9 @@ void Transform_Properties(struct wmOperatorType *ot, int flags)
|
||||
|
||||
if (flags & P_PROPORTIONAL) {
|
||||
RNA_def_enum(ot->srna, "proportional", proportional_editing_items, 0, "Proportional Editing", "");
|
||||
RNA_def_enum(ot->srna, "proportional_edit_falloff", proportional_falloff_items, 0, "Proportional Editing Falloff", "Falloff type for proportional editing mode");
|
||||
prop = RNA_def_enum(ot->srna, "proportional_edit_falloff", proportional_falloff_items, 0,
|
||||
"Proportional Editing Falloff", "Falloff type for proportional editing mode");
|
||||
RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */
|
||||
RNA_def_float(ot->srna, "proportional_size", 1, 0.00001f, FLT_MAX, "Proportional Size", "", 0.001, 100);
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,8 @@
|
||||
#include "DNA_object_types.h" /* SELECT */
|
||||
#include "DNA_scene_types.h"
|
||||
|
||||
#include "BLF_translation.h"
|
||||
|
||||
#include "BKE_movieclip.h"
|
||||
#include "BKE_tracking.h"
|
||||
|
||||
@ -680,6 +682,7 @@ static void rna_def_mask_layer(BlenderRNA *brna)
|
||||
RNA_def_property_enum_sdna(prop, NULL, "falloff");
|
||||
RNA_def_property_enum_items(prop, proportional_falloff_curve_only_items);
|
||||
RNA_def_property_ui_text(prop, "Falloff", "Falloff type the feather");
|
||||
RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */
|
||||
RNA_def_property_update(prop, NC_MASK | NA_EDITED, NULL);
|
||||
|
||||
}
|
||||
|
@ -889,6 +889,7 @@ static void rna_def_modifier_warp(BlenderRNA *brna)
|
||||
prop = RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_items(prop, prop_falloff_items);
|
||||
RNA_def_property_ui_text(prop, "Falloff Type", "");
|
||||
RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */
|
||||
RNA_def_property_update(prop, 0, "rna_Modifier_update");
|
||||
|
||||
prop = RNA_def_property(srna, "falloff_radius", PROP_FLOAT, PROP_UNSIGNED | PROP_DISTANCE);
|
||||
@ -2984,6 +2985,7 @@ static void rna_def_modifier_weightvgedit(BlenderRNA *brna)
|
||||
prop = RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_items(prop, weightvg_edit_falloff_type_items);
|
||||
RNA_def_property_ui_text(prop, "Falloff Type", "How weights are mapped to their new values");
|
||||
RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */
|
||||
RNA_def_property_update(prop, 0, "rna_Modifier_update");
|
||||
|
||||
prop = RNA_def_property(srna, "use_add", PROP_BOOLEAN, PROP_NONE);
|
||||
@ -3187,6 +3189,7 @@ static void rna_def_modifier_weightvgproximity(BlenderRNA *brna)
|
||||
prop = RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_items(prop, weightvg_proximity_falloff_type_items);
|
||||
RNA_def_property_ui_text(prop, "Falloff Type", "How weights are mapped to their new values");
|
||||
RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */
|
||||
RNA_def_property_update(prop, 0, "rna_Modifier_update");
|
||||
|
||||
/* Common masking properties. */
|
||||
|
@ -33,6 +33,8 @@
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BLF_translation.h"
|
||||
|
||||
#include "DNA_material_types.h"
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_node_types.h"
|
||||
@ -4028,6 +4030,7 @@ static void def_cmp_dilate_erode(StructRNA *srna)
|
||||
RNA_def_property_enum_sdna(prop, NULL, "falloff");
|
||||
RNA_def_property_enum_items(prop, proportional_falloff_curve_only_items);
|
||||
RNA_def_property_ui_text(prop, "Falloff", "Falloff type the feather");
|
||||
RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
}
|
||||
|
||||
@ -5662,6 +5665,7 @@ static void def_cmp_keying(StructRNA *srna)
|
||||
RNA_def_property_enum_sdna(prop, NULL, "feather_falloff");
|
||||
RNA_def_property_enum_items(prop, proportional_falloff_curve_only_items);
|
||||
RNA_def_property_ui_text(prop, "Feather Falloff", "Falloff type the feather");
|
||||
RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
|
||||
prop = RNA_def_property(srna, "feather_distance", PROP_INT, PROP_NONE);
|
||||
|
Loading…
Reference in New Issue
Block a user