Skip to content

feat: add Traditional Chinese translation#7095

Open
ZvZPvz wants to merge 6 commits intoAstrBotDevs:masterfrom
ZvZPvz:master
Open

feat: add Traditional Chinese translation#7095
ZvZPvz wants to merge 6 commits intoAstrBotDevs:masterfrom
ZvZPvz:master

Conversation

@ZvZPvz
Copy link
Copy Markdown
Contributor

@ZvZPvz ZvZPvz commented Mar 28, 2026

Modifications / 改动点

新增繁体中文(香港)和繁体中文(台湾)的本地化支持

  • This is NOT a breaking change. / 这不是一个破坏性变更。

Screenshots or Test Results / 运行截图或测试结果

image image

Checklist / 检查清单

  • 😊 If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
    / 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。

  • 👀 My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above.
    / 我的更改经过了良好的测试,并已在上方提供了“验证步骤”和“运行截图”

  • 🤓 I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in requirements.txt and pyproject.toml.
    / 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到 requirements.txtpyproject.toml 文件相应位置。

  • 😮 My changes do not introduce malicious code.
    / 我的更改没有引入恶意代码。

Summary by Sourcery

Add Traditional Chinese (Hong Kong and Taiwan) localization support across the dashboard and expose these locales in the language selection and initialization logic.

New Features:

  • Introduce zh-HK and zh-TW translation bundles for all core, feature, and message namespaces in the dashboard i18n system.
  • Allow users to select zh-HK and zh-TW from the language switcher and persist these choices via localStorage-backed locale initialization.

@auto-assign auto-assign bot requested review from Fridemn and advent259141 March 28, 2026 12:06
@dosubot dosubot bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Mar 28, 2026
Copy link
Copy Markdown
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 - I've left some high level feedback:

  • The list of supported locales (['zh-CN', 'zh-HK', 'zh-TW', 'en-US', 'ru-RU']) is duplicated in multiple places; consider extracting it to a shared constant or config to avoid divergent updates in the future.
  • You might want to define a fallback strategy between zh-CN, zh-HK, and zh-TW (e.g., when a key is missing in a regional variant) so that untranslated strings don’t silently break the UI.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The list of supported locales (`['zh-CN', 'zh-HK', 'zh-TW', 'en-US', 'ru-RU']`) is duplicated in multiple places; consider extracting it to a shared constant or config to avoid divergent updates in the future.
- You might want to define a fallback strategy between `zh-CN`, `zh-HK`, and `zh-TW` (e.g., when a key is missing in a regional variant) so that untranslated strings don’t silently break the UI.

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.

@dosubot dosubot bot added the area:webui The bug / feature is about webui(dashboard) of astrbot. label Mar 28, 2026
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Warning

Gemini is experiencing higher than usual traffic and was unable to create the review. Please try again in a few hours by commenting /gemini review.

@ZvZPvz
Copy link
Copy Markdown
Contributor Author

ZvZPvz commented Mar 28, 2026

/gemini review

Copy link
Copy Markdown
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 support for Traditional Chinese (Hong Kong and Taiwan) by introducing new locale files and updating the i18n configuration. Feedback highlights that several files in the new locales incorrectly use Simplified Chinese or contain untranslated English and Cantonese mixed text. A refactoring is also suggested to centralize the available locales list into a module-level constant to improve code maintainability and reduce duplication.

@ZvZPvz ZvZPvz requested a review from RC-CHN March 30, 2026 13:52
@ZvZPvz
Copy link
Copy Markdown
Contributor Author

ZvZPvz commented Mar 30, 2026

/gemini review

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Warning

Gemini is experiencing higher than usual traffic and was unable to create the review. Please try again in a few hours by commenting /gemini review.

@ZvZPvz
Copy link
Copy Markdown
Contributor Author

ZvZPvz commented Mar 30, 2026

/gemini review

Copy link
Copy Markdown
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 introduces Traditional Chinese translations for both Hong Kong (zh-HK) and Taiwan (zh-TW) locales, updating the translation configuration accordingly. My review highlights several issues: the zh-HK translation contains significant mixed English and informal Cantonese, which should be standardized to formal written Chinese; the language list should be centralized to improve maintainability; and two session-management files contain unnecessary Byte Order Marks (BOM) that should be removed.

// 从localStorage获取保存的语言设置
const savedLocale = localStorage.getItem('astrbot-locale') as Locale;
const initialLocale = savedLocale && ['zh-CN', 'en-US', 'ru-RU'].includes(savedLocale)
const initialLocale = savedLocale && ['zh-CN', 'zh-HK', 'zh-TW', 'en-US', 'ru-RU'].includes(savedLocale)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

为了提高代码的可维护性,建议将此处的语言环境列表提取为模块级别的常量,以便在 useI18n 函数中的 availableLocales (L106) 和此处复用。这可以避免在未来增删语言时遗漏修改。

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

Labels

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.

2 participants