From 5262fcd4d3eeb96b955266c92b3cc97beb56698d Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Thu, 28 Mar 2013 15:41:43 +0000 Subject: I18n: various fixing. * Reflect changes stated in prev commit about contexts in py code. * Add a "Plural" context, to handle cases where english does not mark plural at all (e.g. shorten labels of only one adjective). Not so happy with that, but can't see any other way to do it, for now. * Abuse "ID_CURVE" context for all falloff curves (this should solve some confusion issues, e.g. "sharp"...). --- release/scripts/startup/bl_operators/add_mesh_torus.py | 3 ++- .../scripts/startup/bl_ui/properties_physics_common.py | 11 +++++------ release/scripts/startup/bl_ui/space_userpref.py | 3 ++- release/scripts/startup/bl_ui/space_userpref_keymap.py | 8 ++++---- release/scripts/startup/bl_ui/space_view3d.py | 17 ++++++++--------- 5 files changed, 21 insertions(+), 21 deletions(-) (limited to 'release') diff --git a/release/scripts/startup/bl_operators/add_mesh_torus.py b/release/scripts/startup/bl_operators/add_mesh_torus.py index 63e796e2b5d..948cb39f5b1 100644 --- a/release/scripts/startup/bl_operators/add_mesh_torus.py +++ b/release/scripts/startup/bl_operators/add_mesh_torus.py @@ -24,6 +24,7 @@ from bpy.props import (FloatProperty, IntProperty, BoolProperty, ) +from bpy.app.translations import pgettext_data as data_ from bpy_extras import object_utils @@ -142,7 +143,7 @@ class AddTorus(Operator, object_utils.AddObjectHelper): self.major_segments, self.minor_segments) - mesh = bpy.data.meshes.new("Torus") + mesh = bpy.data.meshes.new(data_("Torus")) mesh.vertices.add(len(verts_loc) // 3) diff --git a/release/scripts/startup/bl_ui/properties_physics_common.py b/release/scripts/startup/bl_ui/properties_physics_common.py index 2d9d4649e28..d55dea58acf 100644 --- a/release/scripts/startup/bl_ui/properties_physics_common.py +++ b/release/scripts/startup/bl_ui/properties_physics_common.py @@ -20,8 +20,7 @@ import bpy from bpy.types import Panel - -i18n_default_ctxt = bpy.app.translations.contexts.default +from bpy.app.translations import contexts as i18n_contexts class PhysicButtonsPanel(): @@ -39,20 +38,20 @@ def physics_add(self, layout, md, name, type, typeicon, toggles): sub = layout.row(align=True) if md: sub.context_pointer_set("modifier", md) - sub.operator("object.modifier_remove", text=name, text_ctxt=i18n_default_ctxt, icon='X') + sub.operator("object.modifier_remove", text=name, text_ctxt=i18n_contexts.default, icon='X') if(toggles): sub.prop(md, "show_render", text="") sub.prop(md, "show_viewport", text="") else: - sub.operator("object.modifier_add", text=name, text_ctxt=i18n_default_ctxt, icon=typeicon).type = type + sub.operator("object.modifier_add", text=name, text_ctxt=i18n_contexts.default, icon=typeicon).type = type def physics_add_special(self, layout, data, name, addop, removeop, typeicon): sub = layout.row(align=True) if data: - sub.operator(removeop, text=name, text_ctxt=i18n_default_ctxt, icon='X') + sub.operator(removeop, text=name, text_ctxt=i18n_contexts.default, icon='X') else: - sub.operator(addop, text=name, text_ctxt=i18n_default_ctxt, icon=typeicon) + sub.operator(addop, text=name, text_ctxt=i18n_context.default, icon=typeicon) class PHYSICS_PT_add(PhysicButtonsPanel, Panel): diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 2742e6d8155..8755e37c68d 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -20,6 +20,7 @@ import bpy from bpy.types import Header, Menu, Panel from bpy.app.translations import pgettext_iface as iface_ +from bpy.app.translations import contexts as i18n_contexts def ui_style_items(col, context): @@ -528,7 +529,7 @@ class USERPREF_PT_system(Panel): if system.use_international_fonts: column.prop(system, "language") row = column.row() - row.label(text="Translate:", text_ctxt=bpy.app.translations.contexts.id_windowmanager) + row.label(text="Translate:", text_ctxt=i18n_contexts.id_windowmanager) row = column.row(True) row.prop(system, "use_translate_interface", text="Interface", toggle=True) row.prop(system, "use_translate_tooltips", text="Tooltips", toggle=True) diff --git a/release/scripts/startup/bl_ui/space_userpref_keymap.py b/release/scripts/startup/bl_ui/space_userpref_keymap.py index a13d77942eb..8d6eb2c623d 100644 --- a/release/scripts/startup/bl_ui/space_userpref_keymap.py +++ b/release/scripts/startup/bl_ui/space_userpref_keymap.py @@ -20,8 +20,7 @@ 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 +from bpy.app.translations import contexts as i18n_contexts class USERPREF_MT_keyconfigs(Menu): @@ -81,7 +80,7 @@ class InputKeyMapPanel: row = col.row() row.prop(km, "show_expanded_children", text="", emboss=False) - row.label(text=km.name, text_ctxt=km_i18n_context) + row.label(text=km.name, text_ctxt=i18n_contexts.id_windowmanager) row.label() row.label() @@ -112,7 +111,8 @@ 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", text_ctxt=km_i18n_context, icon='ZOOMIN') + subcol.operator("wm.keyitem_add", text="Add New", text_ctxt=i18n_contexts.id_windowmanager, + icon='ZOOMIN') col.separator() diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 5ad633069f4..48868f09129 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -20,6 +20,7 @@ import bpy from bpy.types import Header, Menu, Panel from bl_ui.properties_paint_common import UnifiedPaintPanel +from bpy.app.translations import contexts as i18n_contexts class VIEW3D_HT_header(Header): @@ -994,20 +995,20 @@ class VIEW3D_MT_object_apply(Menu): def draw(self, context): layout = self.layout - props = layout.operator("object.transform_apply", text="Location") + props = layout.operator("object.transform_apply", text="Location", text_ctxt=i18n_contexts.default) props.location, props.rotation, props.scale = True, False, False - props = layout.operator("object.transform_apply", text="Rotation") + props = layout.operator("object.transform_apply", text="Rotation", text_ctxt=i18n_contexts.default) props.location, props.rotation, props.scale = False, True, False - props = layout.operator("object.transform_apply", text="Scale") + props = layout.operator("object.transform_apply", text="Scale", text_ctxt=i18n_contexts.default) props.location, props.rotation, props.scale = False, False, True - props = layout.operator("object.transform_apply", text="Rotation & Scale") + props = layout.operator("object.transform_apply", text="Rotation & Scale", text_ctxt=i18n_contexts.default) props.location, props.rotation, props.scale = False, True, True layout.separator() - layout.operator("object.visual_transform_apply", text="Visual Transform") + layout.operator("object.visual_transform_apply", text="Visual Transform", text_ctxt=i18n_contexts.default) layout.operator("object.duplicates_make_real") @@ -1657,8 +1658,6 @@ class BoneOptions: def draw(self, context): layout = self.layout - default_context = bpy.app.translations.contexts.default - options = [ "show_wire", "use_deform", @@ -1679,7 +1678,7 @@ class BoneOptions: for opt in options: props = layout.operator("wm.context_collection_boolean_set", text=bone_props[opt].name, - text_ctxt=default_context) + text_ctxt=i18n_contexts.default) props.data_path_iter = data_path_iter props.data_path_item = opt_suffix + opt props.type = self.type @@ -2544,7 +2543,7 @@ class VIEW3D_PT_view3d_meshdisplay(Panel): col = split.column() col.label() col.prop(mesh, "show_edge_seams", text="Seams") - col.prop(mesh, "show_edge_sharp", text="Sharp") + col.prop(mesh, "show_edge_sharp", text="Sharp", text_ctxt=i18n_contexts.plural) col.prop(mesh, "show_edge_bevel_weight", text="Weights") col = layout.column() -- cgit v1.2.3