From 284e59d608a90589956780fe1dd81ecc2ba11362 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Fri, 15 Mar 2013 14:32:29 +0000 Subject: Add the possibility to define the translation context for py rna classes (operators, panels and menus). Thanks to Campell and Brecht for the reviews! --- source/blender/python/intern/bpy_operator_wrap.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source/blender/python/intern/bpy_operator_wrap.c') diff --git a/source/blender/python/intern/bpy_operator_wrap.c b/source/blender/python/intern/bpy_operator_wrap.c index 9d92ff51213..1c722243424 100644 --- a/source/blender/python/intern/bpy_operator_wrap.c +++ b/source/blender/python/intern/bpy_operator_wrap.c @@ -127,6 +127,11 @@ void operator_wrapper(wmOperatorType *ot, void *userdata) *ot = *((wmOperatorType *)userdata); ot->srna = srna; /* restore */ + /* Use i18n context from ext.srna if possible (py operators). */ + if (ot->ext.srna) { + RNA_def_struct_translation_context(ot->srna, RNA_struct_translation_context(ot->ext.srna)); + } + operator_properties_init(ot); } @@ -143,6 +148,11 @@ void macro_wrapper(wmOperatorType *ot, void *userdata) ot->ui = data->ui; ot->ext = data->ext; + /* Use i18n context from ext.srna if possible (py operators). */ + if (ot->ext.srna) { + RNA_def_struct_translation_context(ot->srna, RNA_struct_translation_context(ot->ext.srna)); + } + operator_properties_init(ot); } -- cgit v1.2.3