From c0fa16f2c99abb3db9b4fab1a952383e6fd81167 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sun, 10 Feb 2013 09:09:26 +0000 Subject: [PATCH] Another fix for r54414 (cleaner to "import" pgettext once at top of files, also now using usual '_' shortcut). --- .../startup/bl_ui/properties_data_modifier.py | 5 +++-- .../startup/bl_ui/properties_material.py | 5 +++-- .../startup/bl_ui/properties_particle.py | 5 +++-- .../startup/bl_ui/properties_physics_fluid.py | 5 +++-- release/scripts/startup/bl_ui/space_clip.py | 8 +++---- release/scripts/startup/bl_ui/space_image.py | 8 +++---- .../scripts/startup/bl_ui/space_sequencer.py | 22 ++++++++----------- release/scripts/startup/bl_ui/space_text.py | 5 +++-- .../scripts/startup/bl_ui/space_userpref.py | 5 +++-- .../startup/bl_ui/space_userpref_keymap.py | 5 +++-- 10 files changed, 38 insertions(+), 35 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py index 679b33292e5..a0909b52760 100644 --- a/release/scripts/startup/bl_ui/properties_data_modifier.py +++ b/release/scripts/startup/bl_ui/properties_data_modifier.py @@ -20,6 +20,8 @@ import bpy from bpy.types import Panel +_ = bpy.app.translations.pgettext + class ModifierButtonsPanel(): bl_space_type = 'PROPERTIES' @@ -265,8 +267,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): layout.prop(md, "angle_limit") layout.prop(md, "use_dissolve_boundaries") - pgettext = bpy.app.translations.pgettext - layout.label(text=pgettext("Face Count: %d") % md.face_count, translate=False) + layout.label(text=_("Face Count: %d") % md.face_count, translate=False) def DISPLACE(self, layout, ob, md): has_texture = (md.texture is not None) diff --git a/release/scripts/startup/bl_ui/properties_material.py b/release/scripts/startup/bl_ui/properties_material.py index 9b7cfe89a08..8c6a67ea17e 100644 --- a/release/scripts/startup/bl_ui/properties_material.py +++ b/release/scripts/startup/bl_ui/properties_material.py @@ -21,6 +21,8 @@ import bpy from bpy.types import Menu, Panel, UIList from rna_prop_ui import PropertyPanel +_ = bpy.app.translations.pgettext + def active_node_mat(mat): # TODO, 2.4x has a pipeline section, for 2.5 we need to communicate @@ -80,8 +82,7 @@ class MATERIAL_UL_matslots(UIList): if ma and not context.scene.render.use_shading_nodes: manode = ma.active_node_material if manode: - pgettext = bpy.app.translations.pgettext - layout.label(text=pgettext("Node %s") % manode.name, translate=False, icon_value=layout.icon(manode)) + layout.label(text=_("Node %s") % manode.name, translate=False, icon_value=layout.icon(manode)) elif ma.use_nodes: layout.label(text="Node ") else: diff --git a/release/scripts/startup/bl_ui/properties_particle.py b/release/scripts/startup/bl_ui/properties_particle.py index ee8c74a2cb6..24e65622854 100644 --- a/release/scripts/startup/bl_ui/properties_particle.py +++ b/release/scripts/startup/bl_ui/properties_particle.py @@ -21,6 +21,8 @@ import bpy from bpy.types import Panel from rna_prop_ui import PropertyPanel +_ = bpy.app.translations.pgettext + from bl_ui.properties_physics_common import (point_cache_ui, effector_weights_ui, basic_force_field_settings_ui, @@ -148,8 +150,7 @@ class PARTICLE_PT_context_particles(ParticleButtonsPanel, Panel): #row.label(text="Render") if part.is_fluid: - pgettext = bpy.app.translations.pgettext - layout.label(text=pgettext("%d fluid particles for this frame") % part.count, translate=False) + layout.label(text=_("%d fluid particles for this frame") % part.count, translate=False) return row = col.row() diff --git a/release/scripts/startup/bl_ui/properties_physics_fluid.py b/release/scripts/startup/bl_ui/properties_physics_fluid.py index c03b5323105..623c6377954 100644 --- a/release/scripts/startup/bl_ui/properties_physics_fluid.py +++ b/release/scripts/startup/bl_ui/properties_physics_fluid.py @@ -20,6 +20,8 @@ import bpy from bpy.types import Panel, Menu +_ = bpy.app.translations.pgettext + class FLUID_MT_presets(Menu): bl_label = "Fluid Presets" @@ -64,8 +66,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel, Panel): if fluid.type == 'DOMAIN': # odd formatting here so translation script can extract string - pgettext = bpy.app.translations.pgettext - layout.operator("fluid.bake", text=pgettext("Bake (Req. Memory: %s)") % fluid.memory_estimate, + layout.operator("fluid.bake", text=_("Bake (Req. Memory: %s)") % fluid.memory_estimate, translate=False, icon='MOD_FLUIDSIM') split = layout.split() diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py index b61830a7527..cd232fc50f3 100644 --- a/release/scripts/startup/bl_ui/space_clip.py +++ b/release/scripts/startup/bl_ui/space_clip.py @@ -21,6 +21,8 @@ import bpy from bpy.types import Panel, Header, Menu, UIList +_ = bpy.app.translations.pgettext + class CLIP_UL_tracking_objects(UIList): def draw_item(self, context, layout, data, item, icon, @@ -911,11 +913,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") + text = _("Zoom %d:%d") for a, b in ratios: - layout.operator("clip.view_zoom_ratio", - text=text % (a, b), - translate=False).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' diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py index 43535eb8c2f..44b84eba919 100644 --- a/release/scripts/startup/bl_ui/space_image.py +++ b/release/scripts/startup/bl_ui/space_image.py @@ -22,6 +22,8 @@ from bpy.types import Header, Menu, Panel from bl_ui.properties_paint_common import UnifiedPaintPanel from bl_ui.properties_paint_common import brush_texture_settings +_ = bpy.app.translations.pgettext + class ImagePaintPanel(UnifiedPaintPanel): bl_space_type = 'IMAGE_EDITOR' @@ -71,10 +73,8 @@ 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=pgettext("Zoom %d:%d") % (a, b), - translate=False).ratio = a / b + layout.operator("image.view_zoom_ratio", text=_("Zoom %d:%d") % (a, b), translate=False).ratio = a / b layout.separator() @@ -723,7 +723,7 @@ class IMAGE_PT_tools_brush_texture(BrushButtonsPanel, Panel): col = layout.column() col.template_ID_preview(brush, "texture", new="texture.new", rows=3, cols=8) - + brush_texture_settings(col, brush, 0) diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py index b8f44a621a9..5d927e6b477 100644 --- a/release/scripts/startup/bl_ui/space_sequencer.py +++ b/release/scripts/startup/bl_ui/space_sequencer.py @@ -20,6 +20,8 @@ import bpy from bpy.types import Header, Menu, Panel +_ = bpy.app.translations.pgettext + def act_strip(context): try: @@ -420,19 +422,15 @@ 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=pgettext("Final Length: %s") % bpy.utils.smpte_from_frame(strip.frame_final_duration), - translate=False) + row.label(text=_("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=pgettext("Playhead: %d") % (frame_current - strip.frame_start), translate=False) + row.label(text=_("Playhead: %d") % (frame_current - strip.frame_start), translate=False) - 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) + col.label(text=_("Frame Offset %d:%d") % (strip.frame_offset_start, strip.frame_offset_end), translate=False) + col.label(text=_("Frame Still %d:%d") % (strip.frame_still_start, strip.frame_still_end), translate=False) elem = False @@ -442,7 +440,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=pgettext("Original Dimension: %dx%d") % (elem.orig_width, elem.orig_height), translate=False) + col.label(text=_("Original Dimension: %dx%d") % (elem.orig_width, elem.orig_height), translate=False) else: col.label(text="Original Dimension: None") @@ -719,8 +717,7 @@ class SEQUENCER_PT_scene(SequencerButtonsPanel, Panel): if scene: sta = scene.frame_start end = scene.frame_end - pgettext = bpy.app.translations.pgettext - layout.label(text=pgettext("Original frame range: %d-%d (%d)") % (sta, end, end - sta + 1), translate=False) + layout.label(text=_("Original frame range: %d-%d (%d)") % (sta, end, end - sta + 1), translate=False) class SEQUENCER_PT_mask(SequencerButtonsPanel, Panel): @@ -749,8 +746,7 @@ class SEQUENCER_PT_mask(SequencerButtonsPanel, Panel): if mask: sta = mask.frame_start end = mask.frame_end - pgettext = bpy.app.translations.pgettext - layout.label(text=pgettext("Original frame range: %d-%d (%d)") % (sta, end, end - sta + 1), translate=False) + layout.label(text=_("Original frame range: %d-%d (%d)") % (sta, end, end - sta + 1), translate=False) class SEQUENCER_PT_filter(SequencerButtonsPanel, Panel): diff --git a/release/scripts/startup/bl_ui/space_text.py b/release/scripts/startup/bl_ui/space_text.py index b32172e25e0..53b806cc7ea 100644 --- a/release/scripts/startup/bl_ui/space_text.py +++ b/release/scripts/startup/bl_ui/space_text.py @@ -20,6 +20,8 @@ import bpy from bpy.types import Header, Menu, Panel +_ = bpy.app.translations.pgettext + class TEXT_HT_header(Header): bl_space_type = 'TEXT_EDITOR' @@ -71,9 +73,8 @@ class TEXT_HT_header(Header): row = layout.row() if text.filepath: - pgettext = bpy.app.translations.pgettext if text.is_dirty: - row.label(text=pgettext("File: *%r (unsaved)") % + row.label(text=_("File: *%r (unsaved)") % text.filepath, translate=False) else: row.label(text=pgettext("File: %r") % diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 5bb83e7f429..eb9446f0fd0 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -20,6 +20,8 @@ import bpy from bpy.types import Header, Menu, Panel +_ = bpy.app.translations.pgettext + def ui_style_items(col, context): """ UI Style settings """ @@ -778,10 +780,9 @@ 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=pgettext("Color Set %d:") % (i + 1), translate=False) # i starts from 0 + col.label(text=_("Color Set %d:") % (i + 1), translate=False) # i starts from 0 row = col.row() diff --git a/release/scripts/startup/bl_ui/space_userpref_keymap.py b/release/scripts/startup/bl_ui/space_userpref_keymap.py index db78adcb576..83815366824 100644 --- a/release/scripts/startup/bl_ui/space_userpref_keymap.py +++ b/release/scripts/startup/bl_ui/space_userpref_keymap.py @@ -20,6 +20,8 @@ import bpy from bpy.types import Menu +_ = bpy.app.translations.pgettext + class USERPREF_MT_keyconfigs(Menu): bl_label = "KeyPresets" @@ -97,8 +99,7 @@ class InputKeyMapPanel: subcol = self.indented_layout(col, level + 1) subrow = subcol.row() subrow.prop(km, "show_expanded_items", text="", emboss=False) - pgettext = bpy.app.translations.pgettext - subrow.label(text=pgettext("%s (Global)") % km.name, translate=False) + subrow.label(text=_("%s (Global)") % km.name, translate=False) else: km.show_expanded_items = True