diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2011-10-21 00:38:26 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2011-10-21 00:38:26 +0400 |
commit | 874c96a2b9b39a2518793bebaf747e955b43d435 (patch) | |
tree | 6c2e92dc3b28c523b0d1814b10ef86836ab7da8e /source/blender/editors/space_view3d | |
parent | aba149189b7f0ee08765d2ef63a94080d02bdbf4 (diff) |
Cleaning i18n code.
Previous state:
Right now, there are "memories" of the "old" (less than a month!) translation way:
* A few remaining calls to BLF_gettext() (only UI_translate_do_iface and UI_translate_do_tooltip should be used).
* The _() macro still also calls BLF_gettext()!
New state:
Here are the changes made by the patch:
* Removing the no more needed _() macro.
* Removing most N_() and _() calls, only keeping the few needed ones (i.e. strings that are in no other way findable by xgettext and/or update_msg script).
* Defining in UI_interface.h IFACE_() and TIP_() macros (resp. for UI_translate_do_iface and UI_translate_do_tooltip).
* Replacing all calls to BLF_gettext by relevant IFACE_ or TIP_ one.
* Replacing all calls to UI_translate_do_iface by IFACE_.
* Replacing all calls to UI_translate_do_tooltip by TIP_.
All this somewhat clarifies and simplifies the code.
On the bf-translations scripts side, this only implies adding IFACE_ and TIP_ as detection markers for xgettext.
It also allows to reduce POTFILES.in quite notably (only 20 files remaining in it).
Please also have a look at those pages:
* Coder POV: http://wiki.blender.org/index.php/Dev:2.5/Source/Interface/Internationalization
* Translator POV: http://wiki.blender.org/index.php/Dev:2.5/Doc/How_to/Translate_Blender
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_header.c | 24 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_toolbar.c | 2 |
2 files changed, 9 insertions, 17 deletions
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index fd27dc65a0e..55f49654f32 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -275,22 +275,16 @@ static int modeselect_addmode(char *str, const char *title, int id, int icon) { static char formatstr[] = "|%s %%x%d %%i%d"; - if(UI_translate_iface()) - return sprintf(str, formatstr, BLF_gettext(title), id, icon); - else - return sprintf(str, formatstr, title, id, icon); + return sprintf(str, formatstr, IFACE_(title), id, icon); } static char *view3d_modeselect_pup(Scene *scene) { Object *ob= OBACT; static char string[256]; - const char *title= N_("Mode: %t"); + const char *title= IFACE_("Mode: %t"); char *str = string; - if(U.transopts&USER_TR_IFACE) - title= BLF_gettext(title); - BLI_strncpy(str, title, sizeof(string)); str += modeselect_addmode(str, N_("Object Mode"), OB_MODE_OBJECT, ICON_OBJECT_DATA); @@ -470,7 +464,6 @@ void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C) } } -#define TIP_(msgid) UI_translate_do_tooltip(msgid) void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) { bScreen *screen= CTX_wm_screen(C); @@ -504,7 +497,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) 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, TIP_(N_("Mode"))); + 0,0,126 * dpi_fac, UI_UNIT_Y, &(v3d->modeselect), 0, 0, 0, 0, TIP_("Mode")); uiBlockEndAlign(block); /* Draw type */ @@ -543,11 +536,11 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) block= uiLayoutGetBlock(row); if(v3d->twflag & V3D_USE_MANIPULATOR) { - but= uiDefIconButBitC(block, TOG, V3D_MANIP_TRANSLATE, B_MAN_TRANS, ICON_MAN_TRANS, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_(N_("Translate manipulator mode"))); + but= uiDefIconButBitC(block, TOG, V3D_MANIP_TRANSLATE, B_MAN_TRANS, ICON_MAN_TRANS, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_("Translate manipulator mode")); uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */ - but= uiDefIconButBitC(block, TOG, V3D_MANIP_ROTATE, B_MAN_ROT, ICON_MAN_ROT, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_(N_("Rotate manipulator mode"))); + but= uiDefIconButBitC(block, TOG, V3D_MANIP_ROTATE, B_MAN_ROT, ICON_MAN_ROT, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_("Rotate manipulator mode")); uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */ - but= uiDefIconButBitC(block, TOG, V3D_MANIP_SCALE, B_MAN_SCALE, ICON_MAN_SCALE, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_(N_("Scale manipulator mode"))); + but= uiDefIconButBitC(block, TOG, V3D_MANIP_SCALE, B_MAN_SCALE, ICON_MAN_SCALE, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_("Scale manipulator mode")); uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */ } @@ -555,8 +548,8 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) v3d->twmode = 0; } - str_menu = BIF_menustringTransformOrientation(C, N_("Orientation")); - but= uiDefButC(block, MENU, B_MAN_MODE, str_menu,0,0,70 * dpi_fac, UI_UNIT_Y, &v3d->twmode, 0, 0, 0, 0, TIP_(N_("Transform Orientation"))); + str_menu = BIF_menustringTransformOrientation(C, "Orientation"); + but= uiDefButC(block, MENU, B_MAN_MODE, str_menu,0,0,70 * dpi_fac, UI_UNIT_Y, &v3d->twmode, 0, 0, 0, 0, TIP_("Transform Orientation")); uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */ MEM_freeN((void *)str_menu); } @@ -576,4 +569,3 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) uiTemplateEditModeSelection(layout, C); } -#undef TIP_ diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c index ddea89e1cdb..58058722a82 100644 --- a/source/blender/editors/space_view3d/view3d_toolbar.c +++ b/source/blender/editors/space_view3d/view3d_toolbar.c @@ -82,7 +82,7 @@ static void view3d_panel_operator_redo_header(const bContext *C, Panel *pa) wmOperator *op= WM_operator_last_redo(C); if(op) BLI_strncpy(pa->drawname, op->type->name, sizeof(pa->drawname)); - else BLI_strncpy(pa->drawname, N_("Operator"), sizeof(pa->drawname)); + else BLI_strncpy(pa->drawname, IFACE_("Operator"), sizeof(pa->drawname)); } static void view3d_panel_operator_redo_operator(const bContext *C, Panel *pa, wmOperator *op) |