Archived
1
0
Fork 0

i18n & fix strings

This commit is contained in:
多羅狼 2023-04-08 15:05:26 +08:00 committed by GitHub
parent deaeeae08d
commit a0e263f33f
9 changed files with 18 additions and 20 deletions

View file

@ -240,7 +240,7 @@ async def parser(msg: MessageSession, require_enable_modules: bool = True, prefi
raise FinishedException(msg.sent) # if not using msg.finish
except InvalidCommandFormatError:
await msg.sendMessage(msg.locale.t("parser.command.format.invalid",
module=command_first_word))
module=command_first_word, prefix=msg.prefixes[0]))
"""if msg.options.get('typo_check', True): # 判断是否开启错字检查
nmsg, command_first_word, command_split = await typo_check(msg,
display_prefix,

View file

@ -19,7 +19,7 @@
"tos.warning.last": "This is your last warning.",
"parser.command.running.prompt": "There are currently commands running. Please try again later.",
"parser.command.running.prompt2": "The previous command is being executed.",
"parser.command.format.invalid": "Syntax Error.\nUse \"~help ${module}\" for help.",
"parser.command.format.invalid": "Syntax Error.\nUse \"${prefix}help ${module}\" for help.",
"parser.sudo.permission.denied": "You are not a superuser and cannot use the sudo command.",
"parser.superuser.permission.denied": "You do not have permission to use this command.",
"parser.admin.module.permission.denied": "Commands under the \"${module}\" module can only be used by the admins of the group. Please contact the admins to execute the command.",

View file

@ -19,7 +19,7 @@
"tos.warning.last": "这是对你的最后一次警告。",
"parser.command.running.prompt": "当前有命令正在执行,请稍后再试。",
"parser.command.running.prompt2": "先前的命令正在执行中。",
"parser.command.format.invalid": "语法错误。\n使用 ~help ${module} 查看帮助。",
"parser.command.format.invalid": "语法错误。\n使用 ${prefix}help ${module} 查看帮助。",
"parser.sudo.permission.denied": "你不是本机器人的超级用户,无法使用 sudo 命令。",
"parser.superuser.permission.denied": "你没有使用该命令的权限。",
"parser.admin.module.permission.denied": "${module} 模块下的命令仅能被该群组的管理员所使用,请联系管理员执行此命令。",

View file

@ -19,7 +19,7 @@
"tos.warning.last": "這是最後警告。",
"parser.command.running.prompt": "目前有指令正在執行,請稍後再試。",
"parser.command.running.prompt2": "先前的指令正在執行中。",
"parser.command.format.invalid": "語法錯誤。\n使用 ~help ${module} 檢視說明。",
"parser.command.format.invalid": "語法錯誤。\n使用 ${prefix}help ${module} 檢視說明。",
"parser.sudo.permission.denied": "你不是本機器人的超級使用者,無法使用 sudo 指令。",
"parser.superuser.permission.denied": "你沒有使用此指令的權限。",
"parser.admin.module.permission.denied": "${module} 模組下的指令僅能由該群組的管理員所使用,請聯絡管理員執行此指令。",

View file

@ -30,7 +30,7 @@ class WithErrCode(Exception):
'b30 unofficial [<friendcode>] {{arcaea.message.unofficial}}')
async def _(msg: Bot.MessageSession):
if not os.path.exists(assets_path):
await msg.finish(msg.locale.t("arcaea.message.assets.not_found"))
await msg.finish(msg.locale.t("arcaea.message.assets.not_found", prefix=msg.prefixes[0]))
query_code = None
prefer_uses = msg.options.get('arc_api', None)
official = msg.parsed_msg.get('official', False)
@ -97,7 +97,7 @@ async def _(msg: Bot.MessageSession):
traceback.print_exc()
await msg.finish(msg.locale.t("arcaea.message.unofficial.fetch.failed"))
else:
await msg.finish(msg.locale.t("arcaea.message.user.unbound"))
await msg.finish(msg.locale.t("arcaea.message.user.unbound", prefix=msg.prefixes[0]))
@arc.command('info [<friendcode>] {{arcaea.info.help}}',
@ -105,7 +105,7 @@ async def _(msg: Bot.MessageSession):
'info unofficial [<friendcode>] {{arcaea.message.unofficial}}', )
async def _(msg: Bot.MessageSession):
if not os.path.exists(assets_path):
await msg.sendMessage(msg.locale.t("arcaea.message.assets.not_found"))
await msg.sendMessage(msg.locale.t("arcaea.message.assets.not_found", prefix=msg.prefixes[0]))
return
query_code = None
prefer_uses = msg.options.get('arc_api', None)
@ -152,7 +152,7 @@ async def _(msg: Bot.MessageSession):
traceback.print_exc()
await msg.finish(msg.locale.t("arcaea.message.unofficial.fetch.failed"))
else:
await msg.finish(msg.locale.t("arcaea.message.user.unbound"))
await msg.finish(msg.locale.t("arcaea.message.user.unbound", prefix=msg.prefixes[0]))
@arc.command('song <songname+prs/pst/byd> {{arcaea.song.help}}')

View file

@ -21,7 +21,7 @@
"arcaea.errcode.-20": "File does not exist",
"arcaea.errcode.-23": "Internal error occurred",
"arcaea.errcode.-233": "Unknown error occurred",
"arcaea.message.assets.not_found": "No resource files found! Please place the apk files of Arcaea to the robot's assets directory and rename them to \"arc.apk\", use \"~arcaea\" to initialize resources.",
"arcaea.message.assets.not_found": "No resource files found! Please place the apk files of Arcaea to the robot's assets directory and rename them to \"arc.apk\", use \"${prefix}arcaea\" to initialize resources.",
"arcaea.message.failed": "Failed to query.",
"arcaea.message.failed.errcode": "Failed to query: ",
"arcaea.message.failed.fetch": "Failed to fetch.",
@ -32,7 +32,7 @@
"arcaea.message.official.fetch.failed.fallback": "Failed to fetch using the official API. Trying to use unofficial API.",
"arcaea.message.unofficial": "Use Unofficial API",
"arcaea.message.unofficial.fetch.failed": "Failed to query using the unofficial API.",
"arcaea.message.user.unbound": "Unbound user. Please bind user by \"~arcaea bind <friendcode>\".",
"arcaea.message.user.unbound": "Unbound user. Please bind user by \"${prefix}arcaea bind <friendcode>\".",
"arcaea.message.no_webrender": "No webrender configured, this command cannot be used.",
"arcaea.b30.help": "Query the best 30 list of Arcaea user. (Automatically select to use API)",
"arcaea.b30.message.success": "Result\nBest 30${b30} | Recent 10${r10}\nBest 30 last 5 list: \n${last5list}",

View file

@ -21,7 +21,7 @@
"arcaea.errcode.-20": "文件不存在",
"arcaea.errcode.-23": "发生了内部错误",
"arcaea.errcode.-233": "发生了未知错误",
"arcaea.message.assets.not_found": "未找到资源文件!请放置一份 Arcaea 的 apk 文件到机器人的 assets 目录并重命名为 arc.apk 后,使用 ~arcaea initialize 初始化资源。",
"arcaea.message.assets.not_found": "未找到资源文件!请放置一份 Arcaea 的 apk 文件到机器人的 assets 目录并重命名为 arc.apk 后,使用 ${prefix}arcaea initialize 初始化资源。",
"arcaea.message.failed": "查询失败。",
"arcaea.message.failed.errcode": "查询失败:",
"arcaea.message.failed.fetch": "获取失败。",
@ -32,7 +32,7 @@
"arcaea.message.official.fetch.failed.fallback": "使用官方 API 获取失败,尝试使用非官方接口。",
"arcaea.message.unofficial": "使用非官方 API",
"arcaea.message.unofficial.fetch.failed": "使用非官方 API 查询失败!",
"arcaea.message.user.unbound": "未绑定用户,请使用 ~arcaea bind <friendcode> 绑定一个用户。",
"arcaea.message.user.unbound": "未绑定用户,请使用 ${prefix}arcaea bind <friendcode> 绑定一个用户。",
"arcaea.message.no_webrender": "未配置 webrender无法使用此命令。",
"arcaea.b30.help": "查询 Arcaea 用户的 b30 列表。(自动选择使用 API",
"arcaea.b30.message.success": "获取结果\nB30${b30} | R10${r10}\nB30 倒 5 列表:\n${last5list}",

View file

@ -21,7 +21,7 @@
"arcaea.errcode.-20": "檔案不存在",
"arcaea.errcode.-23": "發生了內部錯誤",
"arcaea.errcode.-233": "發生了不明錯誤",
"arcaea.message.assets.not_found": "找不到資源檔案! 請放置一份 Arcaea 的 apk 檔案到機器人的 assets 目錄並重命名為 arc.apk 後,使用 ~arcaea initialize 初始化資源。",
"arcaea.message.assets.not_found": "找不到資源檔案! 請放置一份 Arcaea 的 apk 檔案到機器人的 assets 目錄並重命名為 arc.apk 後,使用 ${prefix}arcaea initialize 初始化資源。",
"arcaea.message.failed": "查詢失敗。",
"arcaea.message.failed.errcode": "查詢失敗:",
"arcaea.message.failed.fetch": "取得失敗。",
@ -32,7 +32,7 @@
"arcaea.message.official.fetch.failed.fallback": "使用官方 API 取得失敗,嘗試使用非官方介面。",
"arcaea.message.unofficial": "使用非官方 API",
"arcaea.message.unofficial.fetch.failed": "使用非官方 API 查詢失敗!",
"arcaea.message.user.unbound": "未綁定使用者,請使用 ~arcaea bind <friendcode> 綁定一個使用者。",
"arcaea.message.user.unbound": "未綁定使用者,請使用 ${prefix}arcaea bind <friendcode> 綁定一個使用者。",
"arcaea.message.no_webrender": "未配置 webrender無法使用此指令。",
"arcaea.b30.help": "查詢 Arcaea 使用者的 b30 列表。(自動選擇使用 API",
"arcaea.b30.message.success": "取得結果\nB30${b30} | R10${r10}\nB30 倒 5 列表:\n${last5list}",

View file

@ -9,7 +9,7 @@ from modules.wiki.utils.wikilib import WikiLib
from .wiki import wiki, query_pages
@wiki.handle('search <PageName> {搜索一个Wiki页面。}')
@wiki.handle('search <PageName> {{wiki.search.help}}')
async def _(msg: Bot.MessageSession):
await search_pages(msg, msg.parsed_msg['<PageName>'])
@ -22,9 +22,7 @@ async def search_pages(session: Bot.MessageSession, title: Union[str, list, tupl
prefix = target.get_prefix()
enabled_fandom_addon = session.options.get('wiki_fandom_addon')
if start_wiki is None:
await session.sendMessage(
f'没有指定起始Wiki已默认指定为中文Minecraft Wiki发送{session.prefixes[0]}wiki set <域名>来设定自定义起始Wiki。'
f'\n例子:{session.prefixes[0]}wiki set https://minecraft.fandom.com/zh/wiki/')
await session.sendMessage(msg.locale.t('wiki.set.message.default', prefix=session.prefixes[0]))
start_wiki = 'https://minecraft.fandom.com/zh/api.php'
if isinstance(title, str):
title = [title]
@ -87,13 +85,13 @@ async def search_pages(session: Bot.MessageSession, title: Union[str, list, tupl
for r in result:
wait_msg_list.append(iw_prefix + r)
if len(wait_msg_list) != 0:
msg_list.append('查询到以下结果:')
msg_list.append(msg.locale.t('wiki.search.message'))
i = 0
for w in wait_msg_list:
i += 1
w = f'{i}. {w}'
msg_list.append(w)
msg_list.append('回复编号以查询对应的页面。')
msg_list.append(msg.locale.t('wiki.search.message.reply'))
reply = await session.waitReply(Plain('\n'.join(msg_list)))
if reply.asDisplay(text_only=True).isdigit():
reply_number = int(reply.asDisplay(text_only=True)) - 1