feat: add Russian translation#6081
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Hey - 我发现了 1 个问题,并给出了一些整体反馈:
- 目前支持的 locale 列表在多个地方被重复定义(availableLocales、setupI18n 的 initialLocale 检查,以及 languageOptions);建议将受支持的 locale 列表集中到单一常量中,以避免未来出现不一致。
- auth.py 中使用的新鉴权文案 key(例如:
"invalidCredentials"、"oldPasswordError"、"emptyNewAccountError")如果作为共享的常量/枚举来定义,而不是直接使用内联字符串,会更健壮一些,可以降低拼写错误的风险,也便于复用。 - composables.ts 中有一些仅涉及空白字符的变更;你可能会希望清理掉这些改动,让 diff 更聚焦在实际的 i18n 功能改动上。
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- 目前支持的 locale 列表在多个地方被重复定义(availableLocales、setupI18n 的 initialLocale 检查,以及 languageOptions);建议将受支持的 locale 列表集中到单一常量中,以避免未来出现不一致。
- auth.py 中使用的新鉴权文案 key(例如:'invalidCredentials'、'oldPasswordError'、'emptyNewAccountError')如果作为共享的常量/枚举来定义,而不是直接使用内联字符串,会更健壮一些,可以降低拼写错误的风险,也便于复用。
- composables.ts 中有一些仅涉及空白字符的变更;你可能会希望清理掉这些改动,让 diff 更聚焦在实际的 i18n 功能改动上。
## Individual Comments
### Comment 1
<location path="astrbot/dashboard/routes/auth.py" line_range="48-51" />
<code_context>
)
await asyncio.sleep(3)
- return Response().error("用户名或密码错误").__dict__
+ return Response().error("invalidCredentials").__dict__
async def edit_account(self):
</code_context>
<issue_to_address>
**question (bug_risk):** 从可读的文本消息切换为消息 key 可能会影响非 dashboard 端的 API 使用方。
`msg` 现在返回的是诸如 `"invalidCredentials"` 这样的 key,而不是可读文本。如果只有 dashboard 消费该 API,并且通过 i18n 将 key 映射为文案,这是没有问题的;但如果还有其他客户端直接渲染 `msg`,它们现在就会显示原始的 key。如果这个接口在其他地方也被使用,建议考虑同时返回稳定的 key 和一个默认文案,或者确认所有调用方都正确地做了 i18n 映射。
</issue_to_address>帮我变得更有用!请在每条评论上点击 👍 或 👎,我会根据你的反馈改进后续的 review。
Original comment in English
Hey - I've found 1 issue, and left some high level feedback:
- The supported locale list is now duplicated in multiple places (availableLocales, setupI18n’s initialLocale check, and languageOptions); consider centralizing the list of supported locales in a single constant to avoid future divergence.
- The new auth message keys used in auth.py (e.g., 'invalidCredentials', 'oldPasswordError', 'emptyNewAccountError') would be more robust if defined as shared constants/enums rather than inline strings to reduce the risk of typos and ease reuse.
- There are a number of whitespace-only changes in composables.ts; you may want to trim these to keep the diff focused on the functional i18n additions.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The supported locale list is now duplicated in multiple places (availableLocales, setupI18n’s initialLocale check, and languageOptions); consider centralizing the list of supported locales in a single constant to avoid future divergence.
- The new auth message keys used in auth.py (e.g., 'invalidCredentials', 'oldPasswordError', 'emptyNewAccountError') would be more robust if defined as shared constants/enums rather than inline strings to reduce the risk of typos and ease reuse.
- There are a number of whitespace-only changes in composables.ts; you may want to trim these to keep the diff focused on the functional i18n additions.
## Individual Comments
### Comment 1
<location path="astrbot/dashboard/routes/auth.py" line_range="48-51" />
<code_context>
)
await asyncio.sleep(3)
- return Response().error("用户名或密码错误").__dict__
+ return Response().error("invalidCredentials").__dict__
async def edit_account(self):
</code_context>
<issue_to_address>
**question (bug_risk):** Switching from human-readable messages to message keys may affect non-dashboard API consumers.
`msg` now returns keys like `"invalidCredentials"` instead of human-readable text. This is fine if only the dashboard consumes this API and maps keys via i18n, but any other clients rendering `msg` directly will now show the raw keys. If this endpoint is used elsewhere, consider returning both a stable key and a default message, or verify that all consumers handle i18n lookup correctly.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
astrbot/dashboard/routes/auth.py
Outdated
| return Response().error("invalidCredentials").__dict__ | ||
|
|
||
| async def edit_account(self): | ||
| if DEMO_MODE: |
There was a problem hiding this comment.
question (bug_risk): 从可读的文本消息切换为消息 key 可能会影响非 dashboard 端的 API 使用方。
msg 现在返回的是诸如 "invalidCredentials" 这样的 key,而不是可读文本。如果只有 dashboard 消费该 API,并且通过 i18n 将 key 映射为文案,这是没有问题的;但如果还有其他客户端直接渲染 msg,它们现在就会显示原始的 key。如果这个接口在其他地方也被使用,建议考虑同时返回稳定的 key 和一个默认文案,或者确认所有调用方都正确地做了 i18n 映射。
Original comment in English
question (bug_risk): Switching from human-readable messages to message keys may affect non-dashboard API consumers.
msg now returns keys like "invalidCredentials" instead of human-readable text. This is fine if only the dashboard consumes this API and maps keys via i18n, but any other clients rendering msg directly will now show the raw keys. If this endpoint is used elsewhere, consider returning both a stable key and a default message, or verify that all consumers handle i18n lookup correctly.
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces full Russian language support for the application's dashboard and backend authentication messages. It involves adding new Russian locale files, integrating them into the frontend's internationalization system, and updating backend authentication responses to use localization keys instead of hardcoded strings. This enhancement significantly improves the user experience for Russian-speaking users by providing a fully localized interface. Highlights
Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds comprehensive Russian language support to the dashboard and localizes backend authentication messages. The changes are well-structured, primarily involving the addition of new ru-RU locale files and updating the frontend to recognize and switch to the new language. I've identified a couple of minor areas for improvement to enhance maintainability and prevent potential parsing issues, but overall, this is a solid contribution towards internationalizing the application.
| // 获取可用语言列表 | ||
| const availableLocales: Locale[] = ['zh-CN', 'en-US']; | ||
| const availableLocales: Locale[] = ['zh-CN', 'en-US', 'ru-RU']; |
There was a problem hiding this comment.
The list of available locales ['zh-CN', 'en-US', 'ru-RU'] is now hardcoded in two places (here and in the setupI18n function). To improve maintainability and avoid inconsistencies when adding new languages, consider defining this array as a single module-level constant and reusing it in both locations.
| @@ -0,0 +1,24 @@ | |||
| { | |||
There was a problem hiding this comment.
This file starts with a Byte Order Mark (BOM) character (\uFEFF). While many JSON parsers can handle it, it's not part of the JSON standard and can cause parsing issues in some environments or with certain tools. It's recommended to save the file with standard UTF-8 encoding (without BOM).
This comment applies to all newly added ru-RU/**/*.json translation files.
| { | |
| { |
|
Really thanks for you Russian translation! ❤️ |
Add full Russian translation for dashboard and localize backend auth messages. This PR includes comprehensive locale files, dashboard UI registration, and backend localization for auth routes.
Summary by Sourcery
在整个仪表盘中新增俄语本地化支持,并通过翻译键对后端认证响应进行本地化处理。
New Features:
ru-RU语言环境,包括核心、功能及消息翻译文件。Enhancements:
Original summary in English
Summary by Sourcery
Add Russian locale support across the dashboard and localize backend auth responses using translation keys.
New Features:
Enhancements: