[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55647] trunk/blender: I18n: various fixing.

Bastien Montagne montagne29 at wanadoo.fr
Thu Mar 28 16:41:43 CET 2013


Revision: 55647
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55647
Author:   mont29
Date:     2013-03-28 15:41:43 +0000 (Thu, 28 Mar 2013)
Log Message:
-----------
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"...).

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_operators/add_mesh_torus.py
    trunk/blender/release/scripts/startup/bl_ui/properties_physics_common.py
    trunk/blender/release/scripts/startup/bl_ui/space_userpref.py
    trunk/blender/release/scripts/startup/bl_ui/space_userpref_keymap.py
    trunk/blender/release/scripts/startup/bl_ui/space_view3d.py
    trunk/blender/source/blender/blenfont/BLF_translation.h
    trunk/blender/source/blender/editors/sculpt_paint/paint_utils.c
    trunk/blender/source/blender/editors/transform/transform_ops.c
    trunk/blender/source/blender/makesrna/intern/rna_mask.c
    trunk/blender/source/blender/makesrna/intern/rna_modifier.c
    trunk/blender/source/blender/makesrna/intern/rna_nodetree.c

Modified: trunk/blender/release/scripts/startup/bl_operators/add_mesh_torus.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_operators/add_mesh_torus.py	2013-03-28 15:03:47 UTC (rev 55646)
+++ trunk/blender/release/scripts/startup/bl_operators/add_mesh_torus.py	2013-03-28 15:41:43 UTC (rev 55647)
@@ -24,6 +24,7 @@
                        IntProperty,
                        BoolProperty,
                        )
+from bpy.app.translations import pgettext_data as data_
 
 from bpy_extras import object_utils
 
@@ -142,7 +143,7 @@
                                      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)
 

Modified: trunk/blender/release/scripts/startup/bl_ui/properties_physics_common.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/properties_physics_common.py	2013-03-28 15:03:47 UTC (rev 55646)
+++ trunk/blender/release/scripts/startup/bl_ui/properties_physics_common.py	2013-03-28 15:41:43 UTC (rev 55647)
@@ -20,10 +20,9 @@
 
 import bpy
 from bpy.types import Panel
+from bpy.app.translations import contexts as i18n_contexts
 
-i18n_default_ctxt = bpy.app.translations.contexts.default
 
-
 class PhysicButtonsPanel():
     bl_space_type = 'PROPERTIES'
     bl_region_type = 'WINDOW'
@@ -39,20 +38,20 @@
     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):

Modified: trunk/blender/release/scripts/startup/bl_ui/space_userpref.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_userpref.py	2013-03-28 15:03:47 UTC (rev 55646)
+++ trunk/blender/release/scripts/startup/bl_ui/space_userpref.py	2013-03-28 15:41:43 UTC (rev 55647)
@@ -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 @@
             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)

Modified: trunk/blender/release/scripts/startup/bl_ui/space_userpref_keymap.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_userpref_keymap.py	2013-03-28 15:03:47 UTC (rev 55646)
+++ trunk/blender/release/scripts/startup/bl_ui/space_userpref_keymap.py	2013-03-28 15:41:43 UTC (rev 55647)
@@ -20,10 +20,9 @@
 import bpy
 from bpy.types import Menu
 from bpy.app.translations import pgettext_iface as iface_
+from bpy.app.translations import contexts as i18n_contexts
 
-km_i18n_context = bpy.app.translations.contexts.id_windowmanager
 
-
 class USERPREF_MT_keyconfigs(Menu):
     bl_label = "KeyPresets"
     preset_subdir = "keyconfig"
@@ -81,7 +80,7 @@
 
         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 @@
                 # "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()
 

Modified: trunk/blender/release/scripts/startup/bl_ui/space_view3d.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_view3d.py	2013-03-28 15:03:47 UTC (rev 55646)
+++ trunk/blender/release/scripts/startup/bl_ui/space_view3d.py	2013-03-28 15:41:43 UTC (rev 55647)
@@ -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 @@
     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 @@
     def draw(self, context):
         layout = self.layout
 
-        default_context = bpy.app.translations.contexts.default
-
         options = [
             "show_wire",
             "use_deform",
@@ -1679,7 +1678,7 @@
 
         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 @@
         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()

Modified: trunk/blender/source/blender/blenfont/BLF_translation.h
===================================================================
--- trunk/blender/source/blender/blenfont/BLF_translation.h	2013-03-28 15:03:47 UTC (rev 55646)
+++ trunk/blender/source/blender/blenfont/BLF_translation.h	2013-03-28 15:41:43 UTC (rev 55647)
@@ -138,6 +138,9 @@
 /* Default context for operator names/labels. */
 #define BLF_I18NCONTEXT_OPERATOR_DEFAULT "Operator"
 
+/* Mark the msgid applies to several elements (needed in some cases, as english adjectives have no plural mark. :( */
+#define BLF_I18NCONTEXT_PLURAL "Plural"
+
 /* ID-types contexts. */
 /* WARNING! Keep it in sync with idtypes in blenkernel/intern/idcode.c */
 #define BLF_I18NCONTEXT_ID_ACTION               "Action"
@@ -187,6 +190,7 @@
 	BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_DEFAULT, "default_real"),                                                    \
 	BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_DEFAULT_BPYRNA, "default"),                                                  \
 	BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "operator_default"),                                       \
+	BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_PLURAL, "plural"),                                                           \
 	BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_ACTION, "id_action"),                                                     \
 	BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_ARMATURE, "id_armature"),                                                 \
 	BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_BRUSH, "id_brush"),                                                       \

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_utils.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_utils.c	2013-03-28 15:03:47 UTC (rev 55646)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_utils.c	2013-03-28 15:41:43 UTC (rev 55647)
@@ -43,6 +43,8 @@
 #include "BLI_utildefines.h"

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list