fix(i18n): fill missing translations in i18n. - #2314
Conversation
WalkthroughReplaced hard-coded Chinese UI strings in a task-logs modal with react-i18next Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
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: 2
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)
847-851: Correct swapped translations for Weak/Strong variation.“弱变换” = Weak/Low variation; “强变换” = Strong/High variation. They’re reversed.
- "弱变换": "High Variation", + "弱变换": "Low Variation", ... - "强变换": "Low Variation", + "强变换": "High Variation",
🧹 Nitpick comments (6)
web/src/i18n/locales/fr.json (3)
444-446: French pluralization: drop _many, keep one/other.FR uses one/other in i18next. Keeping _many is unused noise and risks inconsistency.
Also applies to: 781-783
13-13: Polish awkward French phrases.
- Line 13: “, time:” → “, heure :”
- Line 682: “API LLM Unifiée” → “Passerelle d’API LLM”
- Line 1595: “La Passerelle” (for “统一的”) is unclear standalone; prefer “Unifié” or integrate into the full phrase where used.
Also applies to: 682-682, 1595-1595
84-84: Standardize currency labels.
- Line 84: “EUR (Euro)” → “EUR (euro)”
- Line 155: “USD (Dollar US)” → “USD (dollar américain)”
- Line 1639 is fine (“Dollar américain”).
Also applies to: 155-155, 1639-1639
web/src/i18n/locales/en.json (2)
1585-1585: Clarify “统一的” wording.“The Unified” is unnatural. Prefer “Unified” or incorporate into the full noun phrase (e.g., “Unified Gateway”) to match UI context.
73-75: Neutral, consistent Creem copy; pluralize “Settings”.Use neutral tone and consistent labels.
- "Creem 介绍": "Creem is the payment partner you always deserved, we strive for simplicity and straightforwardness on our APIs.", - "Creem 充值": "Creem Recharge", - "Creem 设置": "Creem Setting", + "Creem 介绍": "Creem introduction", + "Creem 充值": "Creem top-up", + "Creem 设置": "Creem Settings",web/src/components/table/task-logs/modals/ContentModal.jsx (1)
57-59: Consider addingnoopener,noreferrerwhen opening new tab.To avoid the opened page gaining a handle on
window.opener, you can harden the new‑tab logic:- window.open(modalContent, '_blank'); + window.open(modalContent, '_blank', 'noopener,noreferrer');This is optional but improves security when URLs may not be fully trusted.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
web/src/components/table/task-logs/modals/ContentModal.jsx(4 hunks)web/src/i18n/locales/en.json(54 hunks)web/src/i18n/locales/fr.json(52 hunks)web/src/i18n/locales/ru.json(52 hunks)web/src/i18n/locales/zh.json(52 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
web/src/components/table/task-logs/modals/ContentModal.jsx (11)
web/src/components/table/channels/modals/EditChannelModal.jsx (1)
useTranslation(122-122)web/src/components/settings/SystemSetting.jsx (1)
useTranslation(47-47)web/src/hooks/model-pricing/useModelPricingData.jsx (1)
useTranslation(28-28)web/src/components/topup/index.jsx (1)
useTranslation(43-43)web/src/hooks/channels/useChannelsData.jsx (1)
useTranslation(40-40)web/src/components/common/modals/TwoFactorAuthModal.jsx (1)
useTranslation(48-48)web/src/pages/Setting/Operation/SettingsGeneral.jsx (1)
useTranslation(43-43)web/src/pages/Setting/Operation/SettingsMonitoring.jsx (1)
useTranslation(33-33)web/src/pages/Setting/Ratio/ModelRatioSettings.jsx (1)
useTranslation(54-54)web/src/pages/Setting/Payment/SettingsPaymentGateway.jsx (1)
useTranslation(33-33)web/src/hooks/task-logs/useTaskLogsData.js (1)
useTranslation(35-35)
🔇 Additional comments (5)
web/src/i18n/locales/en.json (1)
21-41: I'm unable to access the repository to perform the verification. The clone operation failed in the sandbox environment. Additionally, the review comment itself appears incomplete:
- The shell script template is malformed - it contains a placeholder (
sed -n '1,9999p' /dev/null) that doesn't reference actual comparison logic- The FR comment reference is unclear - the comment mentions "Reuse the script from the FR comment" but doesn't provide sufficient context about what that script does
- Missing context - Without access to both
en.jsonand the French locale file (fr.json), I cannot verify:
- Placeholder consistency between EN and FR (e.g., {{breakdown}}, {{ratioType}}, {{ratio}}, etc.)
- Missing translation keys
- Placeholder mismatch issues
To complete this verification, I would need:
- The actual comparison script used in the FR comment
- Access to both the English and French locale files
- Clarification on what specific parity checks should be performed
web/src/i18n/locales/fr.json (1)
23-41: Verify placeholder parity with EN and within FR to prevent runtime "undefined" placeholders.Execute this script locally to ensure every translation key preserves exact placeholder sets from English:
#!/bin/bash set -euo pipefail EN=web/src/i18n/locales/en.json FR=web/src/i18n/locales/fr.json jq -r '.translation | to_entries[] | [.key,.value] | @tsv' "$EN" > /tmp/en.tsv jq -r '.translation | to_entries[] | [.key,.value] | @tsv' "$FR" > /tmp/fr.tsv cut -f1 /tmp/en.tsv | sort > /tmp/en.keys cut -f1 /tmp/fr.tsv | sort > /tmp/fr.keys echo "=== Missing in FR (present in EN) ===" comm -23 /tmp/en.keys /tmp/fr.keys | sed 's/^/ /' || true echo "=== Extra in FR (not in EN) ===" comm -13 /tmp/en.keys /tmp/fr.keys | sed 's/^/ /' || true python - << 'PY' import re def ph(s): return sorted(set(re.findall(r'{{\s*([^}\s]+)\s*}}', s or ''))) en, fr = {}, {} for line in open('/tmp/en.tsv','r',encoding='utf-8'): k,v = line.rstrip('\n').split('\t',1) en[k]=v for line in open('/tmp/fr.tsv','r',encoding='utf-8'): k,v = line.rstrip('\n').split('\t',1) fr[k]=v common = sorted(set(en)&set(fr)) mismatch = [(k, ph(en[k]), ph(fr[k])) for k in common if ph(en[k]) != ph(fr[k])] if mismatch: print("=== Placeholder mismatches (EN vs FR) ===") for k, pe, pf in mismatch: print(f"* {k}\n EN: {pe}\n FR: {pf}") else: print("No placeholder mismatches.") PYApplies to: 23-41, 967-973, 1599-1617.
web/src/i18n/locales/ru.json (1)
25-42: New RU translations keep placeholders aligned and cover new UI flows.The added/updated Russian entries for pricing/cache templates, product/Creem/Discord texts, pluralised model/token messages, and the video‑error + action strings all preserve the same interpolation variables as their keys and appear semantically consistent. I don’t see any i18n or placeholder‑related issues here.
Also applies to: 233-238, 447-450, 786-789, 975-981, 1610-1628
web/src/components/table/task-logs/modals/ContentModal.jsx (1)
23-24: i18n wiring inContentModallooks correct and consistent.Using
useTranslationand replacing the six hard‑coded Chinese messages witht('…')calls is consistent with the rest of the codebase, and the keys you use here are present in the locale files (including the new zh/ru entries). Modal behavior is otherwise unchanged.Also applies to: 33-34, 69-100
web/src/i18n/locales/zh.json (1)
19-36: ZH locale additions keep interpolation safe and align with new UI/i18n usage.The added/updated Chinese entries for dynamic pricing/cache templates, Creem & Discord settings, product configuration, billing/currency labels, and the video‑error + action strings all preserve their
{{...}}placeholders and match the keys used in the React code. Everything looks consistent and ready for multi‑locale use.Also applies to: 68-80, 227-232, 673-674, 948-954, 1577-1595, 1663-1666, 1744-1745, 1920-1921, 2050-2058
| @@ -1883,12 +1974,14 @@ | |||
| "输出 {{completion}} tokens / 1M tokens * {{symbol}}{{compPrice}}) * {{ratioType}} {{ratio}}": "Output {{completion}} tokens / 1M tokens * {{symbol}}{{compPrice}}) * {{ratioType}} {{ratio}}", | |||
There was a problem hiding this comment.
Fix stray parenthesis in output pricing template.
Remove the extra “)”.
- "输出 {{completion}} tokens / 1M tokens * {{symbol}}{{compPrice}}) * {{ratioType}} {{ratio}}": "Output {{completion}} tokens / 1M tokens * {{symbol}}{{compPrice}}) * {{ratioType}} {{ratio}}",
+ "输出 {{completion}} tokens / 1M tokens * {{symbol}}{{compPrice}} * {{ratioType}} {{ratio}}": "Output {{completion}} tokens / 1M tokens * {{symbol}}{{compPrice}} * {{ratioType}} {{ratio}}",🤖 Prompt for AI Agents
In web/src/i18n/locales/en.json around line 1974, the output pricing template
contains a stray closing parenthesis before the asterisk — remove the extra “)”
so the translated string reads without the unmatched parenthesis, preserving the
existing interpolation tokens and spacing.
| @@ -1892,12 +1984,14 @@ | |||
| "输出 {{completion}} tokens / 1M tokens * {{symbol}}{{compPrice}}) * {{ratioType}} {{ratio}}": "Sortie {{completion}} tokens / 1M tokens * {{symbol}}{{compPrice}}) * {{ratioType}} {{ratio}}", | |||
There was a problem hiding this comment.
Fix stray parenthesis in pricing template.
Extra “)” in “输出 … {{compPrice}}) …” will render incorrectly. Remove it.
- "输出 {{completion}} tokens / 1M tokens * {{symbol}}{{compPrice}}) * {{ratioType}} {{ratio}}": "Prix de sortie : {{completion}} tokens / 1M tokens * {{symbol}}{{compPrice}}) * {{ratioType}} {{ratio}}",
+ "输出 {{completion}} tokens / 1M tokens * {{symbol}}{{compPrice}} * {{ratioType}} {{ratio}}": "Prix de sortie : {{completion}} tokens / 1M tokens * {{symbol}}{{compPrice}} * {{ratioType}} {{ratio}}",Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In web/src/i18n/locales/fr.json around line 1984, the translated pricing string
contains an extra closing parenthesis after {{compPrice}}; remove the stray “)”
so the sentence structure and token/pricing variables render correctly (ensure
spacing and punctuation remain correct after removal).
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (2)
web/src/i18n/locales/fr.json (1)
1984-1984: Fix stray “)” in pricing key (must match across locales).Key contains an extra “)”, which will break lookups. Remove it here (and keep the value unchanged).
- "输出 {{completion}} tokens / 1M tokens * {{symbol}}{{compPrice}}) * {{ratioType}} {{ratio}}": "Sortie {{completion}} tokens / 1M tokens * {{symbol}}{{compPrice}} * {{ratioType}} {{ratio}}", + "输出 {{completion}} tokens / 1M tokens * {{symbol}}{{compPrice}} * {{ratioType}} {{ratio}}": "Sortie {{completion}} tokens / 1M tokens * {{symbol}}{{compPrice}} * {{ratioType}} {{ratio}}",web/src/i18n/locales/en.json (1)
1974-1974: Fix stray “)” in pricing key (must match across locales).Remove the extra “)” in the key to keep interpolation templates consistent.
- "输出 {{completion}} tokens / 1M tokens * {{symbol}}{{compPrice}}) * {{ratioType}} {{ratio}}": "Output {{completion}} tokens / 1M tokens * {{symbol}}{{compPrice}} * {{ratioType}} {{ratio}}", + "输出 {{completion}} tokens / 1M tokens * {{symbol}}{{compPrice}} * {{ratioType}} {{ratio}}": "Output {{completion}} tokens / 1M tokens * {{symbol}}{{compPrice}} * {{ratioType}} {{ratio}}",
🧹 Nitpick comments (5)
web/src/i18n/locales/fr.json (3)
444-446: Pluralization for French: drop _many variants or map to i18next forms.French typically uses “one/other” only. Keeping “_many” adds noise and can be ignored by the plural rules.
If your i18next config uses default FR rules, consider deleting “_many” keys like these and retain “_one” and “_other” only.
155-155: French wording improvement.Prefer “USD (dollar américain)”.
- "USD (美元)": "USD (Dollar US)", + "USD (美元)": "USD (dollar américain)",
681-681: Term choice: “Passerelle d’API LLM” reads more idiomatic.Current: “API LLM Unifiée”. Suggest:
- "大模型接口网关": "API LLM Unifiée", + "大模型接口网关": "Passerelle d’API LLM",web/src/i18n/locales/en.json (2)
128-128: Terminology consistency: use “Top Up” instead of “Recharge”.Elsewhere the UI uses “Top Up”. Align for consistency.
- "Recharge Quota": "Recharge Quota", + "Recharge Quota": "Top Up Quota",
2000-2000: Consistency with “Top Up” phrasing.Match earlier “Top Up” usage.
- "选择充值套餐": "Choose a top-up package", + "选择充值套餐": "Choose a Top Up package",
# Conflicts: # web/src/i18n/locales/en.json # web/src/i18n/locales/fr.json # web/src/i18n/locales/ru.json # web/src/i18n/locales/zh.json
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (2)
web/src/i18n/locales/fr.json (1)
1984-1984: Stray “)” remains in the key; verify and fix consistently across locales.Key shows “…{{compPrice}}) *…”. If zh/en keys have been corrected (without “)”), update FR key too; otherwise keep key as‑is but ensure all values omit the extra “)”. Please verify repo-wide to avoid lookup mismatches.
#!/bin/bash # Find the pricing key with/without the stray paren across locales rg -nP '输出\s+\{\{completion\}\}.*\{\{compPrice\}\}\)\s*\*\s*\{\{ratioType\}\}\s*\{\{ratio\}\}' web/src/i18n/locales rg -nP '输出\s+\{\{completion\}\}.*\{\{compPrice\}\}\s*\*\s*\{\{ratioType\}\}\s*\{\{ratio\}\}' web/src/i18n/locales # Show zh source to decide which key is canonical rg -n '输出 {{completion}} tokens' web/src/i18n/locales/zh.jsonweb/src/i18n/locales/en.json (1)
1974-1974: Fix stray parenthesis in output pricing template (recurring issue).Line 1974 contains an extra closing parenthesis that was previously flagged but not corrected. The template has
{{compPrice}})instead of{{compPrice}}, creating an unmatched parenthesis in the output.Apply this diff to fix the stray parenthesis:
- "输出 {{completion}} tokens / 1M tokens * {{symbol}}{{compPrice}}) * {{ratioType}} {{ratio}}": "Output {{completion}} tokens / 1M tokens * {{symbol}}{{compPrice}}) * {{ratioType}} {{ratio}}" + "输出 {{completion}} tokens / 1M tokens * {{symbol}}{{compPrice}} * {{ratioType}} {{ratio}}": "Output {{completion}} tokens / 1M tokens * {{symbol}}{{compPrice}} * {{ratioType}} {{ratio}}"
🧹 Nitpick comments (3)
web/src/i18n/locales/fr.json (2)
1595-1595: French wording tweak for standalone label.“La Passerelle” is ambiguous out of context. Prefer “Passerelle unifiée” for clarity and parity with “API LLM Unifiée”.
-"统一的": "La Passerelle", +"统一的": "Passerelle unifiée",
155-155: French currency phrasing.Use “dollar américain” instead of “Dollar US” for idiomatic FR.
-"USD (美元)": "USD (Dollar US)", +"USD (美元)": "USD (dollar américain)",web/src/i18n/locales/ru.json (1)
1528-1528: Improve Russian wording for clarity.Make it explicit this is an exclusion list.
-"禁用思考处理的模型列表": "Список моделей без обработки thinking", +"禁用思考处理的模型列表": "Список моделей, исключённых из обработки thinking",
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
web/src/i18n/locales/en.json(54 hunks)web/src/i18n/locales/fr.json(52 hunks)web/src/i18n/locales/ru.json(51 hunks)web/src/i18n/locales/zh.json(51 hunks)
🔇 Additional comments (5)
web/src/i18n/locales/ru.json (1)
1995-1998: Remove stray ")" in output pricing template.The RU value shows an extra ")" after {{compPrice}}. Verify that the key in zh.json does not contain this extra ")" to prevent lookup breaks; if the key also has the stray ")", it must be updated alongside usages in the codebase.
web/src/i18n/locales/zh.json (1)
19-36: New translation entries well-integrated into zh.json.The Chinese locale has been consistently expanded with new keys for pricing calculations, Creem integration, Discord OAuth, and product configuration. All entries follow the existing JSON structure and maintain translation consistency with the English locale.
Also applies to: 42-42, 68-80, 151-151, 227-235
web/src/i18n/locales/en.json (3)
128-128: Unexpected key addition: "Recharge Quota" appears without corresponding Chinese key context.Line 128 introduces
"Recharge Quota": "Recharge Quota"which appears to be a placeholder or self-referential translation. Verify this key is intentional and properly paired with its Chinese locale equivalent.
442-443: Verify pluralization keys consistency across en.json.Several pluralization entries (using
_oneand_othersuffixes) have been added for model counts and token deletion confirmations. Ensure these pluralization rules align with i18next configuration and are properly supported by all consuming components.Also applies to: 777-778, 2000-2000
19-36: New translation keys properly added and formatted.The extensive additions for pricing templates, Creem and Discord integration, currency support, product configuration, and cache creation features are well-structured and consistent with the existing translation patterns. All new entries maintain proper JSON formatting and placeholder variable consistency (e.g.,
{{symbol}},{{price}},{{ratio}}).Also applies to: 42-42, 68-80, 151-156, 227-235, 382-382, 385-385, 442-443, 477-477, 491-491, 673-673, 759-759, 764-764, 816-816, 828-828, 838-838, 1073-1073, 1107-1107, 1154-1154, 1164-1164, 1174-1174, 1196-1196, 1205-1205, 1250-1250, 1307-1307, 1323-1323, 1328-1328, 1435-1435, 1456-1456, 1506-1506, 1584-1584, 1589-1589, 1595-1607, 1610-1610, 1617-1617, 1628-1628, 1692-1692, 1932-1932, 2000-2001, 2050-2050, 2063-2063, 2105-2105
| @@ -64,17 +71,25 @@ | |||
| "Client ID": "ID клиента", | |||
| "Client Secret": "Секрет клиента", | |||
| "common.changeLanguage": "common.changeLanguage", | |||
There was a problem hiding this comment.
Untranslated value.
Translate “common.changeLanguage”.
-"common.changeLanguage": "common.changeLanguage",
+"common.changeLanguage": "Сменить язык",📝 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.
| "common.changeLanguage": "common.changeLanguage", | |
| "common.changeLanguage": "Сменить язык", |
🤖 Prompt for AI Agents
In web/src/i18n/locales/ru.json around line 73, the value for
"common.changeLanguage" is currently the untranslated key; replace it with the
correct Russian translation (for example "Изменить язык" or "Сменить язык") so
the UI shows a proper localized string, ensuring you keep valid JSON string
quoting and commas as needed.
fix(i18n): fill missing translations in i18n.
fix(i18n): fill missing translations in i18n.
…-nan Fix/payment result nan
Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.