From 19b9ea72b00b85200da0900b327a9d37378c83f4 Mon Sep 17 00:00:00 2001 From: Damien Picard Date: Mon, 5 Sep 2022 15:36:56 +0200 Subject: 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 --- .../modules/bl_i18n_utils/bl_extract_messages.py | 24 +++++++++++++++++----- release/scripts/modules/bl_i18n_utils/settings.py | 1 + 2 files changed, 20 insertions(+), 5 deletions(-) (limited to 'release') 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. -- cgit v1.2.3