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
path: root/source
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2013-03-20 22:42:09 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2013-03-20 22:42:09 +0400
commit885441e75804a92d4c2270fd006f3e71fc460d7b (patch)
tree7d3e89d07af080a2146eb747ff9da6ecd9d0e7f9 /source
parente9b0b402cc85533c8b247b174f17f41b1892ef04 (diff)
I18n users request: add the ability to use a translated name for newly added/created objects or other datablocks.
This simply adds a third "translation type" (in addition to iface and tip), "new data", with relevant user settings flag and helper funcs/macros (and py api). Currently implemented name translation when adding new objects, as well as modifiers and constraints, will add the others (cd layers, scenes, perhaps nodes [though I think they do not need this], etc.) later.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenfont/BLF_translation.h6
-rw-r--r--source/blender/blenfont/intern/blf_translation.c24
-rw-r--r--source/blender/blenkernel/intern/constraint.c6
-rw-r--r--source/blender/blenkernel/intern/modifier.c2
-rw-r--r--source/blender/blenkernel/intern/object.c26
-rw-r--r--source/blender/blenkernel/intern/particle.c14
-rw-r--r--source/blender/editors/curve/editcurve.c28
-rw-r--r--source/blender/editors/mesh/editmesh_add.c20
-rw-r--r--source/blender/editors/object/object_add.c18
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h9
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c9
-rw-r--r--source/blender/python/intern/bpy_app_translations.c49
12 files changed, 139 insertions, 72 deletions
diff --git a/source/blender/blenfont/BLF_translation.h b/source/blender/blenfont/BLF_translation.h
index 379978feca3..f59d3409b65 100644
--- a/source/blender/blenfont/BLF_translation.h
+++ b/source/blender/blenfont/BLF_translation.h
@@ -77,8 +77,10 @@ const char *BLF_pgettext(const char *msgctxt, const char *msgid);
/* translation */
bool BLF_translate_iface(void);
bool BLF_translate_tooltips(void);
+bool BLF_translate_new_dataname(void);
const char *BLF_translate_do_iface(const char *msgctxt, const char *msgid);
const char *BLF_translate_do_tooltip(const char *msgctxt, const char *msgid);
+const char *BLF_translate_do_new_dataname(const char *msgctxt, const char *msgid);
/* The "translation-marker" macro. */
@@ -90,14 +92,18 @@ const char *BLF_translate_do_tooltip(const char *msgctxt, const char *msgid);
/*# define _(msgid) BLF_gettext(msgid) */
# define IFACE_(msgid) BLF_translate_do_iface(NULL, msgid)
# define TIP_(msgid) BLF_translate_do_tooltip(NULL, msgid)
+# define DATA_(msgid) BLF_translate_do_new_dataname(NULL, msgid)
# define CTX_IFACE_(context, msgid) BLF_translate_do_iface(context, msgid)
# define CTX_TIP_(context, msgid) BLF_translate_do_tooltip(context, msgid)
+# define CTX_DATA_(context, msgid) BLF_translate_do_new_dataname(context, msgid)
#else
/*# define _(msgid) msgid */
# define IFACE_(msgid) msgid
# define TIP_(msgid) msgid
+# define DATA_(msgid) msgid
# define CTX_IFACE_(context, msgid) msgid
# define CTX_TIP_(context, msgid) msgid
+# define CTX_DATA_(context, msgid) msgid
#endif
/* Helper macro, when we want to define a same msgid for multiple msgctxt...
diff --git a/source/blender/blenfont/intern/blf_translation.c b/source/blender/blenfont/intern/blf_translation.c
index 0cd6bf56c2f..57f442f8bfc 100644
--- a/source/blender/blenfont/intern/blf_translation.c
+++ b/source/blender/blenfont/intern/blf_translation.c
@@ -177,6 +177,15 @@ bool BLF_translate_tooltips(void)
#endif
}
+bool BLF_translate_new_dataname(void)
+{
+#ifdef WITH_INTERNATIONAL
+ return (U.transopts & USER_DOTRANSLATE) && (U.transopts & USER_TR_NEWDATANAME);
+#else
+ return false;
+#endif
+}
+
const char *BLF_translate_do_iface(const char *msgctxt, const char *msgid)
{
#ifdef WITH_INTERNATIONAL
@@ -206,3 +215,18 @@ const char *BLF_translate_do_tooltip(const char *msgctxt, const char *msgid)
return msgid;
#endif
}
+
+const char *BLF_translate_do_new_dataname(const char *msgctxt, const char *msgid)
+{
+#ifdef WITH_INTERNATIONAL
+ if (BLF_translate_new_dataname()) {
+ return BLF_pgettext(msgctxt, msgid);
+ }
+ else {
+ return msgid;
+ }
+#else
+ (void)msgctxt;
+ return msgid;
+#endif
+}
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 3430c2ea7a1..dc47ff40863 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -43,6 +43,8 @@
#include "BLI_kdopbvh.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
+
#include "DNA_armature_types.h"
#include "DNA_camera_types.h"
#include "DNA_constraint_types.h"
@@ -4353,12 +4355,12 @@ static bConstraint *add_new_constraint_internal(const char *name, short type)
cti->new_data(con->data);
/* if no name is provided, use the type of the constraint as the name */
- newName = (name && name[0]) ? name : cti->name;
+ newName = (name && name[0]) ? name : DATA_(cti->name);
}
else {
/* if no name is provided, use the generic "Const" name */
/* NOTE: any constraint type that gets here really shouldn't get added... */
- newName = (name && name[0]) ? name : "Const";
+ newName = (name && name[0]) ? name : DATA_("Const");
}
/* copy the name */
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index b0566a6495f..9b8101cdad4 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -95,7 +95,7 @@ ModifierData *modifier_new(int type)
ModifierData *md = MEM_callocN(mti->structSize, mti->structName);
/* note, this name must be made unique later */
- BLI_strncpy(md->name, mti->name, sizeof(md->name));
+ BLI_strncpy(md->name, DATA_(mti->name), sizeof(md->name));
md->type = type;
md->mode = eModifierMode_Realtime | eModifierMode_Render | eModifierMode_Expanded;
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index c93da151463..55ec5db419d 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -65,6 +65,8 @@
#include "BLI_utildefines.h"
#include "BLI_linklist.h"
+#include "BLF_translation.h"
+
#include "BKE_pbvh.h"
#include "BKE_main.h"
#include "BKE_global.h"
@@ -855,20 +857,20 @@ void *BKE_object_obdata_add_from_type(int type)
static const char *get_obdata_defname(int type)
{
switch (type) {
- case OB_MESH: return "Mesh";
- case OB_CURVE: return "Curve";
- case OB_SURF: return "Surf";
- case OB_FONT: return "Text";
- case OB_MBALL: return "Mball";
- case OB_CAMERA: return "Camera";
- case OB_LAMP: return "Lamp";
- case OB_LATTICE: return "Lattice";
- case OB_ARMATURE: return "Armature";
- case OB_SPEAKER: return "Speaker";
- case OB_EMPTY: return "Empty";
+ case OB_MESH: return DATA_("Mesh");
+ case OB_CURVE: return DATA_("Curve");
+ case OB_SURF: return DATA_("Surf");
+ case OB_FONT: return DATA_("Text");
+ case OB_MBALL: return DATA_("Mball");
+ case OB_CAMERA: return DATA_("Camera");
+ case OB_LAMP: return DATA_("Lamp");
+ case OB_LATTICE: return DATA_("Lattice");
+ case OB_ARMATURE: return DATA_("Armature");
+ case OB_SPEAKER: return DATA_("Speaker");
+ case OB_EMPTY: return DATA_("Empty");
default:
printf("get_obdata_defname: Internal error, bad type: %d\n", type);
- return "Empty";
+ return DATA_("Empty");
}
}
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index f90fde983aa..d9dabf24ba0 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -56,6 +56,8 @@
#include "BLI_threads.h"
#include "BLI_linklist.h"
+#include "BLF_translation.h"
+
#include "BKE_anim.h"
#include "BKE_animsys.h"
@@ -3488,17 +3490,19 @@ ModifierData *object_add_particle_system(Scene *scene, Object *ob, const char *n
psys->pointcache = BKE_ptcache_add(&psys->ptcaches);
BLI_addtail(&ob->particlesystem, psys);
- psys->part = psys_new_settings("ParticleSettings", NULL);
+ psys->part = psys_new_settings(DATA_("ParticleSettings"), NULL);
if (BLI_countlist(&ob->particlesystem) > 1)
- BLI_snprintf(psys->name, sizeof(psys->name), "ParticleSystem %i", BLI_countlist(&ob->particlesystem));
+ BLI_snprintf(psys->name, sizeof(psys->name), DATA_("ParticleSystem %i"), BLI_countlist(&ob->particlesystem));
else
- strcpy(psys->name, "ParticleSystem");
+ strcpy(psys->name, DATA_("ParticleSystem"));
md = modifier_new(eModifierType_ParticleSystem);
- if (name) BLI_strncpy_utf8(md->name, name, sizeof(md->name));
- else BLI_snprintf(md->name, sizeof(md->name), "ParticleSystem %i", BLI_countlist(&ob->particlesystem));
+ if (name)
+ BLI_strncpy_utf8(md->name, name, sizeof(md->name));
+ else
+ BLI_snprintf(md->name, sizeof(md->name), DATA_("ParticleSystem %i"), BLI_countlist(&ob->particlesystem));
modifier_unique_name(&ob->modifiers, md);
psmd = (ParticleSystemModifierData *) md;
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 5c8a755b391..8bd1830a289 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -6150,20 +6150,20 @@ static const char *get_curve_defname(int type)
if ((type & CU_TYPE) == CU_BEZIER) {
switch (stype) {
- case CU_PRIM_CURVE: return "BezierCurve";
- case CU_PRIM_CIRCLE: return "BezierCircle";
- case CU_PRIM_PATH: return "CurvePath";
+ case CU_PRIM_CURVE: return DATA_("BezierCurve");
+ case CU_PRIM_CIRCLE: return DATA_("BezierCircle");
+ case CU_PRIM_PATH: return DATA_("CurvePath");
default:
- return "Curve";
+ return DATA_("Curve");
}
}
else {
switch (stype) {
- case CU_PRIM_CURVE: return "NurbsCurve";
- case CU_PRIM_CIRCLE: return "NurbsCircle";
- case CU_PRIM_PATH: return "NurbsPath";
+ case CU_PRIM_CURVE: return DATA_("NurbsCurve");
+ case CU_PRIM_CIRCLE: return DATA_("NurbsCircle");
+ case CU_PRIM_PATH: return DATA_("NurbsPath");
default:
- return "Curve";
+ return DATA_("Curve");
}
}
}
@@ -6173,13 +6173,13 @@ static const char *get_surf_defname(int type)
int stype = type & CU_PRIMITIVE;
switch (stype) {
- case CU_PRIM_CURVE: return "SurfCurve";
- case CU_PRIM_CIRCLE: return "SurfCircle";
- case CU_PRIM_PATCH: return "SurfPatch";
- case CU_PRIM_SPHERE: return "SurfSphere";
- case CU_PRIM_DONUT: return "SurfTorus";
+ case CU_PRIM_CURVE: return DATA_("SurfCurve");
+ case CU_PRIM_CIRCLE: return DATA_("SurfCircle");
+ case CU_PRIM_PATCH: return DATA_("SurfPatch");
+ case CU_PRIM_SPHERE: return DATA_("SurfSphere");
+ case CU_PRIM_DONUT: return DATA_("SurfTorus");
default:
- return "Surface";
+ return DATA_("Surface");
}
}
diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c
index bcff5adb345..29a7b599983 100644
--- a/source/blender/editors/mesh/editmesh_add.c
+++ b/source/blender/editors/mesh/editmesh_add.c
@@ -34,6 +34,8 @@
#include "BLI_math.h"
+#include "BLF_translation.h"
+
#include "BKE_context.h"
#include "BKE_library.h"
#include "BKE_tessmesh.h"
@@ -106,7 +108,7 @@ static int add_primitive_plane_exec(bContext *C, wmOperator *op)
unsigned int layer;
ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL);
- obedit = make_prim_init(C, "Plane", &dia, mat, &state, loc, rot, layer);
+ obedit = make_prim_init(C, DATA_("Plane"), &dia, mat, &state, loc, rot, layer);
em = BMEdit_FromObject(obedit);
if (!EDBM_op_call_and_selectf(em, op, "verts.out",
@@ -147,7 +149,7 @@ static int add_primitive_cube_exec(bContext *C, wmOperator *op)
unsigned int layer;
ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL);
- obedit = make_prim_init(C, "Cube", &dia, mat, &state, loc, rot, layer);
+ obedit = make_prim_init(C, DATA_("Cube"), &dia, mat, &state, loc, rot, layer);
em = BMEdit_FromObject(obedit);
if (!EDBM_op_call_and_selectf(em, op, "verts.out", "create_cube matrix=%m4 size=%f", mat, dia * 2.0f)) {
@@ -196,7 +198,7 @@ static int add_primitive_circle_exec(bContext *C, wmOperator *op)
cap_tri = (cap_end == 2);
ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL);
- obedit = make_prim_init(C, "Circle", &dia, mat, &state, loc, rot, layer);
+ obedit = make_prim_init(C, DATA_("Circle"), &dia, mat, &state, loc, rot, layer);
em = BMEdit_FromObject(obedit);
if (!EDBM_op_call_and_selectf(em, op, "verts.out",
@@ -251,7 +253,7 @@ static int add_primitive_cylinder_exec(bContext *C, wmOperator *op)
cap_tri = (cap_end == 2);
ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL);
- obedit = make_prim_init(C, "Cylinder", &dia, mat, &state, loc, rot, layer);
+ obedit = make_prim_init(C, DATA_("Cylinder"), &dia, mat, &state, loc, rot, layer);
em = BMEdit_FromObject(obedit);
if (!EDBM_op_call_and_selectf(
@@ -312,7 +314,7 @@ static int add_primitive_cone_exec(bContext *C, wmOperator *op)
cap_tri = (cap_end == 2);
ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL);
- obedit = make_prim_init(C, "Cone", &dia, mat, &state, loc, rot, layer);
+ obedit = make_prim_init(C, DATA_("Cone"), &dia, mat, &state, loc, rot, layer);
em = BMEdit_FromObject(obedit);
if (!EDBM_op_call_and_selectf(
@@ -369,7 +371,7 @@ static int add_primitive_grid_exec(bContext *C, wmOperator *op)
unsigned int layer;
ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL);
- obedit = make_prim_init(C, "Grid", &dia, mat, &state, loc, rot, layer);
+ obedit = make_prim_init(C, DATA_("Grid"), &dia, mat, &state, loc, rot, layer);
em = BMEdit_FromObject(obedit);
if (!EDBM_op_call_and_selectf(em, op, "verts.out",
@@ -425,7 +427,7 @@ static int add_primitive_monkey_exec(bContext *C, wmOperator *op)
if (!view_aligned)
rot[0] += (float)M_PI / 2.0f;
- obedit = make_prim_init(C, "Suzanne", &dia, mat, &state, loc, rot, layer);
+ obedit = make_prim_init(C, DATA_("Suzanne"), &dia, mat, &state, loc, rot, layer);
mat[0][0] *= dia;
mat[1][1] *= dia;
mat[2][2] *= dia;
@@ -468,7 +470,7 @@ static int add_primitive_uvsphere_exec(bContext *C, wmOperator *op)
unsigned int layer;
ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL);
- obedit = make_prim_init(C, "Sphere", &dia, mat, &state, loc, rot, layer);
+ obedit = make_prim_init(C, DATA_("Sphere"), &dia, mat, &state, loc, rot, layer);
em = BMEdit_FromObject(obedit);
if (!EDBM_op_call_and_selectf(em, op, "verts.out",
@@ -520,7 +522,7 @@ static int add_primitive_icosphere_exec(bContext *C, wmOperator *op)
unsigned int layer;
ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL);
- obedit = make_prim_init(C, "Icosphere", &dia, mat, &state, loc, rot, layer);
+ obedit = make_prim_init(C, DATA_("Icosphere"), &dia, mat, &state, loc, rot, layer);
em = BMEdit_FromObject(obedit);
if (!EDBM_op_call_and_selectf(
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 312cceac77d..1cc428b3deb 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -452,7 +452,7 @@ static int effector_add_exec(bContext *C, wmOperator *op)
if (!ob)
return OPERATOR_CANCELLED;
- rename_id(&ob->id, "CurveGuide");
+ rename_id(&ob->id, DATA_("CurveGuide"));
((Curve *)ob->data)->flag |= CU_PATH | CU_3D;
ED_object_enter_editmode(C, 0);
ED_object_new_primitive_matrix(C, ob, loc, rot, mat, FALSE);
@@ -465,7 +465,7 @@ static int effector_add_exec(bContext *C, wmOperator *op)
if (!ob)
return OPERATOR_CANCELLED;
- rename_id(&ob->id, "Field");
+ rename_id(&ob->id, DATA_("Field"));
if (ELEM(type, PFIELD_WIND, PFIELD_VORTEX))
ob->empty_drawtype = OB_SINGLE_ARROW;
}
@@ -822,13 +822,13 @@ void OBJECT_OT_drop_named_image(wmOperatorType *ot)
static const char *get_lamp_defname(int type)
{
switch (type) {
- case LA_LOCAL: return "Point";
- case LA_SUN: return "Sun";
- case LA_SPOT: return "Spot";
- case LA_HEMI: return "Hemi";
- case LA_AREA: return "Area";
+ case LA_LOCAL: return DATA_("Point");
+ case LA_SUN: return DATA_("Sun");
+ case LA_SPOT: return DATA_("Spot");
+ case LA_HEMI: return DATA_("Hemi");
+ case LA_AREA: return DATA_("Area");
default:
- return "Lamp";
+ return DATA_("Lamp");
}
}
@@ -980,7 +980,7 @@ static int object_speaker_add_exec(bContext *C, wmOperator *op)
BKE_nlatrack_add_strip(nlt, strip);
/* auto-name the strip, and give the track an interesting name */
- strcpy(nlt->name, "SoundTrack");
+ strcpy(nlt->name, DATA_("SoundTrack"));
BKE_nlastrip_validate_name(adt, strip);
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 5a16ff39e68..e459347c4e3 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -606,12 +606,13 @@ typedef enum eAutokey_Flag {
typedef enum eUserpref_Translation_Flags {
USER_TR_TOOLTIPS = (1 << 0),
USER_TR_IFACE = (1 << 1),
-/* USER_TR_MENUS = (1 << 2) deprecated */
-/* USER_TR_FILESELECT = (1 << 3) deprecated */
-/* USER_TR_TEXTEDIT = (1 << 4) deprecated */
+/* USER_TR_MENUS = (1 << 2), deprecated */
+/* USER_TR_FILESELECT = (1 << 3), deprecated */
+/* USER_TR_TEXTEDIT = (1 << 4), deprecated */
USER_DOTRANSLATE = (1 << 5),
USER_USETEXTUREFONT = (1 << 6),
-/* CONVERT_TO_UTF8 = (1 << 7) deprecated */
+/* CONVERT_TO_UTF8 = (1 << 7), deprecated */
+ USER_TR_NEWDATANAME = (1 << 8),
} eUserpref_Translation_Flags;
/* dupflag */
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 58685229b44..847c9021ec6 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -3366,12 +3366,17 @@ static void rna_def_userdef_system(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_translate_tooltips", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "transopts", USER_TR_TOOLTIPS);
- RNA_def_property_ui_text(prop, "Translate Tooltips", "Translate Tooltips");
+ RNA_def_property_ui_text(prop, "Translate Tooltips", "Translate tooltips");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "use_translate_interface", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "transopts", USER_TR_IFACE);
- RNA_def_property_ui_text(prop, "Translate Interface", "Translate Interface");
+ RNA_def_property_ui_text(prop, "Translate Interface", "Translate interface");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop = RNA_def_property(srna, "use_translate_new_dataname", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "transopts", USER_TR_NEWDATANAME);
+ RNA_def_property_ui_text(prop, "Translate New Names", "Translate new data names (when adding/creating some)");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "use_textured_fonts", PROP_BOOLEAN, PROP_NONE);
diff --git a/source/blender/python/intern/bpy_app_translations.c b/source/blender/python/intern/bpy_app_translations.c
index 83e9d850ba0..a1751d9717c 100644
--- a/source/blender/python/intern/bpy_app_translations.c
+++ b/source/blender/python/intern/bpy_app_translations.c
@@ -570,7 +570,7 @@ static PyObject *app_translations_pgettext_iface(BlenderAppTranslations *UNUSED(
}
PyDoc_STRVAR(app_translations_pgettext_tip_doc,
-".. method:: pgettext(msgid, msgctxt)\n"
+".. method:: pgettext_tip(msgid, msgctxt)\n"
"\n"
" Try to translate the given msgid (with optional msgctxt), if tooltips' translation is enabled.\n"
" NOTE: See pgettext notes.\n"
@@ -588,6 +588,25 @@ static PyObject *app_translations_pgettext_tip(BlenderAppTranslations *UNUSED(se
return _py_pgettext(args, kw, BLF_translate_do_tooltip);
}
+PyDoc_STRVAR(app_translations_pgettext_data_doc,
+".. method:: pgettext_data(msgid, msgctxt)\n"
+"\n"
+" Try to translate the given msgid (with optional msgctxt), if new data name's translation is enabled.\n"
+" NOTE: See pgettext notes.\n"
+"\n"
+" :arg msgid: The string to translate.\n"
+" :type msgid: string\n"
+" :arg msgctxt: The translation context.\n"
+" :type msgctxt: string or None\n"
+" :default msgctxt: BLF_I18NCONTEXT_DEFAULT value.\n"
+" :return: The translated string (or msgid if no translation was found).\n"
+"\n"
+);
+static PyObject *app_translations_pgettext_data(BlenderAppTranslations *UNUSED(self), PyObject *args, PyObject *kw)
+{
+ return _py_pgettext(args, kw, BLF_translate_do_new_dataname);
+}
+
PyDoc_STRVAR(app_translations_locale_explode_doc,
".. method:: locale_explode(locale)\n"
"\n"
@@ -620,18 +639,20 @@ static PyObject *app_translations_locale_explode(BlenderAppTranslations *UNUSED(
PyMethodDef app_translations_methods[] = {
/* Can't use METH_KEYWORDS alone, see http://bugs.python.org/issue11587 */
- {(char *)"register", (PyCFunction)app_translations_py_messages_register, METH_VARARGS | METH_KEYWORDS,
- app_translations_py_messages_register_doc},
- {(char *)"unregister", (PyCFunction)app_translations_py_messages_unregister, METH_VARARGS | METH_KEYWORDS,
- app_translations_py_messages_unregister_doc},
- {(char *)"pgettext", (PyCFunction)app_translations_pgettext, METH_VARARGS | METH_KEYWORDS | METH_STATIC,
- app_translations_pgettext_doc},
- {(char *)"pgettext_iface", (PyCFunction)app_translations_pgettext_iface, METH_VARARGS | METH_KEYWORDS | METH_STATIC,
- app_translations_pgettext_iface_doc},
- {(char *)"pgettext_tip", (PyCFunction)app_translations_pgettext_tip, METH_VARARGS | METH_KEYWORDS | METH_STATIC,
- app_translations_pgettext_tip_doc},
- {(char *)"locale_explode", (PyCFunction)app_translations_locale_explode, METH_VARARGS | METH_KEYWORDS | METH_STATIC,
- app_translations_locale_explode_doc},
+ {"register", (PyCFunction)app_translations_py_messages_register, METH_VARARGS | METH_KEYWORDS,
+ app_translations_py_messages_register_doc},
+ {"unregister", (PyCFunction)app_translations_py_messages_unregister, METH_VARARGS | METH_KEYWORDS,
+ app_translations_py_messages_unregister_doc},
+ {"pgettext", (PyCFunction)app_translations_pgettext, METH_VARARGS | METH_KEYWORDS | METH_STATIC,
+ app_translations_pgettext_doc},
+ {"pgettext_iface", (PyCFunction)app_translations_pgettext_iface, METH_VARARGS | METH_KEYWORDS | METH_STATIC,
+ app_translations_pgettext_iface_doc},
+ {"pgettext_tip", (PyCFunction)app_translations_pgettext_tip, METH_VARARGS | METH_KEYWORDS | METH_STATIC,
+ app_translations_pgettext_tip_doc},
+ {"pgettext_data", (PyCFunction)app_translations_pgettext_data, METH_VARARGS | METH_KEYWORDS | METH_STATIC,
+ app_translations_pgettext_data_doc},
+ {"locale_explode", (PyCFunction)app_translations_locale_explode, METH_VARARGS | METH_KEYWORDS | METH_STATIC,
+ app_translations_locale_explode_doc},
{NULL}
};
@@ -697,7 +718,7 @@ PyDoc_STRVAR(app_translations_doc,
static PyTypeObject BlenderAppTranslationsType = {
PyVarObject_HEAD_INIT(NULL, 0)
/* tp_name */
- (char *)"bpy.app._translations_type",
+ "bpy.app._translations_type",
/* tp_basicsize */
sizeof(BlenderAppTranslations),
0, /* tp_itemsize */