migrate user-facing text to i18n (#581)

This commit is contained in:
呵呵です
2026-01-27 05:20:41 +08:00
committed by GitHub
parent 95aa00e2cd
commit 28a02aec0f
20 changed files with 302 additions and 54 deletions

View File

@@ -12,6 +12,58 @@
"scope": "error",
"types": [{ "subtype": "MessageFormatError", "types": ["TETR.IO", "TOS", "TOP"] }]
},
{ "scope": "template", "types": ["template_language"] }
{ "scope": "template", "types": ["template_language"] },
{
"scope": "bind",
"types": [
"not_found",
"no_account",
"confirm_unbind",
"config_success",
"verify_already",
"verify_failed",
"only_discord"
]
},
{
"scope": "record",
"types": ["not_found", "blitz", "sprint"]
},
{
"scope": "stats",
"types": [
"user_info",
"no_rank",
"rank_info",
"no_game",
"recent_games",
"daily_stats",
"no_daily",
"history_stats",
"no_history",
"lpm",
"apm",
"adpm",
"sprint_pb",
"marathon_pb",
"challenge_pb"
]
},
{
"scope": "template_ui",
"types": ["invalid_tag", "update_success", "update_failed"]
},
{
"scope": "help",
"types": ["usage"]
},
{
"scope": "prompt",
"types": ["io_check", "io_bind", "top_check", "top_bind", "tos_check", "tos_bind"]
},
{
"scope": "retry",
"types": ["message"]
}
]
}

View File

@@ -15,5 +15,55 @@
},
"template": {
"template_language": "en-US"
},
"bind": {
"not_found": "No binding information found",
"no_account": "You haven't bound a {game} account yet",
"confirm_unbind": "Are you sure you want to unbind?",
"config_success": "Configuration successful",
"verify_already": "You have already completed verification.",
"verify_failed": "Verification failed. Please confirm the target {game} account is linked to your current Discord account.",
"only_discord": "Currently only Discord account verification is supported"
},
"record": {
"not_found": "No {mode} record found for user {username}",
"blitz": "Blitz",
"sprint": "40L"
},
"stats": {
"user_info": "User {name} ({id})",
"no_rank": "No rank statistics available",
"rank_info": ", Rating {rating}±{rd} ({vol})",
"no_game": ", No game data available",
"recent_games": ", Recent {count} games data",
"daily_stats": "User {name} 24h statistics: ",
"no_daily": "User {name} has no 24h statistics available",
"history_stats": "\nHistorical statistics: ",
"no_history": "\nNo historical statistics available",
"lpm": "\nL'PM: {lpm} ( {pps} pps )",
"apm": "\nAPM: {apm} ( x{apl} )",
"adpm": "\nADPM: {adpm} ( x{adpl} ) ( {vs}vs )",
"sprint_pb": "\n40L: {time}s",
"marathon_pb": "\nMarathon: {score}",
"challenge_pb": "\nChallenge: {score}"
},
"template_ui": {
"invalid_tag": "{revision} is not a valid tag in the template repository",
"update_success": "Template updated successfully",
"update_failed": "Template update failed"
},
"help": {
"usage": "Type \"{command} --help\" for help"
},
"prompt": {
"io_check": "io check me",
"io_bind": "io bind {{gameID}}",
"top_check": "top check me",
"top_bind": "top bind {{gameID}}",
"tos_check": "tos check me",
"tos_bind": "tos bind {{gameID}}"
},
"retry": {
"message": "Retrying: {func} ({i}/{max_attempts})"
}
}

View File

