I18n: improve keymap translations
- The label for modal keymaps was extracted but did not use the proper context on translation. - Same goes for modal keymap items. - Extract the UI messages from rna_keymap_ui.py - Translate global keymap names. - Use the proper context in the status bar for the tool prompt operator Ref T102071 Maniphest Tasks: T102071 Differential Revision: https://developer.blender.org/D16348
This commit is contained in:
@@ -548,6 +548,7 @@ CUSTOM_PY_UI_FILES = [
|
|||||||
os.path.join("scripts", "startup", "bl_ui"),
|
os.path.join("scripts", "startup", "bl_ui"),
|
||||||
os.path.join("scripts", "startup", "bl_operators"),
|
os.path.join("scripts", "startup", "bl_operators"),
|
||||||
os.path.join("scripts", "modules", "rna_prop_ui.py"),
|
os.path.join("scripts", "modules", "rna_prop_ui.py"),
|
||||||
|
os.path.join("scripts", "modules", "rna_keymap_ui.py"),
|
||||||
os.path.join("scripts", "presets", "keyconfig"),
|
os.path.join("scripts", "presets", "keyconfig"),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ def draw_km(display_keymaps, kc, km, children, layout, level):
|
|||||||
subcol = _indented_layout(col, level + 1)
|
subcol = _indented_layout(col, level + 1)
|
||||||
subrow = subcol.row(align=True)
|
subrow = subcol.row(align=True)
|
||||||
subrow.prop(km, "show_expanded_items", text="", emboss=False)
|
subrow.prop(km, "show_expanded_items", text="", emboss=False)
|
||||||
subrow.label(text=iface_("%s (Global)") % km.name, translate=False)
|
subrow.label(text=iface_("%s (Global)") % iface_(km.name, i18n_contexts.id_windowmanager), translate=False)
|
||||||
else:
|
else:
|
||||||
km.show_expanded_items = True
|
km.show_expanded_items = True
|
||||||
|
|
||||||
@@ -335,7 +335,8 @@ def draw_filtered(display_keymaps, filter_type, filter_text, layout):
|
|||||||
col = layout.column()
|
col = layout.column()
|
||||||
|
|
||||||
row = col.row()
|
row = col.row()
|
||||||
row.label(text=km.name, icon='DOT')
|
row.label(text=km.name, icon='DOT',
|
||||||
|
text_ctxt=i18n_contexts.id_windowmanager)
|
||||||
|
|
||||||
row.label()
|
row.label()
|
||||||
row.label()
|
row.label()
|
||||||
|
|||||||
@@ -17,8 +17,11 @@ from bpy.props import (
|
|||||||
IntVectorProperty,
|
IntVectorProperty,
|
||||||
FloatVectorProperty,
|
FloatVectorProperty,
|
||||||
)
|
)
|
||||||
from bpy.app.translations import pgettext_iface as iface_
|
from bpy.app.translations import (
|
||||||
from bpy.app.translations import pgettext_tip as tip_
|
pgettext_iface as iface_,
|
||||||
|
pgettext_tip as tip_,
|
||||||
|
contexts as i18n_contexts,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def _rna_path_prop_search_for_context_impl(context, edit_text, unique_attrs):
|
def _rna_path_prop_search_for_context_impl(context, edit_text, unique_attrs):
|
||||||
@@ -2402,7 +2405,9 @@ class WM_OT_toolbar_prompt(Operator):
|
|||||||
flow = layout.grid_flow(columns=len(status_items), align=True, row_major=True)
|
flow = layout.grid_flow(columns=len(status_items), align=True, row_major=True)
|
||||||
for _, name, item in status_items:
|
for _, name, item in status_items:
|
||||||
row = flow.row(align=True)
|
row = flow.row(align=True)
|
||||||
row.template_event_from_keymap_item(item, text=name)
|
row.template_event_from_keymap_item(
|
||||||
|
item, text=name, text_ctxt=i18n_contexts.operator_default
|
||||||
|
)
|
||||||
|
|
||||||
self._keymap = keymap
|
self._keymap = keymap
|
||||||
|
|
||||||
|
|||||||
@@ -2807,6 +2807,7 @@ static void rna_def_keyconfig(BlenderRNA *brna)
|
|||||||
RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_KeyMapItem_propvalue_itemf");
|
RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_KeyMapItem_propvalue_itemf");
|
||||||
RNA_def_property_ui_text(
|
RNA_def_property_ui_text(
|
||||||
prop, "Property Value", "The value this event translates to in a modal keymap");
|
prop, "Property Value", "The value this event translates to in a modal keymap");
|
||||||
|
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_WINDOWMANAGER);
|
||||||
RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
|
RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
|
||||||
|
|
||||||
prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
|
prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
|
||||||
|
|||||||
Reference in New Issue
Block a user