diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2012-04-14 19:06:41 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2012-04-14 19:06:41 +0400 |
commit | 310c0b9f100bbaf0c51888808fcb9fbf11ea27f9 (patch) | |
tree | f20f590aea7163dfb3d5535d7ba3515513b0a2d8 /source/blender/windowmanager | |
parent | 513f363ea05e9c9cf77588eb86dd4984f8aad60d (diff) |
Fixed another bunch of i18n bugs (thx to Leon Cheung for spotting them), among which:
* Drag'n'drop translation in Outliner
* "Execute" button in file window
* "Labels" of spacing elements, in multi-column enums
* A glitch with nodes "Value to RGB", they where called "ColorRamp" in node_type_base() call. This is not definitive, though, as it appears that UI node names are determined by this call, while it should be by "defines" in rna_nodetrre_types.h, I guess... Anyway, not good to have such things in two different places!
Also moved default context name under BLF_translation.h, much better to have those all in one place, accessible from whole Blender code!
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/WM_types.h | 3 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_dragdrop.c | 12 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 13 |
3 files changed, 16 insertions, 12 deletions
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index 4aa2c3f6405..7cbeab6a02e 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -428,9 +428,6 @@ typedef struct wmTimer { int sleep; /* internal, put timers to sleep when needed */ } wmTimer; -/* Default context for operator names/labels. */ -#define WM_OPERATOR_DEFAULT_I18NCONTEXT "Operator" - typedef struct wmOperatorType { const char *name; /* text for ui, undo */ const char *idname; /* unique identifier */ diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c index 5283bc0a7a5..bbb2a54887e 100644 --- a/source/blender/windowmanager/intern/wm_dragdrop.c +++ b/source/blender/windowmanager/intern/wm_dragdrop.c @@ -36,6 +36,8 @@ #include "MEM_guardedalloc.h" +#include "BLF_translation.h" + #include "BLI_blenlib.h" #include "BIF_gl.h" @@ -55,6 +57,8 @@ #include "UI_interface.h" #include "UI_interface_icons.h" +#include "RNA_access.h" + #include "WM_api.h" #include "WM_types.h" #include "wm_event_system.h" @@ -179,8 +183,10 @@ static const char *dropbox_active(bContext *C, ListBase *handlers, wmDrag *drag, if (handler->dropboxes) { wmDropBox *drop = handler->dropboxes->first; for (; drop; drop = drop->next) { - if (drop->poll(C, drag, event)) - return drop->ot->name; + if (drop->poll(C, drag, event)) + /* XXX Doing translation here might not be ideal, but later we have no more + * access to ot (and hence op context)... */ + return RNA_struct_ui_name(drop->ot->srna); } } } @@ -220,7 +226,7 @@ static void wm_drop_operator_options(bContext *C, wmDrag *drag, wmEvent *event) /* check buttons (XXX todo rna and value) */ if (UI_but_active_drop_name(C) ) { - strcpy(drag->opname, "Paste name"); + strcpy(drag->opname, IFACE_("Paste name")); } else { const char *opname = wm_dropbox_active(C, drag, event); diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index be7913b9181..a0992bb65bc 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -147,7 +147,7 @@ void WM_operatortype_append(void (*opfunc)(wmOperatorType *)) ot = MEM_callocN(sizeof(wmOperatorType), "operatortype"); ot->srna = RNA_def_struct(&BLENDER_RNA, "", "OperatorProperties"); /* Set the default i18n context now, so that opfunc can redefine it if needed! */ - RNA_def_struct_translation_context(ot->srna, WM_OPERATOR_DEFAULT_I18NCONTEXT); + RNA_def_struct_translation_context(ot->srna, BLF_I18NCONTEXT_OPERATOR_DEFAULT); opfunc(ot); if (ot->name == NULL) { @@ -169,7 +169,7 @@ void WM_operatortype_append_ptr(void (*opfunc)(wmOperatorType *, void *), void * ot = MEM_callocN(sizeof(wmOperatorType), "operatortype"); ot->srna = RNA_def_struct(&BLENDER_RNA, "", "OperatorProperties"); /* Set the default i18n context now, so that opfunc can redefine it if needed! */ - RNA_def_struct_translation_context(ot->srna, WM_OPERATOR_DEFAULT_I18NCONTEXT); + RNA_def_struct_translation_context(ot->srna, BLF_I18NCONTEXT_OPERATOR_DEFAULT); opfunc(ot, userdata); RNA_def_struct_ui_text(ot->srna, ot->name, ot->description ? ot->description : N_("(undocumented operator)")); RNA_def_struct_identifier(ot->srna, ot->idname); @@ -371,7 +371,7 @@ wmOperatorType *WM_operatortype_append_macro(const char *idname, const char *nam RNA_def_struct_ui_text(ot->srna, ot->name, ot->description); RNA_def_struct_identifier(ot->srna, ot->idname); - RNA_def_struct_translation_context(ot->srna, WM_OPERATOR_DEFAULT_I18NCONTEXT); + RNA_def_struct_translation_context(ot->srna, BLF_I18NCONTEXT_OPERATOR_DEFAULT); BLI_ghash_insert(global_ops_hash, (void *)ot->idname, ot); @@ -396,7 +396,7 @@ void WM_operatortype_append_macro_ptr(void (*opfunc)(wmOperatorType *, void *), ot->description = N_("(undocumented operator)"); /* Set the default i18n context now, so that opfunc can redefine it if needed! */ - RNA_def_struct_translation_context(ot->srna, WM_OPERATOR_DEFAULT_I18NCONTEXT); + RNA_def_struct_translation_context(ot->srna, BLF_I18NCONTEXT_OPERATOR_DEFAULT); opfunc(ot, userdata); RNA_def_struct_ui_text(ot->srna, ot->name, ot->description); @@ -2237,9 +2237,10 @@ static int wm_console_toggle_op(bContext *UNUSED(C), wmOperator *UNUSED(op)) static void WM_OT_console_toggle(wmOperatorType *ot) { - ot->name = "Toggle System Console"; + /* XXX Have to mark these for xgettext, as under linux they do not exists... */ + ot->name = CTX_N_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Toggle System Console"); ot->idname = "WM_OT_console_toggle"; - ot->description = "Toggle System Console"; + ot->description = N_("Toggle System Console"); ot->exec = wm_console_toggle_op; ot->poll = WM_operator_winactive; |