@@ -31,7 +31,71 @@ class Template:
template_language: LangItem = LangItem('template', 'template_language')
class Bind:
not_found: LangItem = LangItem('bind', 'not_found')
no_account: LangItem = LangItem('bind', 'no_account')
confirm_unbind: LangItem = LangItem('bind', 'confirm_unbind')
config_success: LangItem = LangItem('bind', 'config_success')
verify_already: LangItem = LangItem('bind', 'verify_already')
verify_failed: LangItem = LangItem('bind', 'verify_failed')
only_discord: LangItem = LangItem('bind', 'only_discord')
class Record:
not_found: LangItem = LangItem('record', 'not_found')
blitz: LangItem = LangItem('record', 'blitz')
sprint: LangItem = LangItem('record', 'sprint')
class Stats:
user_info: LangItem = LangItem('stats', 'user_info')
no_rank: LangItem = LangItem('stats', 'no_rank')
rank_info: LangItem = LangItem('stats', 'rank_info')
no_game: LangItem = LangItem('stats', 'no_game')
recent_games: LangItem = LangItem('stats', 'recent_games')
daily_stats: LangItem = LangItem('stats', 'daily_stats')
no_daily: LangItem = LangItem('stats', 'no_daily')
history_stats: LangItem = LangItem('stats', 'history_stats')
no_history: LangItem = LangItem('stats', 'no_history')
lpm: LangItem = LangItem('stats', 'lpm')
apm: LangItem = LangItem('stats', 'apm')
adpm: LangItem = LangItem('stats', 'adpm')
sprint_pb: LangItem = LangItem('stats', 'sprint_pb')
marathon_pb: LangItem = LangItem('stats', 'marathon_pb')
challenge_pb: LangItem = LangItem('stats', 'challenge_pb')
class TemplateUi:
invalid_tag: LangItem = LangItem('template_ui', 'invalid_tag')
update_success: LangItem = LangItem('template_ui', 'update_success')
update_failed: LangItem = LangItem('template_ui', 'update_failed')
class Help:
usage: LangItem = LangItem('help', 'usage')
class Prompt:
io_check: LangItem = LangItem('prompt', 'io_check')
io_bind: LangItem = LangItem('prompt', 'io_bind')
top_check: LangItem = LangItem('prompt', 'top_check')
top_bind: LangItem = LangItem('prompt', 'top_bind')
tos_check: LangItem = LangItem('prompt', 'tos_check')
tos_bind: LangItem = LangItem('prompt', 'tos_bind')
class Retry:
message: LangItem = LangItem('retry', 'message')
class Lang(LangModel):
interaction = Interaction
error = Error
template = Template
bind = Bind
record = Record
stats = Stats
template_ui = TemplateUi
help = Help
prompt = Prompt
retry = Retry

View File

@@ -13,5 +13,55 @@
},
"template": {
"template_language": "zh-CN"
},
"bind": {
"not_found": "未查询到绑定信息",
"no_account": "您还未绑定 {game} 账号",
"confirm_unbind": "您确定要解绑吗?",
"config_success": "配置成功",
"verify_already": "您已经完成了验证.",
"verify_failed": "您未通过验证, 请确认目标 {game} 账号绑定了当前 Discord 账号",
"only_discord": "目前仅支持 Discord 账号验证"
},
"record": {
"not_found": "未找到用户 {username} 的 {mode} 记录",
"blitz": "Blitz",
"sprint": "40L"
},
"stats": {
"user_info": "用户 {name} ({id})",
"no_rank": "暂无段位统计数据",
"rank_info": ", 段位分 {rating}±{rd} ({vol})",
"no_game": ", 暂无游戏数据",
"recent_games": ", 最近 {count} 局数据",
"daily_stats": "用户 {name} 24小时内统计数据为: ",
"no_daily": "用户 {name} 暂无24小时内统计数据",
"history_stats": "\n历史统计数据为: ",
"no_history": "\n暂无历史统计数据",
"lpm": "\nL'PM: {lpm} ( {pps} pps )",
"apm": "\nAPM: {apm} ( x{apl} )",
"adpm": "\nADPM: {adpm} ( x{adpl} ) ( {vs}vs )",
"sprint_pb": "\n40L: {time}s",
"marathon_pb": "\nMarathon: {score}",
"challenge_pb": "\nChallenge: {score}"
},
"template_ui": {
"invalid_tag": "{revision} 不是模板仓库中的有效标签",
"update_success": "更新模板成功",
"update_failed": "更新模板失败"
},
"help": {
"usage": "输入\"{command} --help\"查看帮助"
},
"prompt": {
"io_check": "io查我",
"io_bind": "io绑定{{游戏ID}}",
"top_check": "top查我",
"top_bind": "top绑定{{游戏ID}}",
"tos_check": "茶服查我",
"tos_bind": "茶服绑定{{游戏ID}}"
},
"retry": {
"message": "Retrying: {func} ({i}/{max_attempts})"
}
}