From 4a0e25b8e6fc393f8ae33b2bf9b07830362dcb79 Mon Sep 17 00:00:00 2001 From: Nat1anWasTaken Date: Thu, 13 Jun 2024 01:04:57 +0800 Subject: [PATCH] feat(lava/classes/player.py): update button styles and labels for control actions, including pause, resume, previous, next, stop, rewind, forward; add shuffle and repeat buttons with localized text feat(locale/zh_TW.json): add localized text for updated control action buttons in Chinese (Traditional) language --- lava/classes/player.py | 73 +++++++++++++++++++++++++----------------- locale/zh_TW.json | 13 +++++++- 2 files changed, 56 insertions(+), 30 deletions(-) diff --git a/lava/classes/player.py b/lava/classes/player.py index 090efd57..e8e25d4f 100644 --- a/lava/classes/player.py +++ b/lava/classes/player.py @@ -162,61 +162,76 @@ async def update_display(self, else: components = [ ActionRow( - Button( - style=ButtonStyle.green if self.shuffle else ButtonStyle.grey, - emoji=self.bot.get_icon('control.shuffle', "🔀"), - custom_id="control.shuffle" - ), - Button( - style=ButtonStyle.blurple, - emoji=self.bot.get_icon('control.previous', "⏮️"), - custom_id="control.previous" - ), Button( style=ButtonStyle.green, emoji=self.bot.get_icon('control.pause', "⏸️"), - custom_id="control.pause" + custom_id="control.pause", + label=self.bot.get_text("display.control.pause", self.locale, "暫停") ) if not self.paused else Button( style=ButtonStyle.red, emoji=self.bot.get_icon('control.resume', "▶️"), - custom_id="control.resume" + custom_id="control.resume", + label=self.bot.get_text("display.control.resume", self.locale, "繼續") ), Button( style=ButtonStyle.blurple, - emoji=self.bot.get_icon('control.next', "⏭️"), - custom_id="control.next" + emoji=self.bot.get_icon('control.previous', "⏮️"), + custom_id="control.previous", + label=self.bot.get_text("display.control.previous", self.locale, "重新開始") ), Button( - style=[ButtonStyle.grey, ButtonStyle.green, ButtonStyle.blurple][self.loop], - emoji=self.bot.get_icon('control.repeat', "🔁"), - custom_id="control.repeat" + style=ButtonStyle.blurple, + emoji=self.bot.get_icon('control.next', "⏭️"), + custom_id="control.next", + label=self.bot.get_text("display.control.next", self.locale, "跳過") ) ), ActionRow( Button( - style=ButtonStyle.green if self.autoplay else ButtonStyle.grey, - emoji=self.bot.get_icon('control.autoplay', "🔥"), - custom_id="control.autoplay" + style=ButtonStyle.red, + emoji=self.bot.get_icon('control.stop', "⏹️"), + custom_id="control.stop", + label=self.bot.get_text("display.control.stop", self.locale, "停止") ), Button( style=ButtonStyle.blurple, emoji=self.bot.get_icon('control.rewind', "⏪"), - custom_id="control.rewind" - ), - Button( - style=ButtonStyle.red, - emoji=self.bot.get_icon('control.stop', "⏹️"), - custom_id="control.stop" + custom_id="control.rewind", + label=self.bot.get_text("display.control.rewind", self.locale, "倒帶十秒") ), Button( style=ButtonStyle.blurple, emoji=self.bot.get_icon('control.forward', "⏩"), - custom_id="control.forward" + custom_id="control.forward", + label=self.bot.get_text("display.control.forward", self.locale, "快進十秒") + ) + ), + ActionRow( + Button( + style=ButtonStyle.green if self.shuffle else ButtonStyle.grey, + emoji=self.bot.get_icon('control.shuffle', "🔀"), + custom_id="control.shuffle", + label=self.bot.get_text("display.control.shuffle", self.locale, "隨機播放") + ), + Button( + style=[ButtonStyle.grey, ButtonStyle.green, ButtonStyle.blurple][self.loop], + emoji=self.bot.get_icon('control.repeat', "🔁"), + custom_id="control.repeat", + label=self.bot.get_text("display.control.repeat", self.locale, "重複播放") + ) + ), + ActionRow( + Button( + style=ButtonStyle.green if self.autoplay else ButtonStyle.grey, + emoji=self.bot.get_icon('control.autoplay', "🎶"), + custom_id="control.autoplay", + label=self.bot.get_text("display.control.autoplay", self.locale, "自動播放") ), Button( style=ButtonStyle.green if self.show_lyrics else ButtonStyle.grey, - emoji=self.bot.get_icon('lyrics', "💬"), - custom_id="control.lyrics" + emoji=self.bot.get_icon('control.lyrics', "🎤"), + custom_id="control.lyrics", + label=self.bot.get_text("display.control.lyrics", self.locale, "歌詞顯示") ) ) ] diff --git a/locale/zh_TW.json b/locale/zh_TW.json index ea987722..50be58dc 100644 --- a/locale/zh_TW.json +++ b/locale/zh_TW.json @@ -124,5 +124,16 @@ "display.disable": "關閉", "display.footer": "如果你覺得音樂怪怪的,可以試著檢查看看效果器設定或是切換語音頻道地區", "display.lyrics.title": "🎤 | 歌詞", - "display.lyrics.not_found": "*你得自己唱出這首歌的歌詞*" + "display.lyrics.not_found": "*你得自己唱出這首歌的歌詞*", + "display.control.pause": "暫停", + "display.control.resume": "繼續", + "display.control.previous": "重新開始", + "display.control.next": "跳過", + "display.control.stop": "停止", + "display.control.rewind": "倒帶十秒", + "display.control.forward": "快進十秒", + "display.control.shuffle": "隨機播放", + "display.control.repeat": "重複播放", + "display.control.autoplay": "自動播放", + "display.control.lyrics": "歌詞顯示" } \ No newline at end of file