]> git.immae.eu Git - perso/Immae/Projets/Python/MusicSampler.git/blobdiff - music_sampler/actions/wait.py
Make music_sampler multilingual
[perso/Immae/Projets/Python/MusicSampler.git] / music_sampler / actions / wait.py
index ea424081f8c2d984e86b9e2b8b2171dd82ee5cc9..e6d07f24de9d2b042f149b73ae6966c31de404a7 100644 (file)
@@ -16,21 +16,24 @@ def run(action, duration=0, music=None, set_wait_id=None, **kwargs):
     action.sleep_event.wait()
 
 def description(action, duration=0, music=None, set_wait_id=None, **kwargs):
+    formats = []
     message = ""
     if music is None:
-        message += "waiting {}s" \
-                .format(duration)
+        message += "waiting {}s"
+        formats.append(duration)
     elif duration == 0:
-        message += "waiting the end of « {} »" \
-                .format(music.name)
+        message += "waiting the end of « {} »"
+        formats.append(music.name)
     else:
-        message += "waiting the end of « {} » + {}s" \
-                .format(music.name, duration)
+        message += "waiting the end of « {} » + {}s"
+        formats.append(music.name)
+        formats.append(duration)
 
     if set_wait_id is not None:
-        message += " (setting id = {})".format(set_wait_id)
+        message += " (setting id = {})"
+        formats.append(set_wait_id)
 
-    return message
+    return _(message).format(*formats)
 
 def interrupt(action, duration=0, music=None, **kwargs):
     if action.sleep_event is not None: