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-20 22:42:09 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2013-03-20 22:42:09 +0400
commit885441e75804a92d4c2270fd006f3e71fc460d7b (patch)
tree7d3e89d07af080a2146eb747ff9da6ecd9d0e7f9 /source/blender/blenkernel
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/blender/blenkernel')
-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
4 files changed, 28 insertions, 20 deletions
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;