I18n: fix description_from_data_path() for property assignment

The property assignment operators' tooltips were never actually
translated when they were constructed dynamically from the description
in the prop's RNA.

This was visible when using such operators in menus (example I found
was the Marker Settings, Shift + E in the Movie Clip Editor).

"%s: %s" is already extracted elsewhere, might as well use it.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D16439
This commit is contained in:
Damien Picard 2022-11-15 11:28:41 +01:00 committed by Bastien Montagne
parent 83c21e01dd
commit 9795f2645c
1 changed files with 4 additions and 4 deletions

View File

@ -203,9 +203,9 @@ def description_from_data_path(base, data_path, *, prefix, value=Ellipsis):
if (
(rna_prop := context_path_to_rna_property(base, data_path)) and
(description := rna_prop.description)
(description := iface_(rna_prop.description))
):
description = "%s: %s" % (prefix, description)
description = iface_("%s: %s") % (prefix, description)
if value != Ellipsis:
description = "%s\n%s: %s" % (description, iface_("Value"), str(value))
return description
@ -305,7 +305,7 @@ class WM_OT_context_set_int(Operator): # same as enum
@classmethod
def description(cls, context, props):
return description_from_data_path(context, props.data_path, prefix="Assign", value=props.value)
return description_from_data_path(context, props.data_path, prefix=iface_("Assign"), value=props.value)
execute = execute_context_assign
@ -406,7 +406,7 @@ class WM_OT_context_set_float(Operator): # same as enum
@classmethod
def description(cls, context, props):
return description_from_data_path(context, props.data_path, prefix="Assign", value=props.value)
return description_from_data_path(context, props.data_path, prefix=iface_("Assign"), value=props.value)
execute = execute_context_assign