Skip to content

fix(i18n): resolve code review issues for PR #1318 - #1323

Closed
clousky2020 wants to merge 1 commit into
cheaper-inference:mainfrom
clousky2020:feat/i18n-clean
Closed

clousky2020 wants to merge 1 commit into
cheaper-inference:mainfrom
clousky2020:feat/i18n-clean

Conversation

@clousky2020

Copy link
Copy Markdown
Contributor

Summary

修复 PR #1318 代码审查反馈中指出的所有问题:

  • 修复 zh-CN.json 中路由策略 guidance 和 recommendations 翻译重复问题
  • 添加 useMemo 导入到 playground/page.tsx(性能优化)
  • 添加 useMemo 到 RequestLoggerV2.tsx(性能优化)
  • 修复 ProxyConfigModal.tsx 中的硬编码字符串本地化问题
  • 使用 t.rich 替换 dangerouslySetInnerHTML(OAuthModal.tsx、PricingModal.tsx)
  • 添加缺失的翻译命名空间到 en.json

Test plan

  • 本地测试 Playground 页面正常加载
  • 本地测试 Combos 页面正常加载
  • 本地测试 Logs 页面正常加载
  • ESLint 和 Prettier 检查通过

🤖 Generated with Claude Code

- Fix duplicate routing strategy guidance texts in zh-CN.json
- Fix strategy recommendations duplicates
- Add useMemo import in playground/page.tsx
- Add hardcoded string localization in ProxyConfigModal.tsx
- Replace dangerouslySetInnerHTML with t.rich in OAuthModal.tsx
- Replace dangerouslySetInnerHTML with t.rich in PricingModal.tsx
- Add useMemo in RequestLoggerV2.tsx for performance

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

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

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.

Code Review

This pull request updates strategy guidance descriptions, refactors component logic to use useMemo for performance optimization, and transitions from dangerouslySetInnerHTML to t.rich for safer translation rendering. It also introduces a significant number of new translation keys for various dashboard modules. Review feedback identifies missing cacheSource and tps columns in the RequestLoggerV2 component and their associated translation entries in the English locale file.

Comment on lines +130 to +145
const columns = useMemo(
() => [
{ key: "status", label: t("columns.status") },
{ key: "model", label: t("columns.model") },
{ key: "requestedModel", label: t("columns.requested") },
{ key: "provider", label: t("columns.provider") },
{ key: "protocol", label: t("columns.protocol") },
{ key: "account", label: t("columns.account") },
{ key: "apiKey", label: t("columns.apiKey") },
{ key: "combo", label: t("columns.combo") },
{ key: "tokens", label: t("columns.tokens") },
{ key: "duration", label: t("columns.duration") },
{ key: "time", label: t("columns.time") },
],
[t]
);

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

在 columns 的 useMemo 中缺少了 cacheSource 和 tps 列。这会导致这些列在 UI 中无法显示或切换(因为 defaultVisible 和列切换按钮都依赖于此数组),尽管表格逻辑中已经包含了它们。建议同步 COLUMNS 常量中的定义。

Suggested change
const columns = useMemo(
() => [
{ key: "status", label: t("columns.status") },
{ key: "model", label: t("columns.model") },
{ key: "requestedModel", label: t("columns.requested") },
{ key: "provider", label: t("columns.provider") },
{ key: "protocol", label: t("columns.protocol") },
{ key: "account", label: t("columns.account") },
{ key: "apiKey", label: t("columns.apiKey") },
{ key: "combo", label: t("columns.combo") },
{ key: "tokens", label: t("columns.tokens") },
{ key: "duration", label: t("columns.duration") },
{ key: "time", label: t("columns.time") },
],
[t]
);
const columns = useMemo(
() => [
{ key: "status", label: t("columns.status") },
{ key: "cacheSource", label: t("columns.cacheSource") },
{ key: "model", label: t("columns.model") },
{ key: "requestedModel", label: t("columns.requested") },
{ key: "provider", label: t("columns.provider") },
{ key: "protocol", label: t("columns.protocol") },
{ key: "account", label: t("columns.account") },
{ key: "apiKey", label: t("columns.apiKey") },
{ key: "combo", label: t("columns.combo") },
{ key: "tokens", label: t("columns.tokens") },
{ key: "tps", label: t("columns.tps") },
{ key: "duration", label: t("columns.duration") },
{ key: "time", label: t("columns.time") },
],
[t]
);

Comment thread src/i18n/messages/en.json
Comment on lines +3557 to +3569
"columns": {
"status": "Status",
"model": "Model",
"requested": "Requested",
"provider": "Provider",
"protocol": "Request Protocol",
"account": "Account",
"apiKey": "API Key",
"combo": "Combo",
"tokens": "Tokens",
"duration": "Duration",
"time": "Time"
},

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

requestLogger.columns 命名空间中缺少 cacheSource 和 tps 的翻译。建议添加以支持多语言显示并与代码逻辑保持一致。

Suggested change
"columns": {
"status": "Status",
"model": "Model",
"requested": "Requested",
"provider": "Provider",
"protocol": "Request Protocol",
"account": "Account",
"apiKey": "API Key",
"combo": "Combo",
"tokens": "Tokens",
"duration": "Duration",
"time": "Time"
},
"columns": {
"status": "Status",
"cacheSource": "Cache Source",
"model": "Model",
"requested": "Requested",
"provider": "Provider",
"protocol": "Request Protocol",
"account": "Account",
"apiKey": "API Key",
"combo": "Combo",
"tokens": "Tokens",
"tps": "TPS",
"duration": "Duration",
"time": "Time"
},

This was referenced Apr 30, 2026
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