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
This commit is contained in:
Damien Picard 2022-09-05 15:36:56 +02:00 committed by Bastien Montagne
parent dead26b577
commit 19b9ea72b0
2 changed files with 20 additions and 5 deletions

View File

@ -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")

View File

@ -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.