File tree 2 files changed +29
-1
lines changed
2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -180,7 +180,7 @@ def script_name(self):
180
180
def notes (self ):
181
181
for attrib , note in ATTRIB2NOTE .items ():
182
182
if getattr (self , attrib ):
183
- yield note
183
+ yield _ ( note )
184
184
185
185
def related_options_titles (self ):
186
186
if not self .related_options :
Original file line number Diff line number Diff line change 47
47
)
48
48
49
49
50
+ def _translate_patch (s ):
51
+ if s in {
52
+ "<p><strong>{title}:</strong> {values}.</p>" ,
53
+ "<p><em>%{name}%</em> [{tagdesc}]</p>{content}" ,
54
+ "<p><em>%{name}%</em></p>{content}" ,
55
+ }:
56
+ return s .replace ('<p>' , '<p dir="rtl">' )
57
+ return f"_({ s } )"
58
+
59
+
50
60
class TagVarTest (PicardTestCase ):
51
61
def test_basic_properties (self ):
52
62
tv = TagVar ('name' )
@@ -295,6 +305,24 @@ def test_tagvars_display_tooltip(self):
295
305
)
296
306
self .assertEqual (tagvars .display_tooltip ('notes3' ), result )
297
307
308
+ @mock .patch ("picard.util.tags._" , side_effect = _translate_patch )
309
+ def test_tagvars_display_tooltip_translate (self , mock ):
310
+ tagvars = TagVars (
311
+ self .tagvar_nodesc ,
312
+ self .tagvar_only_sd ,
313
+ self .tagvar_hidden_sd ,
314
+ self .tagvar_notes1 ,
315
+ )
316
+ self .assertEqual (tagvars .display_tooltip ('nodesc' ), '<p dir="rtl"><em>%nodesc%</em></p><p>_(nodesc)</p>' )
317
+ self .assertEqual (tagvars .display_tooltip ('only_sd' ), '<p dir="rtl"><em>%only_sd%</em></p><p>_(only_sd_shortdesc)</p>' )
318
+ self .assertEqual (tagvars .display_tooltip ('~hidden:xxx' ), '<p dir="rtl"><em>%_hidden%</em> [xxx]</p><p>_(No description available.)</p>' )
319
+
320
+ result = (
321
+ '<p dir="rtl"><em>%_notes1%</em></p><p>_(notes1_ld)</p>'
322
+ '<p dir="rtl"><strong>_(Notes):</strong> _(preserved read-only); _(not for use in scripts); _(calculated); _(info from audio file).</p>'
323
+ )
324
+ self .assertEqual (tagvars .display_tooltip ('_notes1' ), result )
325
+
298
326
def test_tagvars_full_description (self ):
299
327
tagvars = TagVars (
300
328
self .tagvar_everything ,
You can’t perform that action at this time.
0 commit comments