Skip to content

Conversation

seefs001
Copy link
Collaborator

@seefs001 seefs001 commented Oct 14, 2025

Summary by CodeRabbit

  • New Features

    • Wide UI localization across auth, settings, playground, and pages: labels, placeholders, buttons, errors, hints, badges, banners and modal titles now use translations.
    • Dynamic texts localized (image counts, loading messages, verification prompts, switch labels, formatted status messages).
  • Chores

    • Large expansion of translation files for English, French, Russian and Chinese with many new keys and pluralization variants to improve coverage.

Copy link
Contributor

coderabbitai bot commented Oct 14, 2025

Walkthrough

Applied i18n across multiple React components by replacing hard-coded strings with react-i18next t(...) calls and expanding locale entries in en/fr/ru/zh JSON files. No control flow, data, or API changes were introduced. Affected areas include auth, playground, settings, task-log modal, pages, and Stripe payment settings.

Changes

Cohort / File(s) Summary of changes
Auth i18n
web/src/components/auth/LoginForm.jsx, web/src/components/auth/RegisterForm.jsx, web/src/components/auth/TwoFAVerification.jsx
Replaced hard-coded UI strings (alt text, modal titles, labels, errors, buttons, placeholders) with t(...); added useTranslation where needed; minor JSX text structure tweaks; no logic changes.
Playground i18n
web/src/components/playground/CustomRequestEditor.jsx, .../DebugPanel.jsx, .../ImageUrlInput.jsx, .../MessageContent.jsx, .../ParameterControl.jsx, .../SettingsPanel.jsx, .../ThinkingContent.jsx
Localized labels, placeholders, badges, status messages, headings, switches, helper texts and banners via t(...); behavior unchanged.
Settings i18n
web/src/components/settings/DashboardSetting.jsx, web/src/components/settings/SystemSetting.jsx
Added useTranslation and replaced modal texts, labels, and placeholders with t(...); structure/logic unaffected.
Task logs modal i18n
web/src/components/table/task-logs/modals/ContentModal.jsx
Added useTranslation; converted video error UI strings and related action texts to t(...); no control-flow changes.
Pages i18n
web/src/pages/Chat2Link/index.jsx, web/src/pages/Home/index.jsx, web/src/pages/Setting/Payment/SettingsPaymentGatewayStripe.jsx
Localized loading text, headings, Stripe setup copy, webhook/event notes, and link texts via t(...).
Locale data updates
web/src/i18n/locales/en.json, web/src/i18n/locales/fr.json, web/src/i18n/locales/ru.json, web/src/i18n/locales/zh.json
Added many translation keys and plural variants for new/updated UI strings (auth/2FA, playground, Stripe/webhook, migration prompts, thinking/status, hints); expanded locale coverage and placeholders.

Sequence Diagram(s)

sequenceDiagram
    participant UI as React Component
    participant i18n as react-i18next
    participant User as User

    Note over UI,i18n: Display localization flow (unchanged control flow)
    User->>UI: Render component
    UI->>i18n: call t('key')
    i18n-->>UI: localized string
    UI-->>User: Render localized text
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • creamlike1024

Poem

I twitch my ears at keys that sing,
From hard-coded burrows to t(...), we spring!
en, fr, ru, zh—four carrots in a row,
Strings now hop wherever users go.
Tip-tap, translate—what a sight to see! 🥕🐇

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title Check ❓ Inconclusive The title “fix: i18n” is too terse and does not clearly convey the scope or intent of the changes, which include adding extensive internationalization support and replacing hard-coded UI strings with translated calls; it lacks descriptive context about what was fixed or improved. Please choose a more descriptive title that summarizes the main change, for example “feat(i18n): replace hard-coded UI strings with translation calls” or “chore: add i18n support for Chinese UI text and update locale entries.”
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 8

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
web/src/i18n/locales/ru.json (1)

76-76: Translate common.changeLanguage.

The Russian locale currently returns the raw key ("common.changeLanguage"), so the UI will show the key string instead of readable text. Please supply the actual Russian translation (e.g. “Сменить язык”).

web/src/i18n/locales/zh.json (1)

1-2138: Align translation keys across all locales
en.json, fr.json, and ru.json each contain more keys than zh.json (10, 20, and 30 extra respectively). Sync zh.json with the other locale files to restore parity—consider using a diff tool or i18next-parser to extract and merge the missing keys.

