From 3b5f7b0052adfb2cb09fb828c6c514aa6c149744 Mon Sep 17 00:00:00 2001 From: Damien Picard Date: Wed, 5 Jun 2024 01:44:46 +0200 Subject: [PATCH] I18n: Restore keyconfig after extracting messages The translation extraction goes through each keyconfig preset file and activates it in order to extract its messages. This change makes it restore the original config, otherwise it would end up switching to Industry Compatible. Pull Request: https://projects.blender.org/blender/blender/pulls/122789 --- scripts/modules/bl_i18n_utils/bl_extract_messages.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/modules/bl_i18n_utils/bl_extract_messages.py b/scripts/modules/bl_i18n_utils/bl_extract_messages.py index d3994e357b7..d6e1d80f197 100644 --- a/scripts/modules/bl_i18n_utils/bl_extract_messages.py +++ b/scripts/modules/bl_i18n_utils/bl_extract_messages.py @@ -455,6 +455,7 @@ def dump_rna_messages(msgs, reports, settings, verbose=False): walk_class(cls) # Parse keymap preset preferences + active_keyconfig = bpy.context.window_manager.keyconfigs.active.name 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) @@ -466,6 +467,10 @@ def dump_rna_messages(msgs, reports, settings, verbose=False): preset = bpy.data.window_managers[0].keyconfigs[preset_name] if preset.preferences is not None: walk_properties(preset.preferences) + # Restore original keyconfig + bpy.utils.keyconfig_set( + os.path.join(settings.PRESETS_DIR, "keyconfig", active_keyconfig + ".py") + ) # And parse keymaps! from bl_keymap_utils import keymap_hierarchy