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!
This commit is contained in:
Bastien Montagne 2013-02-09 18:26:40 +00:00
parent 1083a06900
commit 82c86af7f7
11 changed files with 45 additions and 31 deletions

@ -265,7 +265,8 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
layout.prop(md, "angle_limit") layout.prop(md, "angle_limit")
layout.prop(md, "use_dissolve_boundaries") 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): def DISPLACE(self, layout, ob, md):
has_texture = (md.texture is not None) has_texture = (md.texture is not None)

@ -80,9 +80,10 @@ class MATERIAL_UL_matslots(UIList):
if ma and not context.scene.render.use_shading_nodes: if ma and not context.scene.render.use_shading_nodes:
manode = ma.active_node_material manode = ma.active_node_material
if manode: 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: elif ma.use_nodes:
layout.label(text="Node <none>", translate=False) layout.label(text="Node <none>")
else: else:
layout.label(text="") layout.label(text="")
elif self.layout_type in {'GRID'}: elif self.layout_type in {'GRID'}:

@ -148,7 +148,8 @@ class PARTICLE_PT_context_particles(ParticleButtonsPanel, Panel):
#row.label(text="Render") #row.label(text="Render")
if part.is_fluid: 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 return
row = col.row() row = col.row()

@ -64,7 +64,9 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel, Panel):
if fluid.type == 'DOMAIN': if fluid.type == 'DOMAIN':
# odd formatting here so translation script can extract string # 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() split = layout.split()
col = split.column() col = split.column()

@ -313,9 +313,11 @@ class CLIP_PT_tools_solve(CLIP_PT_tracking_panel, Panel):
col = layout.column(align=True) col = layout.column(align=True)
col.operator("clip.solve_camera", # Note: avoid complex code in "text" values, they can't be handled right by i18n messages extractor script!
text="Camera Motion" if tracking_object.is_camera if tracking_object.is_camera:
else "Object Motion") col.operator("clip.solve_camera", text="Camera Motion")
else:
col.operator("clip.solve_camera", text="Object Motion")
col.operator("clip.clear_solution") col.operator("clip.clear_solution")
col = layout.column() 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)) 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: for a, b in ratios:
text = "Zoom %d:%d" % (a, b) layout.operator("clip.view_zoom_ratio", text=text % (a, b), translate=False).ratio = a / b
layout.operator("clip.view_zoom_ratio",
text=text).ratio = a / b
else: else:
if sc.view == 'GRAPH': if sc.view == 'GRAPH':
layout.operator_context = 'INVOKE_REGION_PREVIEW' layout.operator_context = 'INVOKE_REGION_PREVIEW'

@ -70,8 +70,10 @@ class IMAGE_MT_view(Menu):
ratios = ((1, 8), (1, 4), (1, 2), (1, 1), (2, 1), (4, 1), (8, 1)) 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: 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() layout.separator()

@ -420,15 +420,19 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel, Panel):
sub.prop(strip, "frame_start") sub.prop(strip, "frame_start")
sub.prop(strip, "frame_final_duration") sub.prop(strip, "frame_final_duration")
pgettext = bpy.app.translations.pgettext
col = layout.column(align=True) col = layout.column(align=True)
row = col.row() 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 = col.row()
row.active = (frame_current >= strip.frame_start and frame_current <= strip.frame_start + strip.frame_duration) 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=pgettext("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)) translate=False)
col.label(text=pgettext("Frame Still %d:%d") % (strip.frame_still_start, strip.frame_still_end),
translate=False)
elem = False elem = False
@ -438,7 +442,7 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel, Panel):
elem = strip.elements[0] elem = strip.elements[0]
if elem and elem.orig_width > 0 and elem.orig_height > 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: else:
col.label(text="Original Dimension: None") col.label(text="Original Dimension: None")
@ -715,7 +719,8 @@ class SEQUENCER_PT_scene(SequencerButtonsPanel, Panel):
if scene: if scene:
sta = scene.frame_start sta = scene.frame_start
end = scene.frame_end 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): class SEQUENCER_PT_mask(SequencerButtonsPanel, Panel):
@ -744,7 +749,8 @@ class SEQUENCER_PT_mask(SequencerButtonsPanel, Panel):
if mask: if mask:
sta = mask.frame_start sta = mask.frame_start
end = mask.frame_end 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): class SEQUENCER_PT_filter(SequencerButtonsPanel, Panel):

@ -71,16 +71,15 @@ class TEXT_HT_header(Header):
row = layout.row() row = layout.row()
if text.filepath: if text.filepath:
pgettext = bpy.app.translations.pgettext
if text.is_dirty: if text.is_dirty:
row.label(text="File" + ": *%r " % row.label(text=pgettext("File: *%r (unsaved)") % text.filepath, translate=False)
text.filepath + "(unsaved)")
else: else:
row.label(text="File" + ": %r" % row.label(text=pgettext("File: %r") % text.filepath, translate=False)
text.filepath) elif text.library:
row.label(text="Text: External")
else: else:
row.label(text="Text: External" row.label(text="Text: Internal")
if text.library
else "Text: Internal")
class TEXT_PT_properties(Panel): class TEXT_PT_properties(Panel):

@ -778,9 +778,10 @@ class USERPREF_PT_theme(Panel):
layout.separator() layout.separator()
elif theme.theme_area == 'BONE_COLOR_SETS': elif theme.theme_area == 'BONE_COLOR_SETS':
col = split.column() col = split.column()
pgettext = bpy.app.translations.pgettext
for i, ui in enumerate(theme.bone_color_sets): 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() row = col.row()

@ -97,7 +97,8 @@ class InputKeyMapPanel:
subcol = self.indented_layout(col, level + 1) subcol = self.indented_layout(col, level + 1)
subrow = subcol.row() subrow = subcol.row()
subrow.prop(km, "show_expanded_items", text="", emboss=False) 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: else:
km.show_expanded_items = True km.show_expanded_items = True

@ -368,9 +368,8 @@ void WM_OT_collada_import(wmOperatorType *ot)
WM_operator_properties_filesel(ot, FOLDERFILE | COLLADAFILE, FILE_BLENDER, FILE_OPENFILE, WM_operator_properties_filesel(ot, FOLDERFILE | COLLADAFILE, FILE_BLENDER, FILE_OPENFILE,
WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY); WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
RNA_def_boolean(ot->srna, RNA_def_boolean(ot->srna, "import_units", 0, "Import Units",
"import_units", 0, "Import Units", "If enabled use Units as defined in Collada Import, else keep Blender's current Units settings");
"If enabled use Units as defined in Collada Import, else keep Blender's current Units settings. ");
} }
#endif #endif