diff options
author | Damien Picard <pioverfour> | 2022-09-05 16:36:56 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2022-09-05 16:37:09 +0300 |
commit | 19b9ea72b00b85200da0900b327a9d37378c83f4 (patch) | |
tree | 66f24437086e0618ea6a1754a5b7651521c7db6e /release/scripts/modules/bl_i18n_utils | |
parent | dead26b5778b8bebd642884f11a254edd31c11bc (diff) |
I18n: extract keymap preferences
The per-keymap user preferences messages were not extracted. This goes
through the keymap preferences RNA, as well as Python files for UI.
Reviewed By: mont29
Differential Revision: https://developer.blender.org/D15871
Diffstat (limited to 'release/scripts/modules/bl_i18n_utils')
-rw-r--r-- | release/scripts/modules/bl_i18n_utils/bl_extract_messages.py | 24 | ||||
-rw-r--r-- | release/scripts/modules/bl_i18n_utils/settings.py | 1 |
2 files changed, 20 insertions, 5 deletions
diff --git a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py index dea538af39b..21ca38bff20 100644 --- a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py +++ b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py @@ -258,11 +258,12 @@ def dump_rna_messages(msgs, reports, settings, verbose=False): bl_rna_base_props = set() if bl_rna_base: bl_rna_base_props |= set(bl_rna_base.properties.values()) - for cls_base in cls.__bases__: - bl_rna_base = getattr(cls_base, "bl_rna", None) - if not bl_rna_base: - continue - bl_rna_base_props |= set(bl_rna_base.properties.values()) + if hasattr(cls, "__bases__"): + for cls_base in cls.__bases__: + bl_rna_base = getattr(cls_base, "bl_rna", None) + if not bl_rna_base: + continue + bl_rna_base_props |= set(bl_rna_base.properties.values()) props = sorted(bl_rna.properties, key=lambda p: p.identifier) for prop in props: @@ -450,6 +451,19 @@ def dump_rna_messages(msgs, reports, settings, verbose=False): process_msg(msgs, bpy.app.translations.contexts.operator_default, cat_str, "Generated operator category", reports, check_ctxt_rna, settings) + # Parse keymap preset preferences + for preset_filename in sorted( + os.listdir(os.path.join(settings.PRESETS_DIR, "keyconfig"))): + preset_path = os.path.join(settings.PRESETS_DIR, "keyconfig", preset_filename) + if not (os.path.isfile(preset_path) and preset_filename.endswith(".py")): + continue + preset_name, _ = os.path.splitext(preset_filename) + + bpy.utils.keyconfig_set(preset_path) + preset = bpy.data.window_managers[0].keyconfigs[preset_name] + if preset.preferences is not None: + walk_properties(preset.preferences) + # And parse keymaps! from bl_keymap_utils import keymap_hierarchy walk_keymap_hierarchy(keymap_hierarchy.generate(), "KM_HIERARCHY") diff --git a/release/scripts/modules/bl_i18n_utils/settings.py b/release/scripts/modules/bl_i18n_utils/settings.py index 05db4df7cd2..89aaa43cd52 100644 --- a/release/scripts/modules/bl_i18n_utils/settings.py +++ b/release/scripts/modules/bl_i18n_utils/settings.py @@ -544,6 +544,7 @@ CUSTOM_PY_UI_FILES = [ os.path.join("scripts", "startup", "bl_ui"), os.path.join("scripts", "startup", "bl_operators"), os.path.join("scripts", "modules", "rna_prop_ui.py"), + os.path.join("scripts", "presets", "keyconfig"), ] # An optional text file listing files to force include/exclude from py_xgettext process. |