From 3b33b3592f6250909ddf84e59869c634602b6ee1 Mon Sep 17 00:00:00 2001 From: Damien Picard Date: Tue, 6 Dec 2022 18:23:35 +0100 Subject: [PATCH] VR Scene Inspection: enable translation of UI messages Most UI messages are extracted automatically, but some more complex ones need to be manually. --- viewport_vr_preview/__init__.py | 2 +- viewport_vr_preview/gui.py | 11 +++++------ viewport_vr_preview/operators.py | 9 +++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/viewport_vr_preview/__init__.py b/viewport_vr_preview/__init__.py index cc4580ae0..55c7ed897 100644 --- a/viewport_vr_preview/__init__.py +++ b/viewport_vr_preview/__init__.py @@ -3,7 +3,7 @@ bl_info = { "name": "VR Scene Inspection", "author": "Julian Eisel (Severin), Sebastian Koenig, Peter Kim (muxed-reality)", - "version": (0, 11, 1), + "version": (0, 11, 2), "blender": (3, 2, 0), "location": "3D View > Sidebar > VR", "description": ("View the viewport with virtual reality glasses " diff --git a/viewport_vr_preview/gui.py b/viewport_vr_preview/gui.py index b5c9a470b..048f2c555 100644 --- a/viewport_vr_preview/gui.py +++ b/viewport_vr_preview/gui.py @@ -7,6 +7,7 @@ else: from . import properties import bpy +from bpy.app.translations import pgettext_iface as iface_ from bpy.types import ( Menu, Panel, @@ -37,12 +38,10 @@ class VIEW3D_PT_vr_session(Panel): # Using SNAP_FACE because it looks like a stop icon -- I shouldn't # have commit rights... - toggle_info = ( - ("Start VR Session", 'PLAY') if not is_session_running else ( - "Stop VR Session", 'SNAP_FACE') - ) - layout.operator("wm.xr_session_toggle", - text=toggle_info[0], icon=toggle_info[1]) + toggle_info = ((iface_("Start VR Session"), 'PLAY') if not is_session_running + else (iface_("Stop VR Session"), 'SNAP_FACE')) + layout.operator("wm.xr_session_toggle", text=toggle_info[0], + translate=False, icon=toggle_info[1]) layout.separator() diff --git a/viewport_vr_preview/operators.py b/viewport_vr_preview/operators.py index c7c27c8f8..2b75da28c 100644 --- a/viewport_vr_preview/operators.py +++ b/viewport_vr_preview/operators.py @@ -8,6 +8,7 @@ else: import bpy import gpu +from bpy.app.translations import pgettext_data as data_ from bpy.types import ( Gizmo, GizmoGroup, @@ -117,8 +118,8 @@ class VIEW3D_OT_vr_camera_landmark_from_session(Operator): loc = wm.xr_session_state.viewer_pose_location rot = wm.xr_session_state.viewer_pose_rotation.to_euler() - cam = bpy.data.cameras.new("Camera_" + lm.name) - new_cam = bpy.data.objects.new("Camera_" + lm.name, cam) + cam = bpy.data.cameras.new(data_("Camera") + "_" + lm.name) + new_cam = bpy.data.objects.new(data_("Camera") + "_" + lm.name, cam) scene.collection.objects.link(new_cam) new_cam.location = loc new_cam.rotation_euler = rot @@ -215,8 +216,8 @@ class VIEW3D_OT_add_camera_from_vr_landmark(Operator): scene = context.scene lm = properties.VRLandmark.get_selected_landmark(context) - cam = bpy.data.cameras.new("Camera_" + lm.name) - new_cam = bpy.data.objects.new("Camera_" + lm.name, cam) + cam = bpy.data.cameras.new(data_("Camera") + "_" + lm.name) + new_cam = bpy.data.objects.new(data_("Camera") + "_" + lm.name, cam) scene.collection.objects.link(new_cam) angle = lm.base_pose_angle new_cam.location = lm.base_pose_location -- 2.30.2