diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2013-02-13 15:52:01 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2013-02-13 15:52:01 +0400 |
commit | 43f4f807d986f0c50a336d73b10ebcb243b142a8 (patch) | |
tree | cd82ac3b02e385122e64ffa73c391a99a6528e61 /release/scripts/startup/bl_ui/properties_physics_common.py | |
parent | 4061f96d94aa410dd8550bb6b3ed8f6f87beb5de (diff) |
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 ;) )...
Diffstat (limited to 'release/scripts/startup/bl_ui/properties_physics_common.py')
-rw-r--r-- | release/scripts/startup/bl_ui/properties_physics_common.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/release/scripts/startup/bl_ui/properties_physics_common.py b/release/scripts/startup/bl_ui/properties_physics_common.py index a640cb215ba..90cf397f526 100644 --- a/release/scripts/startup/bl_ui/properties_physics_common.py +++ b/release/scripts/startup/bl_ui/properties_physics_common.py @@ -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): |