Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2013-03-28 19:41:43 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2013-03-28 19:41:43 +0400
commit5262fcd4d3eeb96b955266c92b3cc97beb56698d (patch)
treeffe2d591cd8172f14ccd1d0eb371b616730a6f6a
parentc54fba6a1154c145a5e8a426aafeb4b8fb4269f0 (diff)
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"...).
-rw-r--r--release/scripts/startup/bl_operators/add_mesh_torus.py3
-rw-r--r--release/scripts/startup/bl_ui/properties_physics_common.py11
-rw-r--r--release/scripts/startup/bl_ui/space_userpref.py3
-rw-r--r--release/scripts/startup/bl_ui/space_userpref_keymap.py8
-rw-r--r--release/scripts/startup/bl_ui/space_view3d.py17
-rw-r--r--source/blender/blenfont/BLF_translation.h4
-rw-r--r--source/blender/editors/sculpt_paint/paint_utils.c6
-rw-r--r--source/blender/editors/transform/transform_ops.c4
-rw-r--r--source/blender/makesrna/intern/rna_mask.c3
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c3
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c4
11 files changed, 43 insertions, 23 deletions
diff --git a/release/scripts/startup/bl_operators/add_mesh_torus.py b/release/scripts/startup/bl_operators/add_mesh_torus.py
index 63e796e2b5d..948cb39f5b1 100644
--- a/release/scripts/startup/bl_operators/add_mesh_torus.py
+++ b/release/scripts/startup/bl_operators/add_mesh_torus.py
@@ -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)
diff --git a/release/scripts/startup/bl_ui/properties_physics_common.py b/release/scripts/startup/bl_ui/properties_physics_common.py
index 2d9d4649e28..d55dea58acf 100644
--- a/release/scripts/startup/bl_ui/properties_physics_common.py
+++ b/release/scripts/startup/bl_ui/properties_physics_common.py
@@ -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):
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index 2742e6d8155..8755e37c68d 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -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)
diff --git a/release/scripts/startup/bl_ui/space_userpref_keymap.py b/release/scripts/startup/bl_ui/space_userpref_keymap.py
index a13d77942eb..8d6eb2c623d 100644
--- a/release/scripts/startup/bl_ui/space_userpref_keymap.py
+++ b/release/scripts/startup/bl_ui/space_userpref_keymap.py
@@ -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()
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 5ad633069f4..48868f09129 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -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()
diff --git a/source/blender/blenfont/BLF_translation.h b/source/blender/blenfont/BLF_translation.h
index f7d2a306315..7f8082cb072 100644
--- a/source/blender/blenfont/BLF_translation.h
+++ b/source/blender/blenfont/BLF_translation.h
@@ -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"), \
diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c
index 5e88c7b5730..1dadef1e0a4 100644
--- a/source/blender/editors/sculpt_paint/paint_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_utils.c
@@ -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 :/ */
}
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index 60b0c655691..bdfd9df6246 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -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);
}
diff --git a/source/blender/makesrna/intern/rna_mask.c b/source/blender/makesrna/intern/rna_mask.c
index 72b0030ee23..c47b81ec9ca 100644
--- a/source/blender/makesrna/intern/rna_mask.c
+++ b/source/blender/makesrna/intern/rna_mask.c
@@ -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);
}
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 185968ded79..9fcb05a3dc2 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -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. */
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 96e33accad1..28278edbbf4 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -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);