diff --git a/cogs/basic.py b/cogs/basic.py index ac876dd..fa885dd 100644 --- a/cogs/basic.py +++ b/cogs/basic.py @@ -670,7 +670,7 @@ class Basic(commands.Cog): await send(ctx, "removed", len(removed_tracks.keys())) @commands.hybrid_command(name="forward", aliases=get_aliases("forward")) - @app_commands.describe(position="Input a amount that you to forward to. Exmaple: 1:20") + @app_commands.describe(position="Input an amount that you to forward to. Exmaple: 1:20") @commands.dynamic_cooldown(cooldown_check, commands.BucketType.guild) async def forward(self, ctx: commands.Context, position: str = "10"): "Forwards by a certain amount of time in the current track. The default is 10 seconds." @@ -691,7 +691,7 @@ class Basic(commands.Cog): await send(ctx, "forward", ctime(player.position + num)) @commands.hybrid_command(name="rewind", aliases=get_aliases("rewind")) - @app_commands.describe(position="Input a amount that you to rewind to. Exmaple: 1:20") + @app_commands.describe(position="Input an amount that you to rewind to. Exmaple: 1:20") @commands.dynamic_cooldown(cooldown_check, commands.BucketType.guild) async def rewind(self, ctx: commands.Context, position: str = "10"): "Rewind by a certain amount of time in the current track. The default is 10 seconds." diff --git a/function.py b/function.py index bed42e0..f9a1d0b 100644 --- a/function.py +++ b/function.py @@ -34,6 +34,8 @@ LOCAL_LANGS: dict[str, dict[str, str]] = {} #Stores all the localization languag SETTINGS_BUFFER: dict[int, dict[str, Any]] = {} #Cache guild language USERS_BUFFER: dict[str, dict] = {} +MISSING_TRANSLATOR: dict[str, list[str]] = {} + USER_BASE: dict[str, Any] = { 'playlist': { '200': { diff --git a/local_langs/zh-TW.json b/local_langs/zh-TW.json index 443b026..d4ae83e 100644 --- a/local_langs/zh-TW.json +++ b/local_langs/zh-TW.json @@ -69,10 +69,10 @@ "Remove tracks requested by a specific member.": "刪除指定成員所要求的歌曲。", "forward": "前進", "Forwards by a certain amount of time in the current track. The default is 10 seconds.": "在目前歌曲中前進一定的時間。預設為 10 秒。", - "Input a amount that you to forward to. Exmaple: 1: 20": "輸入您要前進到的時間。範例:1:20", + "Input an amount that you to forward to. Exmaple: 1:20": "輸入您要前進到的時間。範例:1:20", "rewind": "倒退", "Rewind by a certain amount of time in the current track. The default is 10 seconds.": "在目前歌曲中倒退一定的時間。預設為 10 秒。", - "Input a amount that you to rewind to. Exmaple: 1: 20": "輸入您要倒退到的時間。範例:1:20", + "Input an amount that you to rewind to. Exmaple: 1:20": "輸入您要倒退到的時間。範例:1:20", "replay": "重新播放", "Reset the progress of the current song.": "重設目前歌曲的進度。", "shuffle": "隨機播放", @@ -210,5 +210,22 @@ "cleareffect": "清除效果", "Clear all or specific sound effects.": "清除所有或指定的音效。", "effect": "效果", - "Remove a specific sound effects.": "刪除指定的音效。" + "Remove a specific sound effects.": "刪除指定的音效。", + "start": "開始", + "end": "結束", + "Specify a time you would like to start, e.g. 1:00": "指定您希望開始的時間,例如:1:00。", + "Specify a time you would like to end, e.g. 4:00": "指定您希望結束的時間,例如:4:00。", + "list": "列表", + "Customize the channel topic template": "自訂頻道主題模板", + "template": "模板", + "setupchannel": "設置頻道", + "Sets up a dedicated channel for song requests in your server.": "為您的伺服器設置一個專用的歌曲請求頻道。", + "Provide a request channel. If not, a text channel will be generated.": "提供請求頻道。如果沒有,將生成一個文本頻道。", + "ping": "ping", + "…": "...", + "8d": "8d", + "dj": "dj", + "247": "247", + "stageannounce": "舞台公告", + "Soundcloud": "Soundcloud" } \ No newline at end of file diff --git a/main.py b/main.py index 9c4e55b..59b52c3 100644 --- a/main.py +++ b/main.py @@ -4,7 +4,6 @@ import os import aiohttp import update import logging -import voicelink import function as func from discord.ext import commands @@ -22,8 +21,18 @@ class Translator(discord.app_commands.Translator): func.logger.info("Unload Translator") async def translate(self, string: discord.app_commands.locale_str, locale: discord.Locale, context: discord.app_commands.TranslationContext): - if str(locale) in func.LOCAL_LANGS: - return func.LOCAL_LANGS[str(locale)].get(string.message, None) + locale_key = str(locale) + + if locale_key in func.LOCAL_LANGS: + translated_text = func.LOCAL_LANGS[locale_key].get(string.message) + + if translated_text is None: + missing_translations = func.MISSING_TRANSLATOR.setdefault(locale_key, []) + if string.message not in missing_translations: + missing_translations.append(string.message) + + return translated_text + return None class Vocard(commands.Bot): @@ -102,6 +111,9 @@ class Vocard(commands.Bot): await self.tree.set_translator(Translator()) await self.tree.sync() + for locale_key, values in func.MISSING_TRANSLATOR.items(): + func.logger.warning(f"Missing translation for '{", ".join(values)}' in '{locale_key}'") + async def on_ready(self): func.logger.info("------------------") func.logger.info(f"Logging As {self.user}") @@ -113,6 +125,7 @@ class Vocard(commands.Bot): func.settings.client_id = self.user.id func.LOCAL_LANGS.clear() + func.MISSING_TRANSLATOR.clear() async def on_command_error(self, ctx: commands.Context, exception, /) -> None: error = getattr(exception, 'original', exception)