I18n: use id_windowmanager context for keymap idnames. Solves some issues with those names (notably "Clip" one, and "Screen" too) in some translations. Also move "Key" as "Keyboard" (opposed to "Keyframe") to same context.

This commit is contained in:
Bastien Montagne
2013-03-25 11:35:42 +00:00
parent 2cd0f0d2fe
commit 4cb9414b39
4 changed files with 8 additions and 5 deletions

View File

@@ -365,9 +365,10 @@ def dump_messages_rna(msgs, reports, settings):
walk_properties(cls)
def walk_keymap_hierarchy(hier, msgsrc_prev):
km_i18n_context = bpy.app.translations.contexts.id_windowmanager
for lvl in hier:
msgsrc = msgsrc_prev + "." + lvl[1]
process_msg(msgs, default_context, lvl[0], msgsrc, reports, None, settings)
process_msg(msgs, km_i18n_context, lvl[0], msgsrc, reports, None, settings)
if lvl[3]:
walk_keymap_hierarchy(lvl[3], msgsrc)
@@ -396,7 +397,6 @@ def dump_messages_rna(msgs, reports, settings):
# And parse keymaps!
from bpy_extras.keyconfig_utils import KM_HIERARCHY
walk_keymap_hierarchy(KM_HIERARCHY, "KM_HIERARCHY")

View File

@@ -21,6 +21,8 @@ import bpy
from bpy.types import Menu
from bpy.app.translations import pgettext_iface as iface_
km_i18n_context = bpy.app.translations.contexts.id_windowmanager
class USERPREF_MT_keyconfigs(Menu):
bl_label = "KeyPresets"
@@ -79,7 +81,7 @@ class InputKeyMapPanel:
row = col.row()
row.prop(km, "show_expanded_children", text="", emboss=False)
row.label(text=km.name)
row.label(text=km.name, text_ctxt=km_i18n_context)
row.label()
row.label()
@@ -110,7 +112,7 @@ class InputKeyMapPanel:
# "Add New" at end of keymap item list
col = self.indented_layout(col, level + 1)
subcol = col.split(percentage=0.2).column()
subcol.operator("wm.keyitem_add", text="Add New", icon='ZOOMIN')
subcol.operator("wm.keyitem_add", text="Add New", text_ctxt=km_i18n_context, icon='ZOOMIN')
col.separator()

View File

@@ -1116,7 +1116,7 @@ static void draw_sensor_keyboard(uiLayout *layout, PointerRNA *ptr)
uiLayout *row, *col;
row = uiLayoutRow(layout, FALSE);
uiItemL(row, IFACE_("Key:"), ICON_NONE);
uiItemL(row, CTX_IFACE_(BLF_I18NCONTEXT_ID_WINDOWMANAGER, "Key:"), ICON_NONE);
col = uiLayoutColumn(row, FALSE);
uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_keys") == FALSE);
uiItemR(col, ptr, "key", UI_ITEM_R_EVENT, "", ICON_NONE);

View File

@@ -460,6 +460,7 @@ static void rna_def_keyboard_sensor(BlenderRNA *brna)
RNA_def_property_enum_items(prop, event_type_items);
RNA_def_property_enum_funcs(prop, NULL, "rna_Sensor_keyboard_key_set", NULL);
RNA_def_property_ui_text(prop, "Key", "");
RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_WINDOWMANAGER);
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "modifier_key_1", PROP_ENUM, PROP_NONE);