Skip to content

feat: add Russian translation#6081

Open
seoeaa wants to merge 2 commits intoAstrBotDevs:masterfrom
seoeaa:feat/russian-translation
Open

feat: add Russian translation#6081
seoeaa wants to merge 2 commits intoAstrBotDevs:masterfrom
seoeaa:feat/russian-translation

Conversation

@seoeaa
Copy link

@seoeaa seoeaa commented Mar 12, 2026

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:

  • 为仪表盘 UI 引入完整的 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:

  • Introduce a full ru-RU locale with core, feature, and message translation files for the dashboard UI.
  • Expose Russian as a selectable language in the dashboard language switcher and initial locale detection.

Enhancements:

  • Change backend auth error and success messages to use translation keys instead of hardcoded Chinese strings for localization.

@auto-assign auto-assign bot requested review from LIghtJUNction and anka-afk March 12, 2026 00:15
@dosubot dosubot bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Mar 12, 2026
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>

Sourcery 对开源项目是免费的——如果你觉得这些 review 有帮助,欢迎分享 ✨
帮我变得更有用!请在每条评论上点击 👍 或 👎,我会根据你的反馈改进后续的 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>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines 48 to 51
return Response().error("invalidCredentials").__dict__

async def edit_account(self):
if DEMO_MODE:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@dosubot dosubot bot added area:core The bug / feature is about astrbot's core, backend area:webui The bug / feature is about webui(dashboard) of astrbot. labels Mar 12, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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

  • Russian Translation Added: New locale files for Russian (ru-RU) have been added, providing a full translation for the dashboard UI and backend authentication messages.
  • Backend Auth Message Localization: Hardcoded Chinese error messages in astrbot/dashboard/routes/auth.py were replaced with localization keys (invalidCredentials, oldPasswordError, emptyNewAccountError, passwordMismatch, editSuccess) to support internationalization.
  • Frontend i18n System Update: The dashboard/src/i18n/composables.ts file was updated to include 'ru-RU' in the list of available locales and in the initial locale setup logic, enabling the new language in the UI.
  • Comprehensive Russian Locale Files: A large set of new JSON files containing Russian translations for various core components and features of the dashboard were added under dashboard/src/i18n/locales/ru-RU/.
Changelog
  • astrbot/dashboard/routes/auth.py
    • Replaced hardcoded Chinese error messages with localization keys for better internationalization.
  • dashboard/src/i18n/composables.ts
    • Added 'ru-RU' to the list of available locales.
    • Updated the initial locale detection to include 'ru-RU'.
    • Removed minor whitespace inconsistencies.
  • dashboard/src/i18n/locales/en-US/features/config-metadata.json
    • Added a hint for the 'persona' description.
  • dashboard/src/i18n/locales/ru-RU/core/actions.json
    • Added Russian translations for core actions.
  • dashboard/src/i18n/locales/ru-RU/core/common.json
    • Added Russian translations for common UI elements and messages.
  • dashboard/src/i18n/locales/ru-RU/core/header.json
    • Added Russian translations for header components, update dialogs, and account management.
  • dashboard/src/i18n/locales/ru-RU/core/navigation.json
    • Added Russian translations for navigation menu items.
  • dashboard/src/i18n/locales/ru-RU/core/shared.json
    • Added Russian translations for shared UI components like selectors and quick previews.
  • dashboard/src/i18n/locales/ru-RU/core/status.json
    • Added Russian translations for various status messages.
  • dashboard/src/i18n/locales/ru-RU/features/about.json
    • Added Russian translations for the 'About' page content.
  • dashboard/src/i18n/locales/ru-RU/features/alkaid/index.json
    • Added Russian translations for Alkaid Lab features.
  • dashboard/src/i18n/locales/ru-RU/features/alkaid/knowledge-base.json
    • Added Russian translations for Alkaid knowledge base management.
  • dashboard/src/i18n/locales/ru-RU/features/alkaid/memory.json
    • Added Russian translations for Alkaid long-term memory features.
  • dashboard/src/i18n/locales/ru-RU/features/auth.json
    • Added Russian translations for authentication UI elements.
  • dashboard/src/i18n/locales/ru-RU/features/chart.json
    • Added Russian translations for chart labels.
  • dashboard/src/i18n/locales/ru-RU/features/chat.json
    • Added Russian translations for chat interface elements and messages.
  • dashboard/src/i18n/locales/ru-RU/features/command.json
    • Added Russian translations for command management features.
  • dashboard/src/i18n/locales/ru-RU/features/config-metadata.json
    • Added Russian translations for configuration metadata descriptions and hints.
  • dashboard/src/i18n/locales/ru-RU/features/config.json
    • Added Russian translations for general configuration settings.
  • dashboard/src/i18n/locales/ru-RU/features/console.json
    • Added Russian translations for console and pip installation features.
  • dashboard/src/i18n/locales/ru-RU/features/conversation.json
    • Added Russian translations for conversation management.
  • dashboard/src/i18n/locales/ru-RU/features/cron.json
    • Added Russian translations for scheduled tasks (cron).
  • dashboard/src/i18n/locales/ru-RU/features/dashboard.json
    • Added Russian translations for dashboard statistics and charts.
  • dashboard/src/i18n/locales/ru-RU/features/extension.json
    • Added Russian translations for plugin and extension management.
  • dashboard/src/i18n/locales/ru-RU/features/knowledge-base/detail.json
    • Added Russian translations for knowledge base detail view.
  • dashboard/src/i18n/locales/ru-RU/features/knowledge-base/document.json
    • Added Russian translations for knowledge base document view.
  • dashboard/src/i18n/locales/ru-RU/features/knowledge-base/index.json
    • Added Russian translations for knowledge base index page.
  • dashboard/src/i18n/locales/ru-RU/features/migration.json
    • Added Russian translations for the migration assistant.
  • dashboard/src/i18n/locales/ru-RU/features/persona.json
    • Added Russian translations for persona management.
  • dashboard/src/i18n/locales/ru-RU/features/platform.json
    • Added Russian translations for platform adapter management.
  • dashboard/src/i18n/locales/ru-RU/features/provider.json
    • Added Russian translations for model provider management.
  • dashboard/src/i18n/locales/ru-RU/features/session-management.json
    • Added Russian translations for session management rules.
  • dashboard/src/i18n/locales/ru-RU/features/settings.json
    • Added Russian translations for general settings.
  • dashboard/src/i18n/locales/ru-RU/features/subagent.json
    • Added Russian translations for subagent orchestration.
  • dashboard/src/i18n/locales/ru-RU/features/tool-use.json
    • Added Russian translations for tool and function management.
  • dashboard/src/i18n/locales/ru-RU/features/trace.json
    • Added Russian translations for trace logging.
  • dashboard/src/i18n/locales/ru-RU/features/welcome.json
    • Added Russian translations for the welcome page.
  • dashboard/src/i18n/locales/ru-RU/messages/errors.json
    • Added Russian translations for various error messages.
  • dashboard/src/i18n/locales/ru-RU/messages/success.json
    • Added Russian translations for various success messages.
  • dashboard/src/i18n/locales/ru-RU/messages/validation.json
    • Added Russian translations for validation messages.
  • dashboard/src/i18n/translations.ts
    • Imported all new Russian locale JSON files.
    • Registered the 'ru-RU' locale in the main translations object.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
{
{

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:core The bug / feature is about astrbot's core, backend area:webui The bug / feature is about webui(dashboard) of astrbot. size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant