Repository navigation
Draft: feat(i18n): Refactor Channel Modals (Lot 1) - #1907
comeback01 wants to merge 9 commits into
Conversation
- Création du fichier de traduction `fr.json` en se basant sur `en.json`. - Mise à jour de la configuration i18n pour inclure la langue française. - Modification du sélecteur de langue pour afficher l'option "Français" avec le drapeau correspondant.
- Création du fichier `README.fr.md` en se basant sur `README.en.md`.
- Added `common.changeLanguage` key to `en.json`, `fr.json`, and `zh.json`. - Updated `LanguageSelector.jsx` to use the new shared key. - Completed `fr.json` with all keys from `en.json` and `zh.json`. - Added translations for `closeSidebar`, `pricing`, and `language`.
- Restructured the `common.changeLanguage` key to be nested under a `common` object in `en.json`, `fr.json`, and `zh.json`. - This change improves the organization of the translation files and aligns with best practices for i18next.
This addresses feedback from CodeRabbitAI by using a regular expression for the language button's aria-label. This ensures the test can run regardless of the browser's default language.
WalkthroughAdds French localization and documentation: new Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Dev as Developer
participant PW as Playwright Script
participant Browser
participant App as Web App
participant I18N as i18n Resources
Dev->>PW: Run verify_translation.py
PW->>Browser: Launch headless Chromium
Browser->>App: GET http://localhost:5173
App->>I18N: Initialize resources (zh, en, fr)
PW->>App: Click language button
PW->>App: Select "Français"
App->>I18N: Set locale = fr
I18N-->>App: Provide fr translation strings
App-->>PW: Render UI with French labels
PW->>PW: Assert label contains "Français"
PW->>Browser: Screenshot and close
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
web/src/components/table/channels/modals/EditTagModal.jsx (1)
288-296: Chinese literals slipped back into the new translationsLine 291 and Line 295 still hand i18next Chinese strings (
'已新增 {{count}} 个模型:{{list}}','未发现新增模型') as keys. Because those keys are not defined in en/fr locales, the UI will now show the original Chinese text instead of translated copy. Please switch to the namespaced keys you added in the locale files (e.g.,modals.tags.addedModels,modals.tags.noNewModelsFound) and port the messages into en/zh/fr to keep the modal localized.- showSuccess( - t('已新增 {{count}} 个模型:{{list}}', { + showSuccess( + t('modals.tags.addedModels', { count: addedModels.length, list: addedModels.join(', '), }), ); } else { - showInfo(t('未发现新增模型')); + showInfo(t('modals.tags.noNewModelsFound')); }web/src/components/table/channels/modals/MultiKeyManageModal.jsx (1)
333-352: Status chips still use Chinese literals as i18n keysLine 335 onward still calls
t('已启用')/t('已禁用')/t('自动禁用')/t('未知状态'). Because those keys are not defined in en/fr locales, the English and French UI will render Chinese text for status tags. Please replace them with the new namespaced keys (for examplemodals.multiKey.status.enabled, etc.) and ensure the locale files contain the translations.- {t('已启用')} + {t('modals.multiKey.status.enabled')} ... - {t('已禁用')} + {t('modals.multiKey.status.manualDisabled')} ... - {t('自动禁用')} + {t('modals.multiKey.status.autoDisabled')} ... - {t('未知状态')} + {t('modals.multiKey.status.unknown')}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
bun_output.logis excluded by!**/*.logpackage-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (11)
README.en.md(1 hunks)README.fr.md(1 hunks)README.md(1 hunks)jules-scratch/verification/verify_translation.py(1 hunks)web/src/components/layout/headerbar/LanguageSelector.jsx(2 hunks)web/src/components/table/channels/modals/EditChannelModal.jsx(81 hunks)web/src/components/table/channels/modals/EditTagModal.jsx(11 hunks)web/src/components/table/channels/modals/MultiKeyManageModal.jsx(26 hunks)web/src/i18n/i18n.js(2 hunks)web/src/i18n/locales/en.json(1 hunks)web/src/i18n/locales/zh.json(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-08-27T02:15:25.448Z
Learnt from: AAEE86
PR: QuantumNous/new-api#1658
File: web/src/components/table/channels/modals/EditChannelModal.jsx:555-569
Timestamp: 2025-08-27T02:15:25.448Z
Learning: In EditChannelModal.jsx, the applyModelMapping function transforms the models list by replacing original model names (mapping values) with display names (mapping keys). The database stores this transformed list containing mapped keys. On channel load, data.models contains these mapped display names, making the initialization filter if (data.models.includes(key)) correct.
Applied to files:
web/src/components/table/channels/modals/EditTagModal.jsxweb/src/components/table/channels/modals/EditChannelModal.jsxweb/src/components/table/channels/modals/MultiKeyManageModal.jsx
📚 Learning: 2025-08-27T02:15:25.448Z
Learnt from: AAEE86
PR: QuantumNous/new-api#1658
File: web/src/components/table/channels/modals/EditChannelModal.jsx:555-569
Timestamp: 2025-08-27T02:15:25.448Z
Learning: In EditChannelModal.jsx, the database stores mapped keys (display names) in the models field after applying model mapping transformations. When loading a channel, data.models contains the mapped keys, not the original model names. The filtering logic if (data.models.includes(key)) in the initialization is correct.
Applied to files:
web/src/components/table/channels/modals/EditTagModal.jsxweb/src/components/table/channels/modals/EditChannelModal.jsxweb/src/components/table/channels/modals/MultiKeyManageModal.jsx
🧬 Code graph analysis (3)
web/src/components/table/channels/modals/EditChannelModal.jsx (2)
web/src/helpers/utils.jsx (4)
showError(122-151)showSuccess(157-159)showInfo(161-163)copy(72-95)web/src/components/common/ui/JSONEditor.jsx (1)
JSONEditor(49-712)
web/src/components/layout/headerbar/LanguageSelector.jsx (1)
web/src/hooks/common/useHeaderBar.js (1)
currentLang(39-39)
web/src/components/table/channels/modals/MultiKeyManageModal.jsx (1)
web/src/helpers/utils.jsx (2)
showError(122-151)showSuccess(157-159)
🪛 markdownlint-cli2 (0.18.1)
README.fr.md
37-37: Blank line inside blockquote
(MD028, no-blanks-blockquote)
🔇 Additional comments (2)
web/src/components/layout/headerbar/LanguageSelector.jsx (1)
55-58: Good call localizing the trigger’s aria-labelSwitching to
t('common.changeLanguage')keeps the control accessible in every supported locale.web/src/i18n/locales/en.json (1)
2132-2324: LGTM! Namespaced channel modal strings look consistent.Placeholders and escaped characters all match the existing zh keys, so the new structure should wire up cleanly.
a3c565f to
425da9e
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
web/src/components/table/channels/modals/EditChannelModal.jsx(81 hunks)web/src/components/table/channels/modals/EditTagModal.jsx(11 hunks)web/src/components/table/channels/modals/MultiKeyManageModal.jsx(28 hunks)web/src/i18n/locales/en.json(1 hunks)web/src/i18n/locales/zh.json(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- web/src/components/table/channels/modals/EditTagModal.jsx
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-08-27T02:15:25.448Z
Learnt from: AAEE86
PR: QuantumNous/new-api#1658
File: web/src/components/table/channels/modals/EditChannelModal.jsx:555-569
Timestamp: 2025-08-27T02:15:25.448Z
Learning: In EditChannelModal.jsx, the applyModelMapping function transforms the models list by replacing original model names (mapping values) with display names (mapping keys). The database stores this transformed list containing mapped keys. On channel load, data.models contains these mapped display names, making the initialization filter if (data.models.includes(key)) correct.
Applied to files:
web/src/components/table/channels/modals/EditChannelModal.jsxweb/src/components/table/channels/modals/MultiKeyManageModal.jsx
📚 Learning: 2025-08-27T02:15:25.448Z
Learnt from: AAEE86
PR: QuantumNous/new-api#1658
File: web/src/components/table/channels/modals/EditChannelModal.jsx:555-569
Timestamp: 2025-08-27T02:15:25.448Z
Learning: In EditChannelModal.jsx, the database stores mapped keys (display names) in the models field after applying model mapping transformations. When loading a channel, data.models contains the mapped keys, not the original model names. The filtering logic if (data.models.includes(key)) in the initialization is correct.
Applied to files:
web/src/components/table/channels/modals/EditChannelModal.jsxweb/src/components/table/channels/modals/MultiKeyManageModal.jsx
🧬 Code graph analysis (2)
web/src/components/table/channels/modals/EditChannelModal.jsx (2)
web/src/helpers/utils.jsx (4)
showError(122-151)showSuccess(157-159)showInfo(161-163)copy(72-95)web/src/components/common/ui/JSONEditor.jsx (1)
JSONEditor(49-712)
web/src/components/table/channels/modals/MultiKeyManageModal.jsx (1)
web/src/helpers/utils.jsx (2)
showError(122-151)showSuccess(157-159)
| "modals.tags.modelMappingError": "模型映射必须是合法的 JSON 格式!", | ||
| "modals.tags.noChangesWarning": "没有任何修改!", | ||
| "modals.tags.tagUpdateSuccess": "标签更新成功!", | ||
| "modals.tags.edit": "编辑", | ||
| "modals.tags.editTag": "编辑标签", | ||
| "modals.tags.save": "保存", | ||
| "modals.tags.cancel": "取消", | ||
| "modals.tags.tagInfo": "标签信息", | ||
| "modals.tags.tagBasicConfig": "标签的基本配置", | ||
| "modals.tags.editWarning": "所有编辑均为覆盖操作,留空则不更改", | ||
| "modals.tags.tagName": "标签名称", | ||
| "modals.tags.newTagPlaceholder": "请输入新标签,留空则解散标签", | ||
| "modals.tags.modelConfig": "模型配置", | ||
| "modals.tags.modelSelectionAndMapping": "模型选择和映射设置", | ||
| "modals.tags.modelListWarning": "当前模型列表为该标签下所有渠道模型列表最长的一个,并非所有渠道的并集,请注意可能导致某些渠道模型丢失。", | ||
| "modals.tags.models": "模型", | ||
| "modals.tags.modelsPlaceholder": "请选择该渠道所支持的模型,留空则不更改", | ||
| "modals.tags.customModelName": "自定义模型名称", | ||
| "modals.tags.customModelNamePlaceholder": "输入自定义模型名称", | ||
| "modals.tags.add": "填入", | ||
| "modals.tags.modelMapping": "模型重定向", | ||
| "modals.tags.modelMappingPlaceholder": "此项可选,用于修改请求体中的模型名称,为一个 JSON 字符串,键为请求中模型名称,值为要替换的模型名称,留空则不更改", | ||
| "modals.tags.fillTemplate": "填入模板", | ||
| "modals.tags.clearRedirect": "清空重定向", | ||
| "modals.tags.noChange": "不更改", | ||
| "modals.tags.groupSettings": "分组设置", | ||
| "modals.tags.userGroupConfig": "用户分组配置", | ||
| "modals.tags.groups": "分组", | ||
| "modals.tags.groupsPlaceholder": "请选择可以使用该渠道的分组,留空则不更改", | ||
| "modals.tags.addGroupHint": "请在系统设置页面编辑分组倍率以添加新的分组:", | ||
| "modals.multiKey.getKeyStatusFailed": "获取密钥状态失败", | ||
| "modals.multiKey.keyDisabled": "密钥已禁用", | ||
| "modals.multiKey.disableKeyFailed": "禁用密钥失败", | ||
| "modals.multiKey.keyEnabled": "密钥已启用", | ||
| "modals.multiKey.enableKeyFailed": "启用密钥失败", | ||
| "modals.multiKey.allKeysEnabled": "已启用所有密钥", | ||
| "modals.multiKey.enableAllKeysFailed": "启用所有密钥失败", | ||
| "modals.multiKey.allKeysDisabled": "已禁用所有密钥", | ||
| "modals.multiKey.disableAllKeysFailed": "禁用所有密钥失败", | ||
| "modals.multiKey.deleteDisabledKeysFailed": "删除禁用密钥失败", | ||
| "modals.multiKey.keyDeleted": "密钥已删除", | ||
| "modals.multiKey.deleteKeyFailed": "删除密钥失败", | ||
| "modals.multiKey.columns.index": "索引", | ||
| "modals.multiKey.columns.status": "状态", | ||
| "modals.multiKey.columns.disableReason": "禁用原因", | ||
| "modals.multiKey.columns.disableTime": "禁用时间", | ||
| "modals.multiKey.columns.actions": "操作", | ||
| "modals.multiKey.actions.disable": "禁用", | ||
| "modals.multiKey.actions.enable": "启用", | ||
| "modals.multiKey.confirmDeleteKeyTitle": "确定要删除此密钥吗?", | ||
| "modals.multiKey.confirmDeleteKeyContent": "此操作不可撤销,将永久删除该密钥", | ||
| "modals.multiKey.actions.delete": "删除", | ||
| "modals.multiKey.title": "多密钥管理", | ||
| "modals.multiKey.totalKeys": "总密钥数", | ||
| "modals.multiKey.randomMode": "随机模式", | ||
| "modals.multiKey.pollingMode": "轮询模式", | ||
| "modals.multiKey.stats.enabled": "已启用", | ||
| "modals.multiKey.stats.manualDisabled": "手动禁用", | ||
| "modals.multiKey.stats.autoDisabled": "自动禁用", | ||
| "modals.multiKey.filters.allStatus": "全部状态", | ||
| "modals.multiKey.filters.enabled": "已启用", | ||
| "modals.multiKey.filters.manualDisabled": "手动禁用", | ||
| "modals.multiKey.filters.autoDisabled": "自动禁用", | ||
| "modals.multiKey.actions.refresh": "刷新", | ||
| "modals.multiKey.confirmEnableAllTitle": "确定要启用所有密钥吗?", | ||
| "modals.multiKey.actions.enableAll": "启用全部", | ||
| "modals.multiKey.confirmDisableAllTitle": "确定要禁用所有的密钥吗?", | ||
| "modals.multiKey.actions.disableAll": "禁用全部", | ||
| "modals.multiKey.confirmDeleteAutoDisabledTitle": "确定要删除所有已自动禁用的密钥吗?", | ||
| "modals.multiKey.confirmDeleteAutoDisabledContent": "此操作不可撤销,将永久删除已自动禁用的密钥", | ||
| "modals.multiKey.deleteAutoDisabledKeys": "删除自动禁用密钥", | ||
| "modals.multiKey.noKeyDataTitle": "暂无密钥数据", | ||
| "modals.multiKey.noKeyDataDescription": "请检查渠道配置或刷新重试" | ||
| } No newline at end of file |
There was a problem hiding this comment.
Restore zh translations for channel modal keys
EditChannelModal.jsx now replaces all hardcoded text with t('modals.channels.edit.*'), and en.json supplies those keys. However, zh.json still lacks the entire modals.channels.edit block, so the zh locale will fall back to English strings throughout the channel modal. Please port the original Chinese copy into matching modals.channels.edit.* entries (and keep it in sync with en/fr) to avoid a localized UI regression.
🤖 Prompt for AI Agents
In web/src/i18n/locales/zh.json around lines 39 to 112, the entire
"modals.channels.edit.*" translation block is missing causing zh to fall back to
English; restore the full set of keys matching en.json under
"modals.channels.edit" with the original Chinese strings (port the Chinese copy
previously used in the channel modal), keeping key names identical to en.json
and values as Chinese translations, then run the i18n lint/build or a quick UI
check to ensure the channel modal displays localized text.
Replaces hardcoded strings in EditChannelModal, MultiKeyManageModal, and EditTagModal. Adds i18n keys for English, Chinese, and French.
425da9e to
a91aaf2
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
web/src/components/table/channels/modals/EditTagModal.jsx (2)
274-279: Option item usestextinstead oflabel(will render blank labels).Semi UI
optionListexpects{ label, value }. Usingtextbreaks display and search.Apply this diff:
- localModelOptions.push({ - key: model, - text: model, - value: model, - }); + localModelOptions.push({ + key: model, + label: model, + value: model, + });
161-192: Add missingmodals.tags.*i18n entries to en.json and fr.json
All 31 keys referenced in EditTagModal.jsx (e.g. modals.tags.add, modals.tags.editTag, modals.tags.noChangesWarning, etc.) are present only in zh.json – they must be added undermodals.tagsin web/src/i18n/locales/en.json and fr.json to avoid raw-key fallbacks.
🧹 Nitpick comments (8)
web/src/components/table/channels/modals/MultiKeyManageModal.jsx (1)
350-353: Use a namespaced i18n key for “unknown status”.Avoid using a literal Chinese key. Add and use
modals.multiKey.stats.unknownfor consistency with the rest of this modal.Apply this diff:
- <Tag color='grey' shape='circle' size='small'> - {t('未知状态')} - </Tag> + <Tag color='grey' shape='circle' size='small'> + {t('modals.multiKey.stats.unknown')} + </Tag>web/src/components/table/channels/modals/EditTagModal.jsx (2)
288-296: Un-namespaced Chinese keys int(); usemodals.tags.*.Replace literal keys to keep the i18n surface consistent with this PR.
Apply this diff:
- showSuccess( - t('已新增 {{count}} 个模型:{{list}}', { + showSuccess( + t('modals.tags.addedModels', { count: addedModels.length, list: addedModels.join(', '), }), ); } else { - showInfo(t('未发现新增模型')); + showInfo(t('modals.tags.noNewModelsFound')); }Also applies to: 295-296
82-129: Dead code:type-based model presets don’t apply in Tag editing.The form never sets
type, so this branch never runs. Removing it reduces cognitive load.web/src/i18n/locales/en.json (4)
2351-2354: Add an i18n string for unknown key status.Used by MultiKeyManageModal’s default tag.
Apply this diff near other
modals.multiKey.stats.*keys:"modals.multiKey.stats.autoDisabled": "Auto disabled", + "modals.multiKey.stats.unknown": "Unknown status",
2218-2231: Add label key for “Account ID”.EditChannelModal currently hardcodes the label. Add the key so UI can localize it.
Apply this diff in the channels edit block:
+ "modals.channels.edit.accountId": "Account ID",
2131-2368: Ensure Tag modal keys exist (at least those newly referenced).If not already present, add minimal keys to back your changes in EditTagModal.
Apply this diff (minimal set):
+ "modals.tags": { + "addedModels": "Added {{count}} models: {{list}}", + "noNewModelsFound": "No new models were added", + "modelMappingError": "Model mapping must be valid JSON", + "noChangesWarning": "You seem to have not modified anything", + "tagUpdateSuccess": "Tag updated successfully", + "edit": "Edit", + "editTag": "Edit Tag", + "save": "Save", + "cancel": "Cancel", + "tagInfo": "Tag Information", + "tagBasicConfig": "Tag basic configuration", + "editWarning": "All edits overwrite existing settings; leave blank to keep unchanged.", + "tagName": "Tag Name", + "newTagPlaceholder": "Enter new tag name (leave unchanged to keep)", + "modelConfig": "Model Configuration", + "modelSelectionAndMapping": "Model selection and mapping", + "modelListWarning": "Selecting models will overwrite the tag's model list.", + "models": "Models", + "modelsPlaceholder": "Select models (leave empty to keep)", + "customModelName": "Custom model names", + "customModelNamePlaceholder": "Comma-separated model names", + "add": "Add", + "modelMapping": "Model mapping", + "modelMappingPlaceholder": "Optional JSON: { \"requested\": \"actual\" }", + "fillTemplate": "Fill template", + "clearRedirect": "Clear redirect", + "noChange": "No change", + "groupSettings": "Group Settings", + "userGroupConfig": "User Group Configuration", + "groups": "Groups", + "groupsPlaceholder": "Select groups (leave empty to keep)", + "addGroupHint": "Type to add a group" + },
1-2100: Mixed style: top-level Chinese keys and namespaced keys.Longer term, converge on namespaced English keys (
common.*,modals.*) to simplify maintenance and translation workflows.web/src/components/table/channels/modals/EditChannelModal.jsx (1)
1739-1745: Localize “Account ID” label.Use an i18n key and add it to locales (see en.json comment).
Apply this diff:
- label='Account ID' + label={t('modals.channels.edit.accountId')}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
web/src/components/table/channels/modals/EditChannelModal.jsx(81 hunks)web/src/components/table/channels/modals/EditTagModal.jsx(11 hunks)web/src/components/table/channels/modals/MultiKeyManageModal.jsx(28 hunks)web/src/i18n/locales/en.json(1 hunks)web/src/i18n/locales/zh.json(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-08-27T02:15:25.448Z
Learnt from: AAEE86
PR: QuantumNous/new-api#1658
File: web/src/components/table/channels/modals/EditChannelModal.jsx:555-569
Timestamp: 2025-08-27T02:15:25.448Z
Learning: In EditChannelModal.jsx, the applyModelMapping function transforms the models list by replacing original model names (mapping values) with display names (mapping keys). The database stores this transformed list containing mapped keys. On channel load, data.models contains these mapped display names, making the initialization filter if (data.models.includes(key)) correct.
Applied to files:
web/src/components/table/channels/modals/EditTagModal.jsxweb/src/components/table/channels/modals/EditChannelModal.jsx
📚 Learning: 2025-08-27T02:15:25.448Z
Learnt from: AAEE86
PR: QuantumNous/new-api#1658
File: web/src/components/table/channels/modals/EditChannelModal.jsx:555-569
Timestamp: 2025-08-27T02:15:25.448Z
Learning: In EditChannelModal.jsx, the database stores mapped keys (display names) in the models field after applying model mapping transformations. When loading a channel, data.models contains the mapped keys, not the original model names. The filtering logic if (data.models.includes(key)) in the initialization is correct.
Applied to files:
web/src/components/table/channels/modals/EditChannelModal.jsx
🧬 Code graph analysis (3)
web/src/components/table/channels/modals/EditTagModal.jsx (2)
web/src/helpers/utils.jsx (3)
showInfo(161-163)showWarning(153-155)showSuccess(157-159)web/src/components/table/channels/modals/EditChannelModal.jsx (2)
addCustomModels(970-1004)handleInputChange(289-364)
web/src/components/table/channels/modals/EditChannelModal.jsx (2)
web/src/helpers/utils.jsx (4)
showError(122-151)showSuccess(157-159)showInfo(161-163)copy(72-95)web/src/components/common/ui/JSONEditor.jsx (1)
JSONEditor(49-712)
web/src/components/table/channels/modals/MultiKeyManageModal.jsx (2)
web/src/helpers/utils.jsx (2)
showError(122-151)showSuccess(157-159)web/src/components/settings/RatioSetting.jsx (1)
onRefresh(90-99)
🔇 Additional comments (4)
web/src/components/table/channels/modals/MultiKeyManageModal.jsx (1)
611-619: Verify Select usesnullas an option value.Some Select implementations coerce
nulland can emit string"null"or treat it as uncontrolled. Confirm Semi UI behavior here; if flaky, switch to a sentinel like'all'and map it tonullbefore the API call.Also applies to: 612-619
web/src/components/table/channels/modals/EditChannelModal.jsx (2)
281-287: Two similar fields:settingvssettings. Verify intent.
setting(extra settings JSON) andsettings(other settings likeazure_responses_version) are both used. Confirm both are needed and documented to prevent future confusion.Also applies to: 438-457
221-231: Modal state reset looks solid.Nice comprehensive cleanup of form and 2FA states on close; reduces bleed-over between openings.
Also applies to: 744-746
web/src/i18n/locales/zh.json (1)
39-112: Still missingmodals.channels.edit.*translations
EditChannelModal.jsxnow readst('modals.channels.edit.*'), but zh.json still doesn’t define that namespace, so the entire channel modal falls back to English in Chinese locale. Please port the original Chinese strings (matching the key structure in en.json/fr.json) into amodals.channels.editblock to avoid the regression.
| isEdit | ||
| ? t('密钥(编辑模式下,保存的密钥不会显示)') | ||
| : t('密钥') | ||
| ? t('modals.channels.edit.keyEditMode') | ||
| : t('modals.channels.edit.key') | ||
| } | ||
| placeholder={t(type2secretPrompt(inputs.type))} | ||
| placeholder={t(type2secretPrompt(inputs.type, t))} | ||
| rules={ |
There was a problem hiding this comment.
Double-translation: avoid t(t('...')).
type2secretPrompt(type, t) already returns a localized string. Don’t pass it back into t().
Apply this diff:
- placeholder={t(type2secretPrompt(inputs.type, t))}
+ placeholder={type2secretPrompt(inputs.type, t)}📝 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.
| isEdit | |
| ? t('密钥(编辑模式下,保存的密钥不会显示)') | |
| : t('密钥') | |
| ? t('modals.channels.edit.keyEditMode') | |
| : t('modals.channels.edit.key') | |
| } | |
| placeholder={t(type2secretPrompt(inputs.type))} | |
| placeholder={t(type2secretPrompt(inputs.type, t))} | |
| rules={ | |
| } | |
| placeholder={type2secretPrompt(inputs.type, t)} | |
| rules={ |
🤖 Prompt for AI Agents
In web/src/components/table/channels/modals/EditChannelModal.jsx around lines
1569 to 1574, the placeholder value is being double-translated by calling
t(type2secretPrompt(inputs.type, t)); change it to use the already-localized
string returned by type2secretPrompt directly (i.e., pass the result as the
placeholder without wrapping it in t()), so set the placeholder to
type2secretPrompt(inputs.type, t).
`markdown
This PR is the first part of the i18n refactoring effort, as tracked in QuantumNous/new-api#XX.
This change handles "Lot 1", which focuses on the channel modal components.
Changes:
This is submitted as a draft to get early feedback on the refactoring approach before continuing with the next lots.
Summary by CodeRabbit
New Features
Internationalization
Documentation
Tests