From 5b083aefa9d20fef66b594595f2e4f3c60694730 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=9A=E7=BE=85=E7=8B=BC?= Date: Wed, 13 Mar 2024 22:55:29 +0800 Subject: [PATCH] update locale --- locales/en_us.json | 2 ++ locales/zh_cn.json | 2 ++ locales/zh_tw.json | 2 ++ modules/core/locales/en_us.json | 14 ++++++-------- modules/core/locales/zh_cn.json | 20 +++++++++----------- modules/core/locales/zh_tw.json | 14 ++++++-------- modules/core/modules.py | 2 +- modules/core/su_utils.py | 22 +++++++++++----------- modules/core/utils.py | 4 ++-- 9 files changed, 41 insertions(+), 41 deletions(-) diff --git a/locales/en_us.json b/locales/en_us.json index 5c41a727e9..c77a10a7a5 100644 --- a/locales/en_us.json +++ b/locales/en_us.json @@ -52,6 +52,8 @@ "parser.command.running.prompt": "There are currently commands executing. Please try again later.", "parser.command.running.prompt2": "The previous command is being executed.", "parser.module.desc": "Description:\n${desc}", + "message.id.invalid.sender": "Invalid ID format. The format should be \"${sender}|\".", + "message.id.invalid.target": "Invalid ID format. The format should be \"${target}|\".", "parser.module.disabled.prompt": "\"${module}\" module is not enabled. Please use \"${prefix}enable ${module}\" to enable the module.", "parser.module.unloaded": "\"${module}\"hasn't been loaded yet. Please contact the developers to solve this issue.", "parser.superuser.permission.denied": "You do not have permission to use this command.", diff --git a/locales/zh_cn.json b/locales/zh_cn.json index 81e2d0967d..3c78fdac0d 100644 --- a/locales/zh_cn.json +++ b/locales/zh_cn.json @@ -44,6 +44,8 @@ "message.reply.prompt": "(请使用指定的词语回复本条消息)", "message.wait.prompt.confirm": "(发送“是”或符合确认条件的词语来确认)", "message.wait.prompt.next_message": "(发送符合条件的词语来确认)", + "message.id.invalid.sender": "ID 格式错误,格式应为“${sender}|<用户 ID>”。", + "message.id.invalid.target": "ID 格式错误,格式应为“${target}|<对话 ID>”。", "no": "否", "none": "无", "parser.admin.module.permission.denied": "“${module}”模块下的命令仅能被该群组的管理员所使用,请联系管理员执行此命令。", diff --git a/locales/zh_tw.json b/locales/zh_tw.json index 06631b4bae..c8878a6bfd 100644 --- a/locales/zh_tw.json +++ b/locales/zh_tw.json @@ -51,6 +51,8 @@ "parser.command.format.invalid": "語法錯誤。\n使用「${prefix}help ${module}」檢視說明。", "parser.command.running.prompt": "目前有指令正在執行,請稍後再試。", "parser.command.running.prompt2": "先前的指令正在執行中。", + "message.id.invalid.sender": "ID 格式錯誤,格式應為「${sender}|<使用者 ID>」。", + "message.id.invalid.target": "ID 格式錯誤,格式應為「${target}|<對話 ID>」。", "parser.module.desc": "描述:\n${desc}", "parser.module.disabled.prompt": "「${module}」模組未啟用,請使用「${prefix}enable ${module}」啟用此模組。", "parser.module.unloaded": "「${module}」模組目前未載入,請聯絡開發人員處理。", diff --git a/modules/core/locales/en_us.json b/modules/core/locales/en_us.json index 39331b900d..be1910341f 100644 --- a/modules/core/locales/en_us.json +++ b/modules/core/locales/en_us.json @@ -50,7 +50,7 @@ "core.message.admin.ban.list.none": "There are currently no members limited to use the bot.", "core.message.admin.ban.not_yet": "This member has not been limited to use the bot.", "core.message.admin.ban.self": "You cannot do this for yourself!", - "core.message.admin.invalid": "Invalid ID format. The format should be \"${target}|\". Use \"${prefix}whoami\" to view user ID.", + "core.message.admin.invalid": "Invalid ID format. The format should be \"${sender}|\". Use \"${prefix}whoami\" to view user ID.", "core.message.admin.list": "Manual bot administrators currently set: ", "core.message.admin.list.none": "There are currently no manual bot administrators.", "core.message.admin.remove.confirm": "You are removing your own permissions! Are you sure?", @@ -127,7 +127,7 @@ "core.message.module.reload.no_more": "No remaining files were found.", "core.message.module.reload.not_found": "Failed: Module \"${module}\" does not exist.", "core.message.module.reload.success": "Successfully reloaded module(s):\n${module}", - "core.message.module.reload.with": "And ${reloadCnt} file(s) under these module(s).", + "core.message.module.reload.with": "And ${reload_count} file(s) under these module(s).", "core.message.module.unload.base": "Failed: \"${module}\" is a base module, thus cannot be unloaded.", "core.message.module.unload.confirm": "This operation will unload all modules related to it and disable them completely after the next restart (not including cross-reference). Continue?", "core.message.module.unload.not_found": "Failed: This module does not exist.", @@ -163,18 +163,16 @@ "core.message.resume.nothing": "No messages to be resumed.", "core.message.resume.processing": "Resuming ${counts} message(s)...", "core.message.resume.skip": "Skip a message, resuming ${counts} message(s)...", - "core.message.set.confirm.init": "This target is not initialized. Are you sure you want to do it?", - "core.message.set.invalid": "Invalid ID format.", - "core.message.set.module.disable.success": "The following module(s) were successfully disabled for the target: ", - "core.message.set.module.enable.success": "The following module(s) were successfully enabled for the target: ", - "core.message.set.option.edit.success": "The following parameter(s) were set for the target: ${key} -> ${value}", + "core.message.set.confirm.init": "This conversation is not initialized. Are you sure you want to do it?", + "core.message.set.module.disable.success": "The following module(s) were successfully disabled for the conversation: ", + "core.message.set.module.enable.success": "The following module(s) were successfully enabled for the conversation: ", + "core.message.set.option.edit.success": "The following parameter(s) were set for the conversation: ${key} -> ${value}", "core.message.setup.check.disable": "Check prompt disabled.", "core.message.setup.check.enable": "Check prompt enabled.", "core.message.setup.timeoffset.invalid": "Invalid time offset.", "core.message.setup.timeoffset.success": "The time offset has been set to UTC${offset}.", "core.message.setup.typing.disable": "Input prompt disabled.", "core.message.setup.typing.enable": "Input prompt enabled.", - "core.message.superuser.invalid": "Invalid ID format. The format should be \"${target}|\".", "core.message.update.failed": "Failed to fetch update from GitHub.", "core.message.version": "Current bot version: ${commit}", "core.message.version.unknown": "Unable to get version. This instance may not be deployed using Git.", diff --git a/modules/core/locales/zh_cn.json b/modules/core/locales/zh_cn.json index 4f1e4d63ca..0c0e85e187 100644 --- a/modules/core/locales/zh_cn.json +++ b/modules/core/locales/zh_cn.json @@ -50,7 +50,7 @@ "core.message.admin.ban.list.none": "当前没有被限制使用机器人的成员。", "core.message.admin.ban.not_yet": "此成员没有被限制使用机器人。", "core.message.admin.ban.self": "你不可以对自己进行此操作!", - "core.message.admin.invalid": "ID 格式错误,格式应为“${target}|<用户 ID>”,请使用“${prefix}whoami”查看用户 ID。", + "core.message.admin.invalid": "ID 格式错误,格式应为“${sender}|<用户 ID>”,请使用“${prefix}whoami”查看用户 ID。", "core.message.admin.list": "当前被手动设置的机器人管理员:\n", "core.message.admin.list.none": "当前没有手动设置的机器人管理员。", "core.message.admin.remove.confirm": "你正在移除你自己的权限!你确定吗?", @@ -127,15 +127,15 @@ "core.message.module.reload.no_more": "未发现已加载的其余文件。", "core.message.module.reload.not_found": "失败:“${module}”模块不存在。", "core.message.module.reload.success": "成功重载模块:\n${module}", - "core.message.module.reload.with": "以及该模块下的 ${reloadCnt} 个文件。", + "core.message.module.reload.with": "以及该模块下的 ${reload_count} 个文件。", "core.message.module.unload.base": "失败:“${module}”模块为基础模块,无法卸载。", "core.message.module.unload.confirm": "此操作将会卸载与其相关的所有模块,并在下一次重启后彻底禁用(不包含互相引用的模块),是否继续?", "core.message.module.unload.not_found": "失败:该模块不存在。", "core.message.module.unload.success": "成功卸载模块:${module}", "core.message.module.unload.unavailable.confirm": "此模块已由于发生错误而无法加载,此操作将会在下一次重启后彻底禁用此模块,是否继续?", "core.message.module.unsupported_language": "提示:“${module}”模块不支持当前语言,此模块可能不会正确展示当前语言下的内容。", - "core.message.mute.disable": "成功取消禁言。", - "core.message.mute.enable": "成功禁言。", + "core.message.mute.disable": "成功取消静音。", + "core.message.mute.enable": "成功静音。", "core.message.petal": "当前对话 ${target} 的花瓣数为 ${petal}。", "core.message.petal.clear": "已清除对话 ${target} 的所有花瓣。", "core.message.petal.clear.self": "已清除本对话的所有花瓣。", @@ -163,18 +163,16 @@ "core.message.resume.nothing": "没有需要重发的消息。", "core.message.resume.processing": "正在重发 ${counts} 条消息……", "core.message.resume.skip": "跳过一条消息,正在重发 ${counts} 条消息……", - "core.message.set.confirm.init": "该目标未初始化,确认进行操作吗?", - "core.message.set.invalid": "ID 格式错误。", - "core.message.set.module.disable.success": "成功为目标关闭了以下模块:", - "core.message.set.module.enable.success": "成功为目标打开了以下模块:", - "core.message.set.option.edit.success": "成功为目标设置了以下参数:${key} -> ${value}", + "core.message.set.confirm.init": "该对话未初始化,确认进行操作吗?", + "core.message.set.module.disable.success": "成功为对话关闭了以下模块:", + "core.message.set.module.enable.success": "成功为对话打开了以下模块:", + "core.message.set.option.edit.success": "成功为对话设置了以下参数:${key} -> ${value}", "core.message.setup.check.disable": "已关闭错字检查提示。", "core.message.setup.check.enable": "已开启错字检查提示。", "core.message.setup.timeoffset.invalid": "无效的时间偏移量。", "core.message.setup.timeoffset.success": "已将时间偏移量设定为 UTC${offset}。", "core.message.setup.typing.disable": "已关闭输入提示。", "core.message.setup.typing.enable": "已开启输入提示。", - "core.message.superuser.invalid": "ID 格式错误,格式应为“${target}|<用户 ID>”。", "core.message.update.failed": "尝试从 GitHub 获取更新失败。", "core.message.version": "当前机器人版本号:${commit}", "core.message.version.unknown": "无法获取版本号。此实例可能没有使用 Git 进行部署。", @@ -182,4 +180,4 @@ "core.message.whoami.admin": "(你拥有本对话的管理员权限)", "core.message.whoami.botadmin": "(你拥有本对话的机器人管理员权限)", "core.message.whoami.superuser": "(你拥有本机器人的超级用户权限)" -} +} \ No newline at end of file diff --git a/modules/core/locales/zh_tw.json b/modules/core/locales/zh_tw.json index 084f312c98..159a777058 100644 --- a/modules/core/locales/zh_tw.json +++ b/modules/core/locales/zh_tw.json @@ -50,7 +50,7 @@ "core.message.admin.ban.list.none": "目前沒有被限制使用機器人的成員。", "core.message.admin.ban.not_yet": "此成員沒有被限制使用機器人。", "core.message.admin.ban.self": "你不可以對自己進行此操作!", - "core.message.admin.invalid": "ID 格式錯誤,格式應為「${target}|<使用者 ID>」,請使用「${prefix}whoami」指令檢視使用者 ID。", + "core.message.admin.invalid": "ID 格式錯誤,格式應為「${sender}|<使用者 ID>」,請使用「${prefix}whoami」指令檢視使用者 ID。", "core.message.admin.list": "目前被手動設定的機器人管理員:\n", "core.message.admin.list.none": "目前沒有手動設定的機器人管理員。", "core.message.admin.remove.confirm": "你正在移除你自己的權限!你確定嗎?", @@ -127,7 +127,7 @@ "core.message.module.reload.no_more": "未發現已載入的其餘檔案。", "core.message.module.reload.not_found": "失敗:「${module}」模組不存在。", "core.message.module.reload.success": "成功重新載入模組:\n${module}", - "core.message.module.reload.with": "以及此模組下的 ${reloadCnt} 個檔案。", + "core.message.module.reload.with": "以及此模組下的 ${reload_count} 個檔案。", "core.message.module.unload.base": "失敗:「${module}」為基礎模組,無法移除。", "core.message.module.unload.confirm": "此動作將會移除與其相關的所有模組,並在下一次重新啟動後完全停用(不包含互相參照的模組),是否繼續?", "core.message.module.unload.not_found": "失敗:此模組不存在。", @@ -163,18 +163,16 @@ "core.message.resume.nothing": "沒有需要重傳的訊息。", "core.message.resume.processing": "正在重傳 ${counts} 條訊息……", "core.message.resume.skip": "跳過一條訊息,正在重傳 ${counts} 條訊息……", - "core.message.set.confirm.init": "此目標未初始化,確認操作嗎?", - "core.message.set.invalid": "ID 格式錯誤。", - "core.message.set.module.disable.success": "成功為目標禁用了以下模組:", - "core.message.set.module.enable.success": "成功為目標啟用了以下模組:", - "core.message.set.option.edit.success": "成功為目標設定了以下參數:${key} -> ${value}", + "core.message.set.confirm.init": "此對話未初始化,確認操作嗎?", + "core.message.set.module.disable.success": "成功為對話禁用了以下模組:", + "core.message.set.module.enable.success": "成功為對話啟用了以下模組:", + "core.message.set.option.edit.success": "成功為對話設定了以下參數:${key} -> ${value}", "core.message.setup.check.disable": "已停用指令錯誤檢查提醒。", "core.message.setup.check.enable": "已啟用指令錯誤檢查提醒。", "core.message.setup.timeoffset.invalid": "無效的時間偏移量。", "core.message.setup.timeoffset.success": "已將時間偏移量設定為 UTC${offset}。", "core.message.setup.typing.disable": "已停用輸入提醒。", "core.message.setup.typing.enable": "已啟用輸入提醒。", - "core.message.superuser.invalid": "ID 格式錯誤,格式應為「${target}|<使用者 ID>」。", "core.message.update.failed": "嘗試從 GitHub 取得更新失敗。", "core.message.version": "目前機器人版本號:${commit}", "core.message.version.unknown": "無法取得版本號。此實例可能沒有使用 Git 進行部署。", diff --git a/modules/core/modules.py b/modules/core/modules.py index b493a91d4e..cc501f81ba 100644 --- a/modules/core/modules.py +++ b/modules/core/modules.py @@ -178,7 +178,7 @@ def module_reload(module, extra_modules, base_module=False): return msg.locale.t('core.message.module.reload.success', module=module) + \ ('\n' if len(extra_modules) != 0 else '') + \ '\n'.join(extra_modules) + \ - '\n' + msg.locale.t('core.message.module.reload.with', reloadCnt=reload_count - 1) + '\n' + msg.locale.t('core.message.module.reload.with', reload_count=reload_count - 1) elif reload_count == 1: return msg.locale.t('core.message.module.reload.success', module=module) + \ ('\n' if len(extra_modules) != 0 else '') + \ diff --git a/modules/core/su_utils.py b/modules/core/su_utils.py index 7674e04798..8fb2250b1f 100644 --- a/modules/core/su_utils.py +++ b/modules/core/su_utils.py @@ -28,7 +28,7 @@ @su.command('add ') async def add_su(msg: Bot.MessageSession, user: str): if not user.startswith(f'{msg.target.sender_from}|'): - await msg.finish(msg.locale.t("core.message.superuser.invalid", target=msg.target.sender_from)) + await msg.finish(msg.locale.t("message.id.invalid.sender", sender=msg.target.sender_from)) if user: if BotDBUtil.SenderInfo(user).edit('isSuperUser', True): await msg.finish(msg.locale.t("success")) @@ -37,7 +37,7 @@ async def add_su(msg: Bot.MessageSession, user: str): @su.command('remove ') async def del_su(msg: Bot.MessageSession, user: str): if not user.startswith(f'{msg.target.sender_from}|'): - await msg.finish(msg.locale.t("core.message.superuser.invalid", target=msg.target.sender_from)) + await msg.finish(msg.locale.t("message.id.invalid.sender", sender=msg.target.sender_from)) if user == msg.target.sender_id: confirm = await msg.wait_confirm(msg.locale.t("core.message.admin.remove.confirm"), append_instruction=False) if not confirm: @@ -72,7 +72,7 @@ async def _(msg: Bot.MessageSession): 'module disable ...') async def _(msg: Bot.MessageSession, target: str): if not target.startswith(f'{msg.target.target_from}|'): - await msg.finish(msg.locale.t("core.message.set.invalid")) + await msg.finish(msg.locale.t("message.id.invalid.target", target=msg.target.target_from)) target_data = BotDBUtil.TargetInfo(target) if not target_data.query: confirm = await msg.wait_confirm(msg.locale.t("core.message.set.confirm.init"), append_instruction=False) @@ -93,7 +93,7 @@ async def _(msg: Bot.MessageSession, target: str): 'option remove ') async def _(msg: Bot.MessageSession, target: str): if not target.startswith(f'{msg.target.target_from}|'): - await msg.finish(msg.locale.t("core.message.set.invalid")) + await msg.finish(msg.locale.t("message.id.invalid.target", target=msg.target.target_from)) target_data = BotDBUtil.TargetInfo(target) if not target_data.query: confirm = await msg.wait_confirm(msg.locale.t("core.message.set.confirm.init"), append_instruction=False) @@ -138,7 +138,7 @@ async def _(msg: Bot.MessageSession, group_id: str): async def _(msg: Bot.MessageSession, user: str): stat = '' if not user.startswith(f'{msg.target.sender_from}|'): - await msg.finish(msg.locale.t("core.message.set.invalid")) + await msg.finish(msg.locale.t("message.id.invalid.sender", sender=msg.target.sender_from)) warns = BotDBUtil.SenderInfo(user).query.warns temp_banned_time = await check_temp_ban(user) is_banned = BotDBUtil.SenderInfo(user).query.isInBlockList @@ -152,7 +152,7 @@ async def _(msg: Bot.MessageSession, user: str): @ae.command('warn []') async def _(msg: Bot.MessageSession, user: str, count: int = 1): if not user.startswith(f'{msg.target.sender_from}|'): - await msg.finish(msg.locale.t("core.message.set.invalid")) + await msg.finish(msg.locale.t("message.id.invalid.sender", sender=msg.target.sender_from)) warn_count = await warn_user(user, count) await msg.finish(msg.locale.t("core.message.abuse.warn.success", user=user, count=count, warn_count=warn_count)) @@ -160,7 +160,7 @@ async def _(msg: Bot.MessageSession, user: str, count: int = 1): @ae.command('revoke []') async def _(msg: Bot.MessageSession, user: str, count: int = 1): if not user.startswith(f'{msg.target.sender_from}|'): - await msg.finish(msg.locale.t("core.message.set.invalid")) + await msg.finish(msg.locale.t("message.id.invalid.sender", sender=msg.target.sender_from)) warn_count = await warn_user(user, -count) await msg.finish(msg.locale.t("core.message.abuse.revoke.success", user=user, count=count, warn_count=warn_count)) @@ -168,7 +168,7 @@ async def _(msg: Bot.MessageSession, user: str, count: int = 1): @ae.command('clear ') async def _(msg: Bot.MessageSession, user: str): if not user.startswith(f'{msg.target.sender_from}|'): - await msg.finish(msg.locale.t("core.message.set.invalid")) + await msg.finish(msg.locale.t("message.id.invalid.sender", sender=msg.target.sender_from)) await pardon_user(user) await msg.finish(msg.locale.t("core.message.abuse.clear.success", user=user)) @@ -176,7 +176,7 @@ async def _(msg: Bot.MessageSession, user: str): @ae.command('untempban ') async def _(msg: Bot.MessageSession, user: str): if not user.startswith(f'{msg.target.sender_from}|'): - await msg.finish(msg.locale.t("core.message.set.invalid")) + await msg.finish(msg.locale.t("message.id.invalid.sender", sender=msg.target.sender_from)) await remove_temp_ban(user) await msg.finish(msg.locale.t("core.message.abuse.untempban.success", user=user)) @@ -184,7 +184,7 @@ async def _(msg: Bot.MessageSession, user: str): @ae.command('ban ') async def _(msg: Bot.MessageSession, user: str): if not user.startswith(f'{msg.target.sender_from}|'): - await msg.finish(msg.locale.t("core.message.set.invalid")) + await msg.finish(msg.locale.t("message.id.invalid.sender", sender=msg.target.sender_from)) if BotDBUtil.SenderInfo(user).edit('isInBlockList', True): await msg.finish(msg.locale.t("core.message.abuse.ban.success", user=user)) @@ -192,7 +192,7 @@ async def _(msg: Bot.MessageSession, user: str): @ae.command('unban ') async def _(msg: Bot.MessageSession, user: str): if not user.startswith(f'{msg.target.sender_from}|'): - await msg.finish(msg.locale.t("core.message.set.invalid")) + await msg.finish(msg.locale.t("message.id.invalid.sender", sender=msg.target.sender_from)) if BotDBUtil.SenderInfo(user).edit('isInBlockList', False): await msg.finish(msg.locale.t("core.message.abuse.unban.success", user=user)) diff --git a/modules/core/utils.py b/modules/core/utils.py index 6ab03461cd..255bd985b6 100644 --- a/modules/core/utils.py +++ b/modules/core/utils.py @@ -81,7 +81,7 @@ async def config_gu(msg: Bot.MessageSession): await msg.finish(msg.locale.t("core.message.admin.list.none")) user = msg.parsed_msg[''] if not user.startswith(f'{msg.target.sender_from}|'): - await msg.finish(msg.locale.t('core.message.admin.invalid', target=msg.target.sender_from, prefix=msg.prefixes[0])) + await msg.finish(msg.locale.t('core.message.admin.invalid', sender=msg.target.sender_from, prefix=msg.prefixes[0])) if 'add' in msg.parsed_msg: if user and user not in msg.custom_admins: if msg.data.add_custom_admin(user): @@ -110,7 +110,7 @@ async def config_ban(msg: Bot.MessageSession): await msg.finish(msg.locale.t("core.message.admin.ban.list.none")) user = msg.parsed_msg[''] if not user.startswith(f'{msg.target.sender_from}|'): - await msg.finish(msg.locale.t('core.message.admin.invalid', prefix=msg.prefixes[0])) + await msg.finish(msg.locale.t('core.message.admin.invalid', sender=msg.target.sender_from, prefix=msg.prefixes[0])) if user == msg.target.sender_id: await msg.finish(msg.locale.t("core.message.admin.ban.self")) if 'ban' in msg.parsed_msg: