[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [40345] branches/soc-2011-garlic: i18n: do not translate obect mode enum and transform orientation enum if UI translation is disabled
Sergey Sharybin
g.ulairi at gmail.com
Mon Sep 19 12:32:54 CEST 2011
Revision: 40345
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40345
Author: nazgul
Date: 2011-09-19 10:32:53 +0000 (Mon, 19 Sep 2011)
Log Message:
-----------
i18n: do not translate obect mode enum and transform orientation enum if UI translation is disabled
Modified Paths:
--------------
branches/soc-2011-garlic/release/scripts/startup/bl_ui/space_userpref.py
branches/soc-2011-garlic/source/blender/editors/interface/interface.c
branches/soc-2011-garlic/source/blender/editors/interface/interface_regions.c
branches/soc-2011-garlic/source/blender/editors/space_view3d/view3d_header.c
branches/soc-2011-garlic/source/blender/editors/transform/transform_orientations.c
Modified: branches/soc-2011-garlic/release/scripts/startup/bl_ui/space_userpref.py
===================================================================
--- branches/soc-2011-garlic/release/scripts/startup/bl_ui/space_userpref.py 2011-09-19 09:47:58 UTC (rev 40344)
+++ branches/soc-2011-garlic/release/scripts/startup/bl_ui/space_userpref.py 2011-09-19 10:32:53 UTC (rev 40345)
@@ -483,10 +483,9 @@
column.prop(system, "use_international_fonts")
if system.use_international_fonts:
- column.label(text=_("Select Language:"))
- column.prop(system, "language", text="")
- column.label(text="Translate:")
+ column.prop(system, "language")
row = column.row()
+ row.label(text="Translate:")
row.prop(system, "use_translate_interface", text="Interface")
row.prop(system, "use_translate_tooltips", text="Tooltips")
Modified: branches/soc-2011-garlic/source/blender/editors/interface/interface.c
===================================================================
--- branches/soc-2011-garlic/source/blender/editors/interface/interface.c 2011-09-19 09:47:58 UTC (rev 40344)
+++ branches/soc-2011-garlic/source/blender/editors/interface/interface.c 2011-09-19 10:32:53 UTC (rev 40345)
@@ -2686,7 +2686,7 @@
tip= ot->description;
#ifdef INTERNATIONAL
- if((U.transopts&USER_DOTRANSLATE) && (U.transopts|USER_TR_TOOLTIPS))
+ if((U.transopts&USER_DOTRANSLATE) && (U.transopts&USER_TR_TOOLTIPS))
tip= BLF_gettext(tip);
#endif
}
Modified: branches/soc-2011-garlic/source/blender/editors/interface/interface_regions.c
===================================================================
--- branches/soc-2011-garlic/source/blender/editors/interface/interface_regions.c 2011-09-19 09:47:58 UTC (rev 40344)
+++ branches/soc-2011-garlic/source/blender/editors/interface/interface_regions.c 2011-09-19 10:32:53 UTC (rev 40345)
@@ -343,6 +343,7 @@
ar->regiondata= NULL;
}
+#define U_(msgid) (((U.transopts&USER_DOTRANSLATE) && (U.transopts&USER_TR_TOOLTIPS))?BLF_gettext(msgid):(msgid))
ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
{
uiStyle *style= UI_GetStyle();
@@ -403,7 +404,7 @@
prop= (but->opptr)? but->opptr->data: NULL;
if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, buf, sizeof(buf))) {
- BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), _("Shortcut: %s"), buf);
+ BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), U_(N_("Shortcut: %s")), buf);
data->color[data->totline]= 0x888888;
data->totline++;
}
@@ -413,7 +414,7 @@
/* full string */
ui_get_but_string(but, buf, sizeof(buf));
if(buf[0]) {
- BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Value: %s", buf);
+ BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), U_(N_("Value: %s")), buf);
data->color[data->totline]= 0x888888;
data->totline++;
}
@@ -425,7 +426,7 @@
if (unit_type == PROP_UNIT_ROTATION) {
if (RNA_property_type(but->rnaprop) == PROP_FLOAT) {
float value= RNA_property_array_check(but->rnaprop) ? RNA_property_float_get_index(&but->rnapoin, but->rnaprop, but->rnaindex) : RNA_property_float_get(&but->rnapoin, but->rnaprop);
- BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Radians: %f", value);
+ BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), U_(N_("Radians: %f")), value);
data->color[data->totline]= 0x888888;
data->totline++;
}
@@ -434,7 +435,7 @@
if(but->flag & UI_BUT_DRIVEN) {
if(ui_but_anim_expression_get(but, buf, sizeof(buf))) {
/* expression */
- BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Expression: %s", buf);
+ BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), U_(N_("Expression: %s")), buf);
data->color[data->totline]= 0x888888;
data->totline++;
}
@@ -442,7 +443,7 @@
/* rna info */
if ((U.flag & USER_TOOLTIPS_PYTHON) == 0) {
- BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Python: %s.%s", RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop));
+ BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), U_(N_("Python: %s.%s")), RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop));
data->color[data->totline]= 0x888888;
data->totline++;
}
@@ -450,7 +451,7 @@
if(but->rnapoin.id.data) {
ID *id= but->rnapoin.id.data;
if(id->lib && id->lib->name) {
- BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Library: %s", id->lib->name);
+ BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), U_(N_("Library: %s")), id->lib->name);
data->color[data->totline]= 0x888888;
data->totline++;
}
@@ -465,7 +466,7 @@
/* operator info */
if ((U.flag & USER_TOOLTIPS_PYTHON) == 0) {
- BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Python: %s", str);
+ BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), U_(N_("Python: %s")), str);
data->color[data->totline]= 0x888888;
data->totline++;
}
@@ -479,7 +480,7 @@
WM_operator_poll_context(C, but->optype, but->opcontext);
poll_msg= CTX_wm_operator_poll_msg_get(C);
if(poll_msg) {
- BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Disabled: %s", poll_msg);
+ BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), U_(N_("Disabled: %s")), poll_msg);
data->color[data->totline]= 0x6666ff; /* alert */
data->totline++;
}
@@ -489,7 +490,7 @@
if ((U.flag & USER_TOOLTIPS_PYTHON) == 0) {
if(but->menu_create_func && WM_menutype_contains((MenuType *)but->poin)) {
MenuType *mt= (MenuType *)but->poin;
- BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Python: %s", mt->idname);
+ BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), U_(N_("Python: %s")), mt->idname);
data->color[data->totline]= 0x888888;
data->totline++;
}
@@ -608,6 +609,7 @@
return ar;
}
+#undef U_
void ui_tooltip_free(bContext *C, ARegion *ar)
{
Modified: branches/soc-2011-garlic/source/blender/editors/space_view3d/view3d_header.c
===================================================================
--- branches/soc-2011-garlic/source/blender/editors/space_view3d/view3d_header.c 2011-09-19 09:47:58 UTC (rev 40344)
+++ branches/soc-2011-garlic/source/blender/editors/space_view3d/view3d_header.c 2011-09-19 10:32:53 UTC (rev 40345)
@@ -271,16 +271,29 @@
RNA_def_boolean(ot->srna, "toggle", 1, "Toggle", "Toggle the layer");
}
+static int modeselect_addmode(char *str, const char *title, int id, int icon)
+{
+ static char formatstr[] = "|%s %%x%d %%i%d";
+
+ if((U.transopts&USER_DOTRANSLATE) && (U.transopts&USER_TR_IFACE))
+ return sprintf(str, formatstr, BLF_gettext(title), id, icon);
+ else
+ return sprintf(str, formatstr, title, id, icon);
+}
+
static char *view3d_modeselect_pup(Scene *scene)
{
Object *ob= OBACT;
static char string[256];
- static char formatstr[] = "|%s %%x%d %%i%d";
+ const char *title= N_("Mode: %%t");
char *str = string;
- str += sprintf(str, _("Mode: %%t"));
+ if(U.transopts&USER_TR_IFACE)
+ title= BLF_gettext(title);
+
+ sprintf(str, title);
- str += sprintf(str, formatstr, _("Object Mode"), OB_MODE_OBJECT, ICON_OBJECT_DATA);
+ str += modeselect_addmode(str, N_("Object Mode"), OB_MODE_OBJECT, ICON_OBJECT_DATA);
if(ob==NULL || ob->data==NULL) return string;
if(ob->id.lib) return string;
@@ -291,31 +304,31 @@
|| (ob->type == OB_CURVE) || (ob->type == OB_SURF) || (ob->type == OB_FONT)
|| (ob->type == OB_MBALL) || (ob->type == OB_LATTICE))) {
- str += sprintf(str, formatstr, _("Edit Mode"), OB_MODE_EDIT, ICON_EDITMODE_HLT);
+ str += modeselect_addmode(str, N_("Edit Mode"), OB_MODE_EDIT, ICON_EDITMODE_HLT);
}
else if (ob->type == OB_ARMATURE) {
if (ob->mode & OB_MODE_POSE)
- str += sprintf(str, formatstr, "Edit Mode", OB_MODE_EDIT|OB_MODE_POSE, ICON_EDITMODE_HLT);
+ str += modeselect_addmode(str, N_("Edit Mode"), OB_MODE_EDIT|OB_MODE_POSE, ICON_EDITMODE_HLT);
else
- str += sprintf(str, formatstr, "Edit Mode", OB_MODE_EDIT, ICON_EDITMODE_HLT);
+ str += modeselect_addmode(str, N_("Edit Mode"), OB_MODE_EDIT, ICON_EDITMODE_HLT);
}
if (ob->type == OB_MESH) {
- str += sprintf(str, formatstr, _("Sculpt Mode"), OB_MODE_SCULPT, ICON_SCULPTMODE_HLT);
- str += sprintf(str, formatstr, _("Vertex Paint"), OB_MODE_VERTEX_PAINT, ICON_VPAINT_HLT);
- str += sprintf(str, formatstr, _("Texture Paint"), OB_MODE_TEXTURE_PAINT, ICON_TPAINT_HLT);
- str += sprintf(str, formatstr, _("Weight Paint"), OB_MODE_WEIGHT_PAINT, ICON_WPAINT_HLT);
+ str += modeselect_addmode(str, N_("Sculpt Mode"), OB_MODE_SCULPT, ICON_SCULPTMODE_HLT);
+ str += modeselect_addmode(str, N_("Vertex Paint"), OB_MODE_VERTEX_PAINT, ICON_VPAINT_HLT);
+ str += modeselect_addmode(str, N_("Texture Paint"), OB_MODE_TEXTURE_PAINT, ICON_TPAINT_HLT);
+ str += modeselect_addmode(str, N_("Weight Paint"), OB_MODE_WEIGHT_PAINT, ICON_WPAINT_HLT);
}
}
/* if active object is an armature */
if (ob->type==OB_ARMATURE) {
- str += sprintf(str, formatstr, _("Pose Mode"), OB_MODE_POSE, ICON_POSE_HLT);
+ str += modeselect_addmode(str, N_("Pose Mode"), OB_MODE_POSE, ICON_POSE_HLT);
}
if (ob->particlesystem.first || modifiers_findByType(ob, eModifierType_Cloth) || modifiers_findByType(ob, eModifierType_Softbody)) {
- str += sprintf(str, formatstr, _("Particle Mode"), OB_MODE_PARTICLE_EDIT, ICON_PARTICLEMODE);
+ str += modeselect_addmode(str, N_("Particle Mode"), OB_MODE_PARTICLE_EDIT, ICON_PARTICLEMODE);
}
(void)str;
return (string);
@@ -457,6 +470,7 @@
}
}
+#define TIP_(msgid) (((U.transopts&USER_DOTRANSLATE) && (U.transopts&USER_TR_TOOLTIPS))?BLF_gettext(msgid):(msgid))
void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
{
bScreen *screen= CTX_wm_screen(C);
@@ -490,7 +504,7 @@
uiBlockBeginAlign(block);
uiDefIconTextButS(block, MENU, B_MODESELECT, object_mode_icon(v3d->modeselect), view3d_modeselect_pup(scene) ,
- 0,0,126 * dpi_fac, UI_UNIT_Y, &(v3d->modeselect), 0, 0, 0, 0, _("Mode"));
+ 0,0,126 * dpi_fac, UI_UNIT_Y, &(v3d->modeselect), 0, 0, 0, 0, TIP_(N_("Mode")));
uiBlockEndAlign(block);
/* Draw type */
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list