I18n: fix printf-style format translation in release/scripts/startup

Many reports and a few labels used string formatting without
explicitly calling tip_() or iface_(), so the untranslated message
was used instead of the translated one, even when it was extracted.

Differential Revision: https://developer.blender.org/D16405
This commit is contained in:
Damien Picard 2022-11-16 12:06:14 +01:00 committed by Bastien Montagne
parent 2683b74cb3
commit f415051a57
20 changed files with 139 additions and 103 deletions

View File

@ -16,6 +16,7 @@ from bpy.props import (
EnumProperty,
StringProperty,
)
from bpy.app.translations import pgettext_tip as tip_
class ANIM_OT_keying_set_export(Operator):
@ -111,7 +112,7 @@ class ANIM_OT_keying_set_export(Operator):
break
if not found:
self.report({'WARN'}, "Could not find material or light using Shader Node Tree - %s" % (ksp.id))
self.report({'WARN'}, tip_("Could not find material or light using Shader Node Tree - %s") % (ksp.id))
elif ksp.id.bl_rna.identifier.startswith("CompositorNodeTree"):
# Find compositor nodetree using this node tree...
for scene in bpy.data.scenes:
@ -119,7 +120,7 @@ class ANIM_OT_keying_set_export(Operator):
id_bpy_path = "bpy.data.scenes[\"%s\"].node_tree" % (scene.name)
break
else:
self.report({'WARN'}, "Could not find scene using Compositor Node Tree - %s" % (ksp.id))
self.report({'WARN'}, tip_("Could not find scene using Compositor Node Tree - %s") % (ksp.id))
elif ksp.id.bl_rna.name == "Key":
# "keys" conflicts with a Python keyword, hence the simple solution won't work
id_bpy_path = "bpy.data.shape_keys[\"%s\"]" % (ksp.id.name)
@ -324,7 +325,7 @@ class ClearUselessActions(Operator):
action.user_clear()
removed += 1
self.report({'INFO'}, "Removed %d empty and/or fake-user only Actions"
self.report({'INFO'}, tip_("Removed %d empty and/or fake-user only Actions")
% removed)
return {'FINISHED'}
@ -409,7 +410,7 @@ class UpdateAnimatedTransformConstraint(Operator):
print(log)
text = bpy.data.texts.new("UpdateAnimatedTransformConstraint Report")
text.from_string(log)
self.report({'INFO'}, "Complete report available on '%s' text datablock" % text.name)
self.report({'INFO'}, tip_("Complete report available on '%s' text datablock") % text.name)
return {'FINISHED'}

View File

@ -3,8 +3,10 @@ from __future__ import annotations
import bpy
from bpy.types import Operator
from bpy.app.translations import pgettext_data as data_
from bpy.app.translations import (
pgettext_data as data_,
pgettext_tip as tip_,
)
from bpy_extras.asset_utils import (
@ -125,7 +127,7 @@ class ASSET_OT_open_containing_blend_file(Operator):
return {'RUNNING_MODAL'}
if returncode:
self.report({'WARNING'}, "Blender sub-process exited with error code %d" % returncode)
self.report({'WARNING'}, tip_("Blender sub-process exited with error code %d") % returncode)
if bpy.ops.asset.library_refresh.poll():
bpy.ops.asset.library_refresh()

View File

@ -6,6 +6,7 @@ from mathutils import (
Vector,
Matrix,
)
from bpy.app.translations import pgettext_tip as tip_
def CLIP_spaces_walk(context, all_screens, tarea, tspace, callback, *args):
@ -193,7 +194,7 @@ class CLIP_OT_filter_tracks(Operator):
def execute(self, context):
num_tracks = self._filter_values(context, self.track_threshold)
self.report({'INFO'}, "Identified %d problematic tracks" % num_tracks)
self.report({'INFO'}, tip_("Identified %d problematic tracks") % num_tracks)
return {'FINISHED'}

View File

@ -10,6 +10,7 @@ from bpy.props import (
CollectionProperty,
StringProperty,
)
from bpy.app.translations import pgettext_tip as tip_
# ########## Datablock previews... ##########
@ -123,7 +124,7 @@ class WM_OT_previews_batch_generate(Operator):
if not self.use_backups:
cmd.append("--no_backups")
if subprocess.call(cmd):
self.report({'ERROR'}, "Previews generation process failed for file '%s'!" % blen_path)
self.report({'ERROR'}, tip_("Previews generation process failed for file '%s'!") % blen_path)
context.window_manager.progress_end()
return {'CANCELLED'}
context.window_manager.progress_update(i + 1)
@ -234,7 +235,7 @@ class WM_OT_previews_batch_clear(Operator):
if not self.use_backups:
cmd.append("--no_backups")
if subprocess.call(cmd):
self.report({'ERROR'}, "Previews clear process failed for file '%s'!" % blen_path)
self.report({'ERROR'}, tip_("Previews clear process failed for file '%s'!") % blen_path)
context.window_manager.progress_end()
return {'CANCELLED'}
context.window_manager.progress_update(i + 1)

View File

@ -3,6 +3,7 @@
import bpy
from bpy.types import Operator
from bpy.props import StringProperty
from bpy.app.translations import pgettext_tip as tip_
class EditExternally(Operator):
@ -52,8 +53,8 @@ class EditExternally(Operator):
if not os.path.exists(filepath) or not os.path.isfile(filepath):
self.report({'ERROR'},
"Image path %r not found, image may be packed or "
"unsaved" % filepath)
tip_("Image path %r not found, image may be packed or "
"unsaved") % filepath)
return {'CANCELLED'}
cmd = self._editor_guess(context) + [filepath]
@ -183,7 +184,7 @@ class ProjectApply(Operator):
except KeyError:
import traceback
traceback.print_exc()
self.report({'ERROR'}, "Could not find image '%s'" % image_name)
self.report({'ERROR'}, tip_("Could not find image '%s'") % image_name)
return {'CANCELLED'}
image.reload()

View File

@ -7,6 +7,7 @@ from bpy.props import (
EnumProperty,
IntProperty,
)
from bpy.app.translations import pgettext_tip as tip_
class MeshMirrorUV(Operator):
@ -164,18 +165,18 @@ class MeshMirrorUV(Operator):
if total_duplicates and total_no_active_UV:
self.report({'WARNING'},
"%d mesh(es) with no active UV layer, "
"%d duplicates found in %d mesh(es), mirror may be incomplete"
tip_("%d mesh(es) with no active UV layer, "
"%d duplicates found in %d mesh(es), mirror may be incomplete")
% (total_no_active_UV,
total_duplicates,
meshes_with_duplicates))
elif total_no_active_UV:
self.report({'WARNING'},
"%d mesh(es) with no active UV layer"
tip_("%d mesh(es) with no active UV layer")
% (total_no_active_UV,))
elif total_duplicates:
self.report({'WARNING'},
"%d duplicates found in %d mesh(es), mirror may be incomplete"
tip_("%d duplicates found in %d mesh(es), mirror may be incomplete")
% (total_duplicates, meshes_with_duplicates))
return {'FINISHED'}

View File

@ -8,6 +8,7 @@ from bpy.props import (
IntProperty,
StringProperty,
)
from bpy.app.translations import pgettext_tip as tip_
class SelectPattern(Operator):
@ -363,14 +364,12 @@ class ShapeTransfer(Operator):
for ob_other in objects:
if ob_other.type != 'MESH':
self.report({'WARNING'},
("Skipping '%s', "
"not a mesh") % ob_other.name)
tip_("Skipping '%s', not a mesh") % ob_other.name)
continue
me_other = ob_other.data
if len(me_other.vertices) != len(me.vertices):
self.report({'WARNING'},
("Skipping '%s', "
"vertex count differs") % ob_other.name)
tip_("Skipping '%s', vertex count differs") % ob_other.name)
continue
target_normals = me_nos(me_other.vertices)
@ -508,7 +507,7 @@ class JoinUVs(Operator):
if not mesh.uv_layers:
self.report({'WARNING'},
"Object: %s, Mesh: '%s' has no UVs"
tip_("Object: %s, Mesh: '%s' has no UVs")
% (obj.name, mesh.name))
else:
nbr_loops = len(mesh.loops)
@ -531,9 +530,10 @@ class JoinUVs(Operator):
mesh_other.tag = True
if len(mesh_other.loops) != nbr_loops:
self.report({'WARNING'}, "Object: %s, Mesh: "
"'%s' has %d loops (for %d faces),"
" expected %d\n"
self.report({'WARNING'},
tip_("Object: %s, Mesh: "
"'%s' has %d loops (for %d faces),"
" expected %d\n")
% (obj_other.name,
mesh_other.name,
len(mesh_other.loops),
@ -547,9 +547,10 @@ class JoinUVs(Operator):
mesh_other.uv_layers.new()
uv_other = mesh_other.uv_layers.active
if not uv_other:
self.report({'ERROR'}, "Could not add "
"a new UV map to object "
"'%s' (Mesh '%s')\n"
self.report({'ERROR'},
tip_("Could not add "
"a new UV map to object "
"'%s' (Mesh '%s')\n")
% (obj_other.name,
mesh_other.name,
),
@ -784,8 +785,8 @@ class TransformsToDeltasAnim(Operator):
adt = obj.animation_data
if (adt is None) or (adt.action is None):
self.report({'WARNING'},
"No animation data to convert on object: %r" %
obj.name)
tip_("No animation data to convert on object: %r")
% obj.name)
continue
# first pass over F-Curves: ensure that we don't have conflicting
@ -811,8 +812,8 @@ class TransformsToDeltasAnim(Operator):
if fcu.array_index in existingFCurves[dpath]:
# conflict
self.report({'ERROR'},
"Object '%r' already has '%r' F-Curve(s). "
"Remove these before trying again" %
tip_("Object '%r' already has '%r' F-Curve(s). "
"Remove these before trying again") %
(obj.name, dpath))
return {'CANCELLED'}
else:

View File

@ -9,6 +9,7 @@ from bpy.props import (
FloatProperty,
IntProperty,
)
from bpy.app.translations import pgettext_tip as tip_
def object_ensure_material(obj, mat_name):
@ -176,8 +177,8 @@ class QuickExplode(ObjectModeOperator, Operator):
for obj in mesh_objects:
if obj.particle_systems:
self.report({'ERROR'},
"Object %r already has a "
"particle system" % obj.name)
tip_("Object %r already has a "
"particle system") % obj.name)
return {'CANCELLED'}

View File

@ -10,8 +10,11 @@ from bpy.props import (
BoolProperty,
StringProperty,
)
from bpy.app.translations import (
pgettext_tip as tip_,
pgettext_data as data_,
)
from bpy.app.translations import pgettext_data as data_
# For preset popover menu
WindowManager.preset_name = StringProperty(
@ -186,7 +189,7 @@ class AddPresetBase:
else:
os.remove(filepath)
except Exception as e:
self.report({'ERROR'}, "Unable to remove preset: %r" % e)
self.report({'ERROR'}, tip_("Unable to remove preset: %r") % e)
import traceback
traceback.print_exc()
return {'CANCELLED'}
@ -236,7 +239,7 @@ class ExecutePreset(Operator):
ext = splitext(filepath)[1].lower()
if ext not in {".py", ".xml"}:
self.report({'ERROR'}, "Unknown file type: %r" % ext)
self.report({'ERROR'}, tip_("Unknown file type: %r") % ext)
return {'CANCELLED'}
if hasattr(preset_class, "reset_cb"):

View File

@ -4,7 +4,6 @@
import bpy
from bpy.types import Operator
from bpy.app.translations import pgettext_tip as tip_

View File

@ -8,6 +8,7 @@ from bpy.props import (
FloatProperty,
IntProperty,
)
from bpy.app.translations import pgettext_tip as tip_
class SequencerCrossfadeSounds(Operator):
@ -231,7 +232,7 @@ class SequencerFadesAdd(Operator):
sequence.invalidate_cache('COMPOSITE')
sequence_string = "sequence" if len(faded_sequences) == 1 else "sequences"
self.report({'INFO'}, "Added fade animation to %d %s" % (len(faded_sequences), sequence_string))
self.report({'INFO'}, tip_("Added fade animation to %d %s") % (len(faded_sequences), sequence_string))
return {'FINISHED'}
def calculate_fade_duration(self, context, sequence):

View File

@ -12,8 +12,10 @@ from bpy.props import (
StringProperty,
CollectionProperty,
)
from bpy.app.translations import pgettext_tip as tip_
from bpy.app.translations import (
pgettext_iface as iface_,
pgettext_tip as tip_,
)
def _zipfile_root_namelist(file_to_extract):
@ -224,7 +226,7 @@ class PREFERENCES_OT_keyconfig_import(Operator):
else:
shutil.move(self.filepath, path)
except Exception as ex:
self.report({'ERROR'}, "Installing keymap failed: %s" % ex)
self.report({'ERROR'}, tip_("Installing keymap failed: %s") % ex)
return {'CANCELLED'}
# sneaky way to check we're actually running the code.
@ -450,11 +452,11 @@ class PREFERENCES_OT_addon_enable(Operator):
if info_ver > bpy.app.version:
self.report(
{'WARNING'},
"This script was written Blender "
"version %d.%d.%d and might not "
"function (correctly), "
"though it is enabled" %
info_ver
tip_("This script was written Blender "
"version %d.%d.%d and might not "
"function (correctly), "
"though it is enabled")
% info_ver
)
return {'FINISHED'}
else:
@ -538,7 +540,7 @@ class PREFERENCES_OT_theme_install(Operator):
if not self.overwrite:
if os.path.exists(path_dest):
self.report({'WARNING'}, "File already installed to %r\n" % path_dest)
self.report({'WARNING'}, tip_("File already installed to %r\n") % path_dest)
return {'CANCELLED'}
try:
@ -645,7 +647,7 @@ class PREFERENCES_OT_addon_install(Operator):
pyfile_dir = os.path.dirname(pyfile)
for addon_path in addon_utils.paths():
if os.path.samefile(pyfile_dir, addon_path):
self.report({'ERROR'}, "Source file is in the add-on search path: %r" % addon_path)
self.report({'ERROR'}, tip_("Source file is in the add-on search path: %r") % addon_path)
return {'CANCELLED'}
del addon_path
del pyfile_dir
@ -669,7 +671,7 @@ class PREFERENCES_OT_addon_install(Operator):
for f in file_to_extract_root:
path_dest = os.path.join(path_addons, os.path.basename(f))
if os.path.exists(path_dest):
self.report({'WARNING'}, "File already installed to %r\n" % path_dest)
self.report({'WARNING'}, tip_("File already installed to %r\n") % path_dest)
return {'CANCELLED'}
try: # extract the file to "addons"
@ -684,7 +686,7 @@ class PREFERENCES_OT_addon_install(Operator):
if self.overwrite:
_module_filesystem_remove(path_addons, os.path.basename(pyfile))
elif os.path.exists(path_dest):
self.report({'WARNING'}, "File already installed to %r\n" % path_dest)
self.report({'WARNING'}, tip_("File already installed to %r\n") % path_dest)
return {'CANCELLED'}
# if not compressed file just copy into the addon path
@ -764,7 +766,7 @@ class PREFERENCES_OT_addon_remove(Operator):
path, isdir = PREFERENCES_OT_addon_remove.path_from_addon(self.module)
if path is None:
self.report({'WARNING'}, "Add-on path %r could not be found" % path)
self.report({'WARNING'}, tip_("Add-on path %r could not be found") % path)
return {'CANCELLED'}
# in case its enabled
@ -783,9 +785,9 @@ class PREFERENCES_OT_addon_remove(Operator):
# lame confirmation check
def draw(self, _context):
self.layout.label(text="Remove Add-on: %r?" % self.module)
self.layout.label(text=iface_("Remove Add-on: %r?") % self.module, translate=False)
path, _isdir = PREFERENCES_OT_addon_remove.path_from_addon(self.module)
self.layout.label(text="Path: %r" % path)
self.layout.label(text=iface_("Path: %r") % path, translate=False)
def invoke(self, context, _event):
wm = context.window_manager
@ -914,7 +916,7 @@ class PREFERENCES_OT_app_template_install(Operator):
for f in file_to_extract_root:
path_dest = os.path.join(path_app_templates, os.path.basename(f))
if os.path.exists(path_dest):
self.report({'WARNING'}, "File already installed to %r\n" % path_dest)
self.report({'WARNING'}, tip_("File already installed to %r\n") % path_dest)
return {'CANCELLED'}
try: # extract the file to "bl_app_templates_user"
@ -925,7 +927,7 @@ class PREFERENCES_OT_app_template_install(Operator):
else:
# Only support installing zipfiles
self.report({'WARNING'}, "Expected a zip-file %r\n" % filepath)
self.report({'WARNING'}, tip_("Expected a zip-file %r\n") % filepath)
return {'CANCELLED'}
app_templates_new = set(os.listdir(path_app_templates)) - app_templates_old

View File

@ -772,7 +772,7 @@ class WM_OT_operator_pie_enum(Operator):
try:
op_rna = op.get_rna_type()
except KeyError:
self.report({'ERROR'}, "Operator not found: bpy.ops.%s" % data_path)
self.report({'ERROR'}, tip_("Operator not found: bpy.ops.%s") % data_path)
return {'CANCELLED'}
def draw_cb(self, context):
@ -872,7 +872,7 @@ class WM_OT_context_collection_boolean_set(Operator):
elif value_orig is False:
pass
else:
self.report({'WARNING'}, "Non boolean value found: %s[ ].%s" %
self.report({'WARNING'}, tip_("Non boolean value found: %s[ ].%s") %
(data_path_iter, data_path_item))
return {'CANCELLED'}
@ -975,7 +975,7 @@ class WM_OT_context_modal_mouse(Operator):
(item, ) = self._values.keys()
header_text = header_text % eval("item.%s" % self.data_path_item)
else:
header_text = (self.header_text % delta) + " (delta)"
header_text = (self.header_text % delta) + tip_(" (delta)")
context.area.header_text_set(header_text)
elif 'LEFTMOUSE' == event_type:
@ -995,7 +995,7 @@ class WM_OT_context_modal_mouse(Operator):
self._values_store(context)
if not self._values:
self.report({'WARNING'}, "Nothing to operate on: %s[ ].%s" %
self.report({'WARNING'}, tip_("Nothing to operate on: %s[ ].%s") %
(self.data_path_iter, self.data_path_item))
return {'CANCELLED'}
@ -1133,7 +1133,7 @@ class WM_OT_path_open(Operator):
filepath = os.path.normpath(filepath)
if not os.path.exists(filepath):
self.report({'ERROR'}, "File '%s' not found" % filepath)
self.report({'ERROR'}, tip_("File '%s' not found") % filepath)
return {'CANCELLED'}
if sys.platform[:3] == "win":
@ -1204,7 +1204,7 @@ def _wm_doc_get_id(doc_id, *, do_url=True, url_prefix="", report=None):
if rna_class is None:
if report is not None:
report({'ERROR'}, iface_("Type \"%s\" can not be found") % class_name)
report({'ERROR'}, tip_("Type \"%s\" can not be found") % class_name)
return None
# Detect if this is a inherited member and use that name instead.
@ -1275,9 +1275,9 @@ class WM_OT_doc_view_manual(Operator):
if url is None:
self.report(
{'WARNING'},
"No reference available %r, "
"Update info in 'rna_manual_reference.py' "
"or callback to bpy.utils.manual_map()" %
tip_("No reference available %r, "
"Update info in 'rna_manual_reference.py' "
"or callback to bpy.utils.manual_map()") %
self.doc_id
)
return {'CANCELLED'}
@ -2156,7 +2156,7 @@ class WM_OT_tool_set_by_id(Operator):
tool_settings.workspace_tool_type = 'FALLBACK'
return {'FINISHED'}
else:
self.report({'WARNING'}, "Tool %r not found for space %r" % (self.name, space_type))
self.report({'WARNING'}, tip_("Tool %r not found for space %r") % (self.name, space_type))
return {'CANCELLED'}
@ -2943,7 +2943,7 @@ class WM_OT_batch_rename(Operator):
row.prop(action, "op_remove", text="", icon='REMOVE')
row.prop(action, "op_add", text="", icon='ADD')
layout.label(text=iface_("Rename %d %s") % (len(self._data[0]), self._data[2]))
layout.label(text=iface_("Rename %d %s") % (len(self._data[0]), self._data[2]), translate=False)
def check(self, context):
changed = False
@ -3083,7 +3083,7 @@ class WM_MT_splash_quick_setup(Menu):
old_version = bpy.types.PREFERENCES_OT_copy_prev.previous_version()
if bpy.types.PREFERENCES_OT_copy_prev.poll(context) and old_version:
sub.operator("preferences.copy_prev", text=iface_("Load %d.%d Settings", "Operator") % old_version)
sub.operator("preferences.copy_prev", text=iface_("Load %d.%d Settings", "Operator") % old_version, translate=False)
sub.operator("wm.save_userpref", text="Save New Settings")
else:
sub.label()

View File

@ -3,8 +3,10 @@ import bpy
from bpy.types import Menu, Panel, UIList
from rna_prop_ui import PropertyPanel
from bpy.app.translations import pgettext_tip as tip_
from bpy.app.translations import (
pgettext_tip as iface_,
pgettext_tip as tip_,
)
class MESH_MT_vertex_group_context_menu(Menu):
bl_label = "Vertex Group Specials"
@ -549,7 +551,8 @@ class MESH_UL_attributes(UIList):
sub = split.row()
sub.alignment = 'RIGHT'
sub.active = False
sub.label(text="%s%s" % (domain_name, data_type.name))
sub.label(text="%s%s" % (iface_(domain_name), iface_(data_type.name)),
translate=False)
class DATA_PT_mesh_attributes(MeshButtonsPanel, Panel):
@ -650,7 +653,8 @@ class MESH_UL_color_attributes(UIList, ColorAttributesListBase):
sub = split.row()
sub.alignment = 'RIGHT'
sub.active = False
sub.label(text="%s%s" % (domain_name, data_type.name))
sub.label(text="%s%s" % (iface_(domain_name), iface_(data_type.name)),
translate=False)
active_render = _index == data.color_attributes.render_color_index

View File

@ -400,9 +400,12 @@ class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel, Panel):
label = "ERROR"
icon = 'ERROR'
box.label(text=label, icon=icon)
box.label(text="Iterations: %d .. %d (avg. %d)" %
(result.min_iterations, result.max_iterations, result.avg_iterations))
box.label(text="Error: %.5f .. %.5f (avg. %.5f)" % (result.min_error, result.max_error, result.avg_error))
box.label(text=iface_("Iterations: %d .. %d (avg. %d)") %
(result.min_iterations, result.max_iterations, result.avg_iterations),
translate=False)
box.label(text=iface_("Error: %.5f .. %.5f (avg. %.5f)")
% (result.min_error, result.max_error, result.avg_error),
translate=False)
class PARTICLE_PT_hair_dynamics_collision(ParticleButtonsPanel, Panel):
@ -756,7 +759,7 @@ class PARTICLE_PT_physics_fluid_advanced(ParticleButtonsPanel, Panel):
particle_volume = part.mass / fluid.rest_density
spacing = pow(particle_volume, 1.0 / 3.0)
sub.label(text="Spacing: %g" % spacing)
sub.label(text=iface_("Spacing: %g") % spacing, translate=False)
class PARTICLE_PT_physics_fluid_springs(ParticleButtonsPanel, Panel):

View File

@ -3,6 +3,7 @@ import bpy
from bpy.types import (
Panel,
)
from bpy.app.translations import pgettext_iface as iface_
from rna_prop_ui import PropertyPanel
@ -67,7 +68,8 @@ class WORKSPACE_PT_addons(WorkSpaceButtonsPanel, Panel):
row.operator(
"wm.owner_disable" if is_enabled else "wm.owner_enable",
icon='CHECKBOX_HLT' if is_enabled else 'CHECKBOX_DEHLT',
text="%s: %s" % (info["category"], info["name"]),
text=iface_("%s: %s" ) % (iface_(info["category"]), iface_(info["name"])),
translate=False,
emboss=False,
).owner_id = module_name
if is_enabled:

View File

@ -168,8 +168,9 @@ class CLIP_HT_header(Header):
r = active_object.reconstruction
if r.is_valid and sc.view == 'CLIP':
layout.label(text="Solve error: %.2f px" %
(r.average_error))
layout.label(text=iface_("Solve error: %.2f px") %
(r.average_error),
translate=False)
row = layout.row()
row.prop(sc, "pivot_point", text="", icon_only=True)
@ -737,8 +738,8 @@ class CLIP_PT_track(CLIP_PT_tracking_panel, Panel):
layout.prop(act_track, "weight_stab")
if act_track.has_bundle:
label_text = "Average Error: %.2f px" % (act_track.average_error)
layout.label(text=label_text)
label_text = iface_("Average Error: %.2f px") % (act_track.average_error)
layout.label(text=label_text, translate=False)
layout.use_property_split = False

View File

@ -407,15 +407,20 @@ class TOPBAR_MT_file_defaults(Menu):
app_template = None
if app_template:
layout.label(text=bpy.path.display_name(
app_template, has_ext=False))
layout.label(
text=iface_(bpy.path.display_name(app_template, has_ext=False),
i18n_contexts.id_workspace), translate=False)
layout.operator("wm.save_homefile")
if app_template:
display_name = bpy.path.display_name(iface_(app_template))
props = layout.operator("wm.read_factory_settings", text="Load Factory Blender Settings")
props = layout.operator("wm.read_factory_settings",
text="Load Factory Blender Settings")
props.app_template = app_template
props = layout.operator("wm.read_factory_settings", text="Load Factory %s Settings" % display_name)
props = layout.operator("wm.read_factory_settings",
text=iface_("Load Factory %s Settings",
i18n_contexts.operator_default) % display_name,
translate=False)
props.app_template = app_template
props.use_factory_startup_app_template_only = True
del display_name

View File

@ -114,7 +114,9 @@ class USERPREF_MT_save_load(Menu):
if app_template:
display_name = bpy.path.display_name(iface_(app_template))
layout.operator("wm.read_factory_userpref", text="Load Factory Blender Preferences")
props = layout.operator("wm.read_factory_userpref", text="Load Factory %s Preferences" % display_name)
props = layout.operator("wm.read_factory_userpref",
text=iface_("Load Factory %s Preferences") % display_name,
translate=False)
props.use_factory_startup_app_template_only = True
del display_name
else:

View File

@ -18,7 +18,10 @@ from bl_ui.properties_grease_pencil_common import (
from bl_ui.space_toolsystem_common import (
ToolActivePanelHelper,
)
from bpy.app.translations import contexts as i18n_contexts
from bpy.app.translations import (
pgettext_tip as tip_,
contexts as i18n_contexts,
)
class VIEW3D_HT_tool_header(Header):
@ -1133,7 +1136,9 @@ class VIEW3D_MT_mirror(Menu):
for (space_name, space_id) in (("Global", 'GLOBAL'), ("Local", 'LOCAL')):
for axis_index, axis_name in enumerate("XYZ"):
props = layout.operator("transform.mirror", text="%s %s" % (axis_name, space_name))
props = layout.operator("transform.mirror",
text="%s %s" % (axis_name, iface_(space_name)),
translate=False)
props.constraint_axis[axis_index] = True
props.orient_type = space_id
@ -2549,16 +2554,16 @@ class VIEW3D_MT_object_context_menu(Menu):
props.data_path_item = "data.lens"
props.input_scale = 0.1
if obj.data.lens_unit == 'MILLIMETERS':
props.header_text = "Camera Focal Length: %.1fmm"
props.header_text = tip_("Camera Focal Length: %.1fmm")
else:
props.header_text = "Camera Focal Length: %.1f\u00B0"
props.header_text = tip_("Camera Focal Length: %.1f\u00B0")
else:
props = layout.operator("wm.context_modal_mouse", text="Camera Lens Scale")
props.data_path_iter = "selected_editable_objects"
props.data_path_item = "data.ortho_scale"
props.input_scale = 0.01
props.header_text = "Camera Lens Scale: %.3f"
props.header_text = tip_("Camera Lens Scale: %.3f")
if not obj.data.dof.focus_object:
if view and view.camera == obj and view.region_3d.view_perspective == 'CAMERA':
@ -2568,7 +2573,7 @@ class VIEW3D_MT_object_context_menu(Menu):
props.data_path_iter = "selected_editable_objects"
props.data_path_item = "data.dof.focus_distance"
props.input_scale = 0.02
props.header_text = "Focus Distance: %.3f"
props.header_text = tip_("Focus Distance: %.3f")
layout.separator()
@ -2579,13 +2584,13 @@ class VIEW3D_MT_object_context_menu(Menu):
props.data_path_iter = "selected_editable_objects"
props.data_path_item = "data.extrude"
props.input_scale = 0.01
props.header_text = "Extrude: %.3f"
props.header_text = tip_("Extrude: %.3f")
props = layout.operator("wm.context_modal_mouse", text="Adjust Offset")
props.data_path_iter = "selected_editable_objects"
props.data_path_item = "data.offset"
props.input_scale = 0.01
props.header_text = "Offset: %.3f"
props.header_text = tip_("Offset: %.3f")
layout.separator()
@ -2596,7 +2601,7 @@ class VIEW3D_MT_object_context_menu(Menu):
props.data_path_iter = "selected_editable_objects"
props.data_path_item = "empty_display_size"
props.input_scale = 0.01
props.header_text = "Empty Display Size: %.3f"
props.header_text = tip_("Empty Display Size: %.3f")
layout.separator()
@ -2614,36 +2619,36 @@ class VIEW3D_MT_object_context_menu(Menu):
props.data_path_iter = "selected_editable_objects"
props.data_path_item = "data.energy"
props.input_scale = 1.0
props.header_text = "Light Power: %.3f"
props.header_text = tip_("Light Power: %.3f")
if light.type == 'AREA':
if light.shape in {'RECTANGLE', 'ELLIPSE'}:
props = layout.operator("wm.context_modal_mouse", text="Adjust Area Light X Size")
props.data_path_iter = "selected_editable_objects"
props.data_path_item = "data.size"
props.header_text = "Light Size X: %.3f"
props.header_text = tip_("Light Size X: %.3f")
props = layout.operator("wm.context_modal_mouse", text="Adjust Area Light Y Size")
props.data_path_iter = "selected_editable_objects"
props.data_path_item = "data.size_y"
props.header_text = "Light Size Y: %.3f"
props.header_text = tip_("Light Size Y: %.3f")
else:
props = layout.operator("wm.context_modal_mouse", text="Adjust Area Light Size")
props.data_path_iter = "selected_editable_objects"
props.data_path_item = "data.size"
props.header_text = "Light Size: %.3f"
props.header_text = tip_("Light Size: %.3f")
elif light.type in {'SPOT', 'POINT'}:
props = layout.operator("wm.context_modal_mouse", text="Adjust Light Radius")
props.data_path_iter = "selected_editable_objects"
props.data_path_item = "data.shadow_soft_size"
props.header_text = "Light Radius: %.3f"
props.header_text = tip_("Light Radius: %.3f")
elif light.type == 'SUN':
props = layout.operator("wm.context_modal_mouse", text="Adjust Sun Light Angle")
props.data_path_iter = "selected_editable_objects"
props.data_path_item = "data.angle"
props.header_text = "Light Angle: %.3f"
props.header_text = tip_("Light Angle: %.3f")
if light.type == 'SPOT':
layout.separator()
@ -2652,13 +2657,13 @@ class VIEW3D_MT_object_context_menu(Menu):
props.data_path_iter = "selected_editable_objects"
props.data_path_item = "data.spot_size"
props.input_scale = 0.01
props.header_text = "Spot Size: %.2f"
props.header_text = tip_("Spot Size: %.2f")
props = layout.operator("wm.context_modal_mouse", text="Adjust Spot Light Blend")
props.data_path_iter = "selected_editable_objects"
props.data_path_item = "data.spot_blend"
props.input_scale = -0.01
props.header_text = "Spot Blend: %.2f"
props.header_text = tip_("Spot Blend: %.2f")
layout.separator()