feat(i18n): complete internationalization for usage query feature

Fully internationalized the usage query feature to support both Chinese and English.

Frontend changes:
- Refactored UsageScriptModal to use i18n translation keys
- Replaced hardcoded Chinese template names with constants
- Implemented dynamic template generation with i18n support
- Internationalized all labels, placeholders, and code comments
- Added template name mapping for translation

Backend changes:
- Replaced all hardcoded Chinese error messages in usage_script.rs
- Converted 33 error instances from AppError::Message to AppError::localized
- Added bilingual error messages for runtime, parsing, HTTP, and validation errors

Translation updates:
- Added 11 new translation key pairs to zh.json and en.json
- Covered template names, field labels, placeholders, and code comments

Impact:
- 100% i18n coverage for usage query functionality
- All user-facing text and error messages now support language switching
- Better user experience for English-speaking users
This commit is contained in:
Jason
2025-11-05 00:07:54 +08:00
parent bafddb8e52
commit 720c4d9774
4 changed files with 91 additions and 59 deletions

View File

@@ -344,10 +344,21 @@
"title": "配置用量查询",
"enableUsageQuery": "启用用量查询",
"presetTemplate": "预设模板",
"templateCustom": "自定义",
"templateGeneral": "通用模板",
"templateNewAPI": "NewAPI",
"accessToken": "访问令牌",
"accessTokenPlaceholder": "在'安全设置'里生成",
"userId": "用户 ID",
"userIdPlaceholder": "例如114514",
"defaultPlan": "默认套餐",
"queryFailedMessage": "查询失败",
"queryScript": "查询脚本JavaScript",
"timeoutSeconds": "超时时间(秒)",
"scriptHelp": "脚本编写说明:",
"configFormat": "配置格式:",
"commentOptional": "可选",
"commentResponseIsJson": "response 是 API 返回的 JSON 数据",
"extractorFormat": "extractor 返回格式(所有字段均为可选):",
"tips": "💡 提示:",
"testing": "测试中...",