Fix T66065: Missing text in the UI translations files due to 'fstring' usages.

Am not even sure that it is possible to use fstrings at all when UI
translation is required (that is, is a sensible, reasonable way that
does not make things even more complicated than they already are), but
one thing is certain, this won't be trivial to get it working, so
definitively not a job for now.

Instead just do not use fstrings for UI translatable strings.
This commit is contained in:
Bastien Montagne 2019-06-25 17:26:56 +02:00
parent 24b47c00ea
commit 787e2ddbd7
Notes: blender-bot 2023-02-14 10:29:32 +01:00
Referenced by issue #66065, Missing text in the msgid entry, might be there is an error in the extraction code
3 changed files with 16 additions and 7 deletions

View File

@ -20,6 +20,8 @@ import bpy
from bpy.types import Operator
from bpy.props import StringProperty
from bpy.app.translations import pgettext_tip as tip_
class CYCLES_OT_use_shading_nodes(Operator):
"""Enable nodes on a material, world or light"""
@ -98,7 +100,8 @@ class CYCLES_OT_denoise_animation(Operator):
if not os.path.isfile(filepath):
scene.render.filepath = original_filepath
self.report({'ERROR'}, f"Frame '{filepath}' not found, animation must be complete.")
err_msg = tip_("Frame '%s' not found, animation must be complete") % filepath
self.report({'ERROR'}, err_msg)
return {'CANCELLED'}
scene.render.filepath = out_filepath

View File

@ -24,6 +24,8 @@ import bpy
from bpy.types import Operator
import os
from bpy.app.translations import pgettext_tip as tip_
def guess_player_path(preset):
import sys
@ -114,15 +116,17 @@ class PlayRenderedAnim(Operator):
file = rd.frame_path(frame=scene.frame_start, preview=scene.use_preview_range)
file = bpy.path.abspath(file) # expand '//'
if not os.path.exists(file):
self.report({'WARNING'}, f"File {file!r} not found")
err_msg = tip_("File %s not found") % file
self.report({'WARNING'}, err_msg)
path_valid = False
# one last try for full range if we used preview range
if scene.use_preview_range and not path_valid:
file = rd.frame_path(frame=scene.frame_start, preview=False)
file = bpy.path.abspath(file) # expand '//'
err_msg = tip_("File %s not found") % file
if not os.path.exists(file):
self.report({'WARNING'}, f"File {file!r} not found")
self.report({'WARNING'}, err_msg)
cmd = [player_path]
# extra options, fps controls etc.
@ -179,10 +183,10 @@ class PlayRenderedAnim(Operator):
try:
subprocess.Popen(cmd, env=env_copy)
except Exception as e:
err_msg = tip_("Couldn't run external animation player with command %s\n%s") % (cmd, e)
self.report(
{'ERROR'},
"Couldn't run external animation player with command "
f"{cmd!r}\n{e!s}",
err_msg,
)
return {'CANCELLED'}

View File

@ -22,6 +22,8 @@ import bpy
from bpy.types import Menu, Panel, UIList
from bl_ui.utils import PresetPanel
from bpy.app.translations import pgettext_tip as tip_
class RENDER_PT_presets(PresetPanel, Panel):
bl_label = "Render Presets"
@ -81,10 +83,10 @@ class RENDER_PT_dimensions(RenderOutputButtonsPanel, Panel):
custom_framerate = (fps_rate not in {23.98, 24, 25, 29.97, 30, 50, 59.94, 60})
if custom_framerate is True:
fps_label_text = f"Custom ({fps_rate!r} fps)"
fps_label_text = tip_("Custom (%.4g fps)") % fps_rate
show_framerate = True
else:
fps_label_text = f"{fps_rate!r} fps"
fps_label_text = tip_("%.4g fps") % fps_rate
show_framerate = (preset_label == "Custom")
RENDER_PT_dimensions._frame_rate_args_prev = args