[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54414] trunk/blender: Bunch of fixes for py ui messages (all those using 'formating' were not translated previously, now they use bpy.app.translations.pgettext ).

Bastien Montagne montagne29 at wanadoo.fr
Sat Feb 9 19:26:40 CET 2013


Revision: 54414
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54414
Author:   mont29
Date:     2013-02-09 18:26:40 +0000 (Sat, 09 Feb 2013)
Log Message:
-----------
Bunch of fixes for py ui messages (all those using 'formating' were not translated previously, now they use bpy.app.translations.pgettext). Also pleas avoid complex py statements in 'text' values (like 'text="foo" if cond else "bar"'), thes make message extraction script fails!

And another "final point in UI message" removal!

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_ui/properties_data_modifier.py
    trunk/blender/release/scripts/startup/bl_ui/properties_material.py
    trunk/blender/release/scripts/startup/bl_ui/properties_particle.py
    trunk/blender/release/scripts/startup/bl_ui/properties_physics_fluid.py
    trunk/blender/release/scripts/startup/bl_ui/space_clip.py
    trunk/blender/release/scripts/startup/bl_ui/space_image.py
    trunk/blender/release/scripts/startup/bl_ui/space_sequencer.py
    trunk/blender/release/scripts/startup/bl_ui/space_text.py
    trunk/blender/release/scripts/startup/bl_ui/space_userpref.py
    trunk/blender/release/scripts/startup/bl_ui/space_userpref_keymap.py
    trunk/blender/source/blender/editors/io/io_collada.c

Modified: trunk/blender/release/scripts/startup/bl_ui/properties_data_modifier.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/properties_data_modifier.py	2013-02-09 18:17:20 UTC (rev 54413)
+++ trunk/blender/release/scripts/startup/bl_ui/properties_data_modifier.py	2013-02-09 18:26:40 UTC (rev 54414)
@@ -265,7 +265,8 @@
             layout.prop(md, "angle_limit")
             layout.prop(md, "use_dissolve_boundaries")
 
-        layout.label(text="Face Count" + ": %d" % md.face_count)
+        pgettext = bpy.app.translations.pgettext
+        layout.label(text=pgettext("Face Count: %d") % md.face_count, translate=False)
 
     def DISPLACE(self, layout, ob, md):
         has_texture = (md.texture is not None)

Modified: trunk/blender/release/scripts/startup/bl_ui/properties_material.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/properties_material.py	2013-02-09 18:17:20 UTC (rev 54413)
+++ trunk/blender/release/scripts/startup/bl_ui/properties_material.py	2013-02-09 18:26:40 UTC (rev 54414)
@@ -80,9 +80,10 @@
             if ma and not context.scene.render.use_shading_nodes:
                 manode = ma.active_node_material
                 if manode:
-                    layout.label(text="Node %s" % manode.name, translate=False, icon_value=layout.icon(manode))
+                    pgettext = bpy.app.translations.pgettext
+                    layout.label(text=pgettext("Node %s") % manode.name, translate=False, icon_value=layout.icon(manode))
                 elif ma.use_nodes:
-                    layout.label(text="Node <none>", translate=False)
+                    layout.label(text="Node <none>")
                 else:
                     layout.label(text="")
         elif self.layout_type in {'GRID'}:

Modified: trunk/blender/release/scripts/startup/bl_ui/properties_particle.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/properties_particle.py	2013-02-09 18:17:20 UTC (rev 54413)
+++ trunk/blender/release/scripts/startup/bl_ui/properties_particle.py	2013-02-09 18:26:40 UTC (rev 54414)
@@ -148,7 +148,8 @@
             #row.label(text="Render")
 
             if part.is_fluid:
-                layout.label(text="%d fluid particles for this frame" % part.count)
+                pgettext = bpy.app.translations.pgettext
+                layout.label(text=pgettext("%d fluid particles for this frame") % part.count, translate=False)
                 return
 
             row = col.row()

Modified: trunk/blender/release/scripts/startup/bl_ui/properties_physics_fluid.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/properties_physics_fluid.py	2013-02-09 18:17:20 UTC (rev 54413)
+++ trunk/blender/release/scripts/startup/bl_ui/properties_physics_fluid.py	2013-02-09 18:26:40 UTC (rev 54414)
@@ -64,7 +64,9 @@
 
         if fluid.type == 'DOMAIN':
             # odd formatting here so translation script can extract string
-            layout.operator("fluid.bake", text="Bake (Req. Memory:" + " %s)" % fluid.memory_estimate, icon='MOD_FLUIDSIM')
+            pgettext = bpy.app.translations.pgettext
+            layout.operator("fluid.bake", text=pgettext("Bake (Req. Memory: %s)") % fluid.memory_estimate,
+                            translate=False, icon='MOD_FLUIDSIM')
             split = layout.split()
 
             col = split.column()

Modified: trunk/blender/release/scripts/startup/bl_ui/space_clip.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_clip.py	2013-02-09 18:17:20 UTC (rev 54413)
+++ trunk/blender/release/scripts/startup/bl_ui/space_clip.py	2013-02-09 18:26:40 UTC (rev 54414)
@@ -313,9 +313,11 @@
 
         col = layout.column(align=True)
 
-        col.operator("clip.solve_camera",
-                     text="Camera Motion" if tracking_object.is_camera
-                     else "Object Motion")
+        # Note: avoid complex code in "text" values, they can't be handled right by i18n messages extractor script!
+        if tracking_object.is_camera:
+            col.operator("clip.solve_camera", text="Camera Motion")
+        else:
+            col.operator("clip.solve_camera", text="Object Motion")
         col.operator("clip.clear_solution")
 
         col = layout.column()
@@ -907,10 +909,9 @@
 
             ratios = ((1, 8), (1, 4), (1, 2), (1, 1), (2, 1), (4, 1), (8, 1))
 
+            text = bpy.app.translations.pgettext("Zoom %d:%d")
             for a, b in ratios:
-                text = "Zoom %d:%d" % (a, b)
-                layout.operator("clip.view_zoom_ratio",
-                                text=text).ratio = a / b
+                layout.operator("clip.view_zoom_ratio", text=text % (a, b), translate=False).ratio = a / b
         else:
             if sc.view == 'GRAPH':
                 layout.operator_context = 'INVOKE_REGION_PREVIEW'

Modified: trunk/blender/release/scripts/startup/bl_ui/space_image.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_image.py	2013-02-09 18:17:20 UTC (rev 54413)
+++ trunk/blender/release/scripts/startup/bl_ui/space_image.py	2013-02-09 18:26:40 UTC (rev 54414)
@@ -70,8 +70,10 @@
 
         ratios = ((1, 8), (1, 4), (1, 2), (1, 1), (2, 1), (4, 1), (8, 1))
 
+        pgettext = bpy.app.translations.pgettext
         for a, b in ratios:
-            layout.operator("image.view_zoom_ratio", text="Zoom" + " %d:%d" % (a, b)).ratio = a / b
+            layout.operator("image.view_zoom_ratio", text=pgettext("Zoom %d:%d") % (a, b),
+                            translate=False).ratio = a / b
 
         layout.separator()
 

Modified: trunk/blender/release/scripts/startup/bl_ui/space_sequencer.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_sequencer.py	2013-02-09 18:17:20 UTC (rev 54413)
+++ trunk/blender/release/scripts/startup/bl_ui/space_sequencer.py	2013-02-09 18:26:40 UTC (rev 54414)
@@ -420,15 +420,19 @@
         sub.prop(strip, "frame_start")
         sub.prop(strip, "frame_final_duration")
 
+        pgettext = bpy.app.translations.pgettext
         col = layout.column(align=True)
         row = col.row()
-        row.label(text="Final Length" + ": %s" % bpy.utils.smpte_from_frame(strip.frame_final_duration))
+        row.label(text=pgettext("Final Length: %s") % bpy.utils.smpte_from_frame(strip.frame_final_duration),
+                  translate=False)
         row = col.row()
         row.active = (frame_current >= strip.frame_start and frame_current <= strip.frame_start + strip.frame_duration)
-        row.label(text="Playhead" + ": %d" % (frame_current - strip.frame_start))
+        row.label(text=pgettext("Playhead: %d") % (frame_current - strip.frame_start), translate=False)
 
-        col.label(text="Frame Offset" + " %d:%d" % (strip.frame_offset_start, strip.frame_offset_end))
-        col.label(text="Frame Still" + " %d:%d" % (strip.frame_still_start, strip.frame_still_end))
+        col.label(text=pgettext("Frame Offset %d:%d") % (strip.frame_offset_start, strip.frame_offset_end),
+                  translate=False)
+        col.label(text=pgettext("Frame Still %d:%d") % (strip.frame_still_start, strip.frame_still_end),
+                  translate=False)
 
         elem = False
 
@@ -438,7 +442,7 @@
             elem = strip.elements[0]
 
         if elem and elem.orig_width > 0 and elem.orig_height > 0:
-            col.label(text="Original Dimension" + ": %dx%d" % (elem.orig_width, elem.orig_height))
+            col.label(text=pgettext("Original Dimension: %dx%d") % (elem.orig_width, elem.orig_height), translate=False)
         else:
             col.label(text="Original Dimension: None")
 
@@ -715,7 +719,8 @@
         if scene:
             sta = scene.frame_start
             end = scene.frame_end
-            layout.label(text="Original frame range" + ": %d-%d (%d)" % (sta, end, end - sta + 1))
+            pgettext = bpy.app.translations.pgettext
+            layout.label(text=pgettext("Original frame range: %d-%d (%d)") % (sta, end, end - sta + 1), translate=False)
 
 
 class SEQUENCER_PT_mask(SequencerButtonsPanel, Panel):
@@ -744,7 +749,8 @@
         if mask:
             sta = mask.frame_start
             end = mask.frame_end
-            layout.label(text="Original frame range" + ": %d-%d (%d)" % (sta, end, end - sta + 1))
+            pgettext = bpy.app.translations.pgettext
+            layout.label(text=pgettext("Original frame range: %d-%d (%d)") % (sta, end, end - sta + 1), translate=False)
 
 
 class SEQUENCER_PT_filter(SequencerButtonsPanel, Panel):

Modified: trunk/blender/release/scripts/startup/bl_ui/space_text.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_text.py	2013-02-09 18:17:20 UTC (rev 54413)
+++ trunk/blender/release/scripts/startup/bl_ui/space_text.py	2013-02-09 18:26:40 UTC (rev 54414)
@@ -71,16 +71,15 @@
 
             row = layout.row()
             if text.filepath:
+                pgettext = bpy.app.translations.pgettext
                 if text.is_dirty:
-                    row.label(text="File" + ": *%r " %
-                              text.filepath + "(unsaved)")
+                    row.label(text=pgettext("File: *%r (unsaved)") % text.filepath, translate=False)
                 else:
-                    row.label(text="File" + ": %r" %
-                              text.filepath)
+                    row.label(text=pgettext("File: %r") % text.filepath, translate=False)
+            elif text.library:
+                row.label(text="Text: External")
             else:
-                row.label(text="Text: External"
-                          if text.library
-                          else "Text: Internal")
+                row.label(text="Text: Internal")
 
 
 class TEXT_PT_properties(Panel):

Modified: trunk/blender/release/scripts/startup/bl_ui/space_userpref.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_userpref.py	2013-02-09 18:17:20 UTC (rev 54413)

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list