Bunch of fixes for py ui messages (all those using 'formating' were not translated...
authorBastien Montagne <montagne29@wanadoo.fr>
Sat, 9 Feb 2013 18:26:40 +0000 (18:26 +0000)
committerBastien Montagne <montagne29@wanadoo.fr>
Sat, 9 Feb 2013 18:26:40 +0000 (18:26 +0000)
And another "final point in UI message" removal!

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

index 99f82b1..679b332 100644 (file)
@@ -265,7 +265,8 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
             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)
index 3a3cd88..9b7cfe8 100644 (file)
@@ -80,9 +80,10 @@ class MATERIAL_UL_matslots(UIList):
             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'}:
index 90dcf59..aef860e 100644 (file)
@@ -148,7 +148,8 @@ class PARTICLE_PT_context_particles(ParticleButtonsPanel, Panel):
             #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()
index 08278c0..c03b532 100644 (file)
@@ -64,7 +64,9 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel, Panel):
 
         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()
index ba38e77..303f47b 100644 (file)
@@ -313,9 +313,11 @@ class CLIP_PT_tools_solve(CLIP_PT_tracking_panel, Panel):
 
         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 @@ class CLIP_MT_view(Menu):
 
             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'
index 179c41a..6d08663 100644 (file)
@@ -70,8 +70,10 @@ class IMAGE_MT_view(Menu):
 
         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()
 
index 64ad565..b8f44a6 100644 (file)
@@ -420,15 +420,19 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel, Panel):
         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 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel, Panel):
             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 @@ class SEQUENCER_PT_scene(SequencerButtonsPanel, Panel):
         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 @@ class SEQUENCER_PT_mask(SequencerButtonsPanel, Panel):
         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):
index 65ec945..d976475 100644 (file)
@@ -71,16 +71,15 @@ class TEXT_HT_header(Header):
 
             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):
index 4ebd38c..5bb83e7 100644 (file)
@@ -778,9 +778,10 @@ class USERPREF_PT_theme(Panel):
             layout.separator()
         elif theme.theme_area == 'BONE_COLOR_SETS':
             col = split.column()
+            pgettext = bpy.app.translations.pgettext
 
             for i, ui in enumerate(theme.bone_color_sets):
-                col.label(text="Color Set" + " %d:" % (i + 1))  # i starts from 0
+                col.label(text=pgettext("Color Set %d:") % (i + 1), translate=False)  # i starts from 0
 
                 row = col.row()
 
index 82299bc..db78adc 100644 (file)
@@ -97,7 +97,8 @@ class InputKeyMapPanel:
                 subcol = self.indented_layout(col, level + 1)
                 subrow = subcol.row()
                 subrow.prop(km, "show_expanded_items", text="", emboss=False)
-                subrow.label(text="%s " % km.name + "(Global)")
+                pgettext = bpy.app.translations.pgettext
+                subrow.label(text=pgettext("%s (Global)") % km.name, translate=False)
             else:
                 km.show_expanded_items = True
 
index 0982b4f..2004b18 100644 (file)
@@ -368,9 +368,8 @@ void WM_OT_collada_import(wmOperatorType *ot)
        WM_operator_properties_filesel(ot, FOLDERFILE | COLLADAFILE, FILE_BLENDER, FILE_OPENFILE,
                                       WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
 
-       RNA_def_boolean(ot->srna,
-                       "import_units", 0, "Import Units",
-                                       "If enabled use Units as defined in Collada Import, else keep Blender's current Units settings. ");
+       RNA_def_boolean(ot->srna, "import_units", 0, "Import Units",
+                       "If enabled use Units as defined in Collada Import, else keep Blender's current Units settings");
 
 }
 #endif