🧹 Nitpick comments (2)
web/src/pages/Setting/Payment/SettingsPaymentGatewayStripe.jsx (1)

170-197: LGTM! Stripe settings properly localized.

The Stripe configuration strings are correctly internationalized. Line 191's complex template with conditional logic is functional but consider extracting the logic if this pattern repeats elsewhere:

description={`${t('Webhook 填:')}${props.options.ServerAddress ? removeTrailingSlash(props.options.ServerAddress) : t('网站地址')}/api/stripe/webhook`}

This works correctly but could benefit from a helper function if similar patterns appear frequently.

web/src/components/playground/CustomRequestEditor.jsx (1)

85-85: Consider full i18n for error messages.

The error message mixes Chinese and English: the prefix JSON格式错误 is in Chinese while error.message is in English (from JavaScript's JSON.parse). For better multilingual support, consider using t() with interpolation.

Apply this diff for full i18n support:

-      setErrorMessage(`JSON格式错误: ${error.message}`);
+      setErrorMessage(t('JSON格式错误: {{message}}', { message: error.message }));

Then add the translation key with interpolation support to your locale files.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b3f50e9 and 7b48fd8.

📒 Files selected for processing (20)
  • web/src/components/auth/LoginForm.jsx (2 hunks)
  • web/src/components/auth/RegisterForm.jsx (1 hunks)
  • web/src/components/auth/TwoFAVerification.jsx (12 hunks)
  • web/src/components/playground/CustomRequestEditor.jsx (5 hunks)
  • web/src/components/playground/DebugPanel.jsx (1 hunks)
  • web/src/components/playground/ImageUrlInput.jsx (4 hunks)
  • web/src/components/playground/MessageContent.jsx (1 hunks)
  • web/src/components/playground/ParameterControl.jsx (8 hunks)
  • web/src/components/playground/SettingsPanel.jsx (3 hunks)
  • web/src/components/playground/ThinkingContent.jsx (2 hunks)
  • web/src/components/settings/DashboardSetting.jsx (2 hunks)
  • web/src/components/settings/SystemSetting.jsx (5 hunks)
  • web/src/components/table/task-logs/modals/ContentModal.jsx (4 hunks)
  • web/src/i18n/locales/en.json (41 hunks)
  • web/src/i18n/locales/fr.json (41 hunks)
  • web/src/i18n/locales/ru.json (41 hunks)
  • web/src/i18n/locales/zh.json (41 hunks)
  • web/src/pages/Chat2Link/index.jsx (2 hunks)
  • web/src/pages/Home/index.jsx (1 hunks)
  • web/src/pages/Setting/Payment/SettingsPaymentGatewayStripe.jsx (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (10)
web/src/components/auth/LoginForm.jsx (2)
web/src/components/auth/RegisterForm.jsx (1)
  • status (97-100)
web/src/components/settings/PersonalSetting.jsx (1)
  • status (61-61)
web/src/components/settings/DashboardSetting.jsx (3)
web/src/components/auth/LoginForm.jsx (1)
  • useTranslation (59-59)
web/src/components/settings/SystemSetting.jsx (1)
  • useTranslation (47-47)
web/src/pages/Home/index.jsx (1)
  • useTranslation (69-69)
web/src/components/playground/ImageUrlInput.jsx (6)
web/src/components/auth/LoginForm.jsx (1)
  • useTranslation (59-59)
web/src/components/playground/CustomRequestEditor.jsx (1)
  • useTranslation (38-38)
web/src/components/playground/DebugPanel.jsx (1)
  • useTranslation (41-41)
web/src/components/playground/MessageContent.jsx (1)
  • useTranslation (38-38)
web/src/components/playground/ParameterControl.jsx (1)
  • useTranslation (41-41)
web/src/components/playground/SettingsPanel.jsx (1)
  • useTranslation (49-49)
web/src/pages/Setting/Payment/SettingsPaymentGatewayStripe.jsx (1)
web/src/helpers/utils.jsx (2)
  • a (259-259)
  • removeTrailingSlash (177-184)
web/src/components/auth/RegisterForm.jsx (1)
web/src/components/auth/LoginForm.jsx (1)
  • status (99-102)
web/src/components/playground/ThinkingContent.jsx (1)
web/src/components/playground/MessageContent.jsx (1)
  • thinkingSource (76-76)
web/src/components/playground/SettingsPanel.jsx (1)
web/src/hooks/playground/usePlaygroundState.js (1)
  • customRequestMode (50-52)
web/src/components/playground/CustomRequestEditor.jsx (1)
web/src/hooks/playground/usePlaygroundState.js (1)
  • customRequestMode (50-52)
web/src/components/auth/TwoFAVerification.jsx (1)
web/src/helpers/utils.jsx (2)
  • showError (122-151)
  • showSuccess (157-159)
web/src/components/playground/ParameterControl.jsx (5)
web/src/components/playground/CustomRequestEditor.jsx (1)
  • useTranslation (38-38)
web/src/components/playground/DebugPanel.jsx (1)
  • useTranslation (41-41)
web/src/components/playground/ImageUrlInput.jsx (1)
  • useTranslation (33-33)
web/src/components/playground/MessageContent.jsx (1)
  • useTranslation (38-38)
web/src/components/playground/SettingsPanel.jsx (1)
  • useTranslation (49-49)
🔇 Additional comments (17)
web/src/components/auth/RegisterForm.jsx (1)

625-629: LGTM! Accessibility improvement with i18n.

The image alt text is now translatable, improving accessibility across different locales. The multi-line formatting also enhances code readability.

web/src/pages/Home/index.jsx (1)

180-182: LGTM! Proper i18n implementation.

The heading text is now translatable while maintaining the existing language-specific rendering logic. The changes integrate well with the language detection at line 82.

web/src/components/playground/DebugPanel.jsx (1)

148-148: LGTM! Badge label is now translatable.

The custom mode indicator badge now supports multiple locales while maintaining the same conditional rendering logic.

web/src/components/playground/MessageContent.jsx (1)

287-287: LGTM! Error message prefix internationalized correctly.

The static error message prefix is now translatable while preserving the dynamic URL portion. This maintains the same error reporting functionality across different locales.

web/src/pages/Chat2Link/index.jsx (1)

22-42: LGTM! Standard i18n implementation.

The loading message is now translatable following react-i18next best practices. The redirect logic remains unchanged.

web/src/components/playground/ParameterControl.jsx (2)

32-41: LGTM! i18n hook properly initialized.

Standard react-i18next setup following best practices.


76-282: LGTM! Comprehensive UI text internationalization.

All parameter control labels, descriptions, and placeholders are now translatable. The changes maintain existing functionality while enabling multi-locale support.

web/src/components/playground/ThinkingContent.jsx (1)

108-125: LGTM! Thinking status indicators internationalized.

The source label and thinking status text are now translatable, completing the i18n coverage for this component. The conditional rendering logic is preserved.

web/src/components/auth/LoginForm.jsx (1)

753-757: LGTM! WeChat QR alt text and 2FA modal title properly localized.

The i18n implementation for the WeChat QR code image alt text and the 2FA verification modal title is correct and consistent with the broader localization effort.

Also applies to: 800-800

web/src/components/table/task-logs/modals/ContentModal.jsx (1)

23-23: LGTM! Video error UI properly internationalized.

All user-facing strings in the video error handling UI have been correctly wrapped with t() calls. The implementation follows react-i18next best practices.

Also applies to: 33-33, 69-99

web/src/components/settings/DashboardSetting.jsx (1)

28-31: LGTM! Migration modal properly localized.

The migration confirmation modal strings are correctly internationalized, including title, button labels, and warning messages.

Also applies to: 131-145

web/src/components/playground/SettingsPanel.jsx (1)

125-126: LGTM! Settings panel UI properly internationalized.

The custom mode hints, stream output label, and switch states are correctly localized using t() calls.

Also applies to: 157-158, 209-214, 220-221

web/src/components/playground/ImageUrlInput.jsx (1)

24-24: LGTM! Image URL input properly internationalized with correct interpolation.

All UI strings are correctly localized, and line 105 demonstrates proper interpolation usage: {t('已添加 {{count}} 张图片', { count: imageUrls.length })}. This follows react-i18next best practices for dynamic content.

Also applies to: 33-33, 61-107

web/src/components/auth/TwoFAVerification.jsx (1)

29-29: LGTM! 2FA verification component fully internationalized.

All user-facing strings including error messages, labels, placeholders, button text, and instructions are properly localized. The minor structural adjustments (additional <br /> tags at lines 146-151) are appropriate for maintaining proper text layout across different languages.

Also applies to: 34-34, 41-244

web/src/components/playground/CustomRequestEditor.jsx (2)

29-29: LGTM! Correct i18n setup.

The useTranslation hook is properly imported and used, following react-i18next best practices.

Also applies to: 38-38


126-126: LGTM! Comprehensive i18n coverage.

All user-facing strings are properly wrapped with t() calls, including labels, placeholders, button text, and validation messages. The use of naturalistic keys (Chinese text as translation keys) is a valid and common i18next pattern.

Also applies to: 132-133, 143-145, 155-155, 162-162, 169-169, 182-182, 190-190, 206-206

web/src/components/settings/SystemSetting.jsx (1)

733-733: LGTM! Consistent i18n additions.

All newly translated strings (placeholders and labels) are properly wrapped with t() calls and follow the existing i18n pattern in the file. The changes are consistent and correct.

Also applies to: 740-740, 1204-1204, 1218-1218, 1286-1286, 1457-1458

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
web/src/i18n/locales/en.json (1)

851-856: Swap “Weak/Strong Variation” labels (reversed).

“弱变换” should be “Low Variation” and “强变换” should be “High Variation”. They are inverted now.

- "弱变换": "High Variation",
+ "弱变换": "Low Variation",
...
- "强变换": "Low Variation",
+ "强变换": "High Variation",
♻️ Duplicate comments (1)
web/src/i18n/locales/fr.json (1)

447-448: Previously flagged missing FR translations are now filled — looks good.

“其他详情”, “对免费模型启用预消耗”, plural forms for “已添加 {{count}} 张图片…”, and the help text “开启后,对免费模型…” are populated. This restores visible labels/toasts.

Also applies to: 735-736, 805-809, 842-842

🧹 Nitpick comments (9)
web/src/i18n/locales/fr.json (1)

138-138: Avoid sentence fragments and leading spaces; use a single key with placeholders.

Current strings rely on manual concatenation (“Stripe … veuillez” + “cliquez ici” + “Ouvrir dans un nouvel onglet”) and leading spaces (“ pour effectuer vos essais.”), which is fragile and can break spacing/RTL. Prefer one full sentence with placeholders for links.

Example (one key):

  • "stripe.help": "Pour les paramètres Stripe (clés, Webhook), {{link}} (s’ouvre dans un nouvel onglet)."

Also applies to: 623-623, 1368-1369, 1971-1973

web/src/i18n/locales/en.json (4)

1584-1584: Polish wording for “统一的”.

“The Unified” is unnatural; use “Unified”.

- "统一的": "The Unified",
+ "统一的": "Unified",

139-139: Avoid fragment concatenation and leading spaces; prefer one sentence with placeholders.

“Stripe … please” + “click here” + “Open in new tab”, plus values starting with a space (“ for testing.”, “ to configure them—…”) are brittle. Compose as a single translation with placeholders (no leading/trailing spaces).

Example:

  • "stripe.help": "For Stripe keys and webhook settings, {{link}} (opens in a new tab)."

Also applies to: 623-623, 1368-1369, 1971-1973


673-673: Terminology nit.

“LLMs API Gateway” → “LLM API Gateway” is more idiomatic.

- "大模型接口网关": "LLMs API Gateway",
+ "大模型接口网关": "LLM API Gateway",

426-429: Remove unused _few/_many plural keys
i18next only recognizes one/other for English; you can prune entries like _few and _many in web/src/i18n/locales/en.json (e.g. lines 426–429) to reduce noise.

web/src/i18n/locales/zh.json (4)

426-429: Simplify zh pluralization to only _other

Chinese has a single plural category. Keeping _one/_few/_many adds noise and maintenance without benefit. Retain only _other for zh keys like “共 {{count}} 个密钥…”, “已为 {{count}} 个模型…”, “已删除 {{count}} 条失效兑换码…”, “已新增 {{count}} 个模型…”, “已选择 {{count}} 个模型…”.

Also applies to: 760-763, 773-776, 796-799, 820-823


138-138: Avoid concatenating translatable fragments; use Trans with placeholders

Phrases like “Stripe 密钥、Webhook 等设置请” + “点击此处” (and similar “... 填:” + URL) rely on runtime concatenation, which breaks grammar in some languages. Prefer a single message with markup placeholders and react‑i18next Trans.

Example:

  • zh.json: "stripe.settings.cta": "Stripe 密钥、Webhook 等设置请 <1>点击此处</1>"
  • JSX: <Trans i18nKey="stripe.settings.cta">Stripe 密钥… <a href={url}>点击此处</a></Trans>

Also applies to: 1363-1363, 153-153, 601-601, 2068-2068


1971-1973: Incomplete sentence fragments; merge into a single translatable string

“进行测试。” and “进行设置,最好先在” appear as fragments likely concatenated with a link. Merge into one key with a link placeholder via Trans to avoid grammar issues in other locales.


1425-1425: Consolidate '登录成功' translation keys
zh.json defines both "登录成功" and "登录成功!". Remove one key and handle punctuation uniformly in the UI via a single canonical translation.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7b48fd8 and c54fb80.

📒 Files selected for processing (4)
  • web/src/i18n/locales/en.json (46 hunks)
  • web/src/i18n/locales/fr.json (46 hunks)
  • web/src/i18n/locales/ru.json (41 hunks)
  • web/src/i18n/locales/zh.json (46 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • web/src/i18n/locales/ru.json

"当运行通道全部测试时,超过此时间将自动禁用通道": "Lors de l'exécution de tous les tests de canaux, le canal sera automatiquement désactivé lorsque ce temps sera dépassé",
"待使用收益": "Produits à utiliser",
"微信": "WeChat",
"微信二维码": "QR code WeChat",
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix French for “微信二维码”.

Use “Code QR WeChat” (French) instead of the current English “QR code WeChat”.

-"微信二维码": "QR code WeChat",
+"微信二维码": "Code QR WeChat",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"微信二维码": "QR code WeChat",
"微信二维码": "Code QR WeChat",
🤖 Prompt for AI Agents
In web/src/i18n/locales/fr.json around line 874, the French translation for the
key "微信二维码" is currently "QR code WeChat"; replace that value with the correct
French "Code QR WeChat" by updating the JSON entry to use "Code QR WeChat" as
the translated string.

Comment on lines +760 to 763
"已为 {{count}} 个模型设置{{type}}_one": "已为 {{count}} 个模型设置{{type}}",
"已为 {{count}} 个模型设置{{type}}_few": "已为 {{count}} 个模型设置{{type}}",
"已为 {{count}} 个模型设置{{type}}_many": "已为 {{count}} 个模型设置{{type}}",
"已为 {{count}} 个模型设置{{type}}_other": "已为 {{count}} 个模型设置{{type}}",
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

🧩 Analysis chain

Interpolation style drift: ensure no ${var} remains in locale files

These lines correctly use {{count}}. Elsewhere in this file there are strings using ${count}/${name} which i18next won’t interpolate by default, leaking raw placeholders to users. Unify on {{...}} (or explicitly configure i18next to ${...} and update all locales consistently).

Run to locate problematic placeholders across all locales:


🏁 Script executed:

#!/bin/bash
# Find `${var}` placeholders in locale JSONs
fd -t f -E "node_modules" "locales" | xargs rg -nP '\$\{\s*[A-Za-z0-9_.]+\s*\}'

Length of output: 37611


Replace ${…} placeholders with {{…}} in all locale JSONs
Update every entry in web/src/i18n/locales/*.json that currently uses ${count}, ${name}, etc., to use i18next’s {{count}}, {{name}}, etc., since i18next won’t interpolate ${…} by default.

🤖 Prompt for AI Agents
In web/src/i18n/locales/zh.json around lines 760 to 763, the strings use `${…}`
placeholders which i18next won't interpolate; replace all `${count}`, `${type}`,
`${name}`, etc. with i18next-style `{{count}}`, `{{type}}`, `{{name}}` (apply
this change to both keys and values where present) across this file and all
files in web/src/i18n/locales/*.json, then run a quick translation rendering
test to confirm i18next interpolates correctly.

"条 - 第": "条 - 第",
"条,共": "条,共",
"条日志已清理!": "条日志已清理!",
"来源:": "来源:",
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Chinese punctuation: use full-width colon

Use “来源:” instead of “来源:”.

-"来源:"
+"来源:"

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In web/src/i18n/locales/zh.json around line 1170, the translation uses an ASCII
colon "来源:" but Chinese text should use a full-width colon; replace the value
key (and/or value if applicable) so the string reads "来源:" with a full-width
colon instead of ":".

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant