diff options
author | Damien Picard <pioverfour> | 2022-08-01 15:09:41 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2022-08-01 15:09:41 +0300 |
commit | 3239cea726c7409f9fc6be53c078c3087a76c233 (patch) | |
tree | 5272b99d99963bf4c200418090446e29e6a5f91e /release/scripts/modules/bpy_types.py | |
parent | 543b47f1628487548888ab6f4a13e8556dc84509 (diff) |
I18n: make presets translatable
Presets are used all over the Blender UI, but were so far untranslatable.
This adds the translation code as well as a new `dump_preset_messages()` function in the message extraction. This goes over all bundled preset file names and extracts them.
Reviewed By: mont29
Differential Revision: https://developer.blender.org/D15570
Diffstat (limited to 'release/scripts/modules/bpy_types.py')
-rw-r--r-- | release/scripts/modules/bpy_types.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py index df0631ec26d..87b32eb1f40 100644 --- a/release/scripts/modules/bpy_types.py +++ b/release/scripts/modules/bpy_types.py @@ -1074,6 +1074,7 @@ class Menu(StructRNA, _GenericUI, metaclass=RNAMeta): - preset_operator_defaults (dict of keyword args) """ import bpy + from bpy.app.translations import pgettext_iface as iface_ ext_valid = getattr(self, "preset_extensions", {".py", ".xml"}) props_default = getattr(self, "preset_operator_defaults", None) add_operator = getattr(self, "preset_add_operator", None) @@ -1083,7 +1084,8 @@ class Menu(StructRNA, _GenericUI, metaclass=RNAMeta): props_default=props_default, filter_ext=lambda ext: ext.lower() in ext_valid, add_operator=add_operator, - display_name=lambda name: bpy.path.display_name(name, title_case=False) + display_name=lambda name: iface_( + bpy.path.display_name(name, title_case=False)) ) @classmethod |