Fix physics' name not translated in main physics panel (reported on bf-translations ML).
This also revealed another bug, as you could not explicitely set default context to text_ctxt UI func parameter (None is not accpeted by RNA string props), so I had to change default context from py POV to "*" instead of None. Anyway, that physics UI translation remains weak, as the trick used here (helper func) prevents message extractor script to directly find them. Currently it works because specified labels are also defined elsewhere, but it would be nice to have some kind of "translation markers" in py code too (similar to our N_/CTX_N_ C macros, unfortunately python does not have preprocessing ;) )...
This commit is contained in:
@@ -21,6 +21,8 @@
|
||||
import bpy
|
||||
from bpy.types import Panel
|
||||
|
||||
i18n_default_ctxt = bpy.app.translations.contexts.default
|
||||
|
||||
|
||||
class PhysicButtonsPanel():
|
||||
bl_space_type = 'PROPERTIES'
|
||||
@@ -37,20 +39,20 @@ def physics_add(self, layout, md, name, type, typeicon, toggles):
|
||||
sub = layout.row(align=True)
|
||||
if md:
|
||||
sub.context_pointer_set("modifier", md)
|
||||
sub.operator("object.modifier_remove", text=name, icon='X')
|
||||
sub.operator("object.modifier_remove", text=name, text_ctxt=i18n_default_ctxt, icon='X')
|
||||
if(toggles):
|
||||
sub.prop(md, "show_render", text="")
|
||||
sub.prop(md, "show_viewport", text="")
|
||||
else:
|
||||
sub.operator("object.modifier_add", text=name, icon=typeicon).type = type
|
||||
sub.operator("object.modifier_add", text=name, text_ctxt=i18n_default_ctxt, icon=typeicon).type = type
|
||||
|
||||
|
||||
def physics_add_special(self, layout, data, name, addop, removeop, typeicon):
|
||||
sub = layout.row(align=True)
|
||||
if data:
|
||||
sub.operator(removeop, text=name, icon='X')
|
||||
sub.operator(removeop, text=name, text_ctxt=i18n_default_ctxt, icon='X')
|
||||
else:
|
||||
sub.operator(addop, text=name, icon=typeicon)
|
||||
sub.operator(addop, text=name, text_ctxt=i18n_default_ctxt, icon=typeicon)
|
||||
|
||||
|
||||
class PHYSICS_PT_add(PhysicButtonsPanel, Panel):
|
||||
|
Reference in New Issue
Block a user