Skip to content

fix(i18n): disable namespace separator to fix URL display in translations - #2530

Merged
seefs001 merged 1 commit into
QuantumNous:mainfrom
RedwindA:fix/i18n-with-http
Dec 26, 2025
Merged

seefs001 merged 1 commit into
QuantumNous:mainfrom
RedwindA:fix/i18n-with-http

Conversation

@RedwindA

@RedwindA RedwindA commented Dec 25, 2025 •

Copy link
Copy Markdown
Contributor

PR 类型

  • Bug 修复
  • 新功能
  • 文档更新
  • 其他

PR 是否包含破坏性更新?

  • 是
  • 否

PR 描述

修复 i18n 翻译中包含 URL 的字符串显示不完整的问题。
image
image

问题现象:
前端 placeholder 等文本中的 URL(如 https://api.openai.com/v1/chat/completions)只显示为 //api.openai.com/v1/chat/completions,丢失了 https: 部分。

问题原因:
i18next 默认使用 : 作为命名空间分隔符(nsSeparator)。当翻译字符串包含 https: 时,i18next 会将 https 解析为命名空间名称,将后面的部分作为翻译键,导致 https: 被截断。

修复方案:
在 i18n 配置中设置 nsSeparator: false,禁用命名空间分隔符功能。由于本项目只使用默认的 translation 命名空间,不使用多命名空间功能,此修改不会影响现有功能。

影响范围:
修复所有翻译文件中约 80 处包含 URL 的字符串显示问题。

…ions

i18next uses ':' as namespace separator by default, causing URLs like
'https://api.openai.com' to be incorrectly parsed as namespace 'https'
with key '//api.openai.com', resulting in truncated display.

Setting nsSeparator to false fixes this issue since the project doesn't
use multiple namespaces.
@coderabbitai

coderabbitai Bot commented Dec 25, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

A configuration option nsSeparator: false has been added to the i18n initialization settings in web/src/i18n/i18n.js, disabling the default namespace separator behavior for translation key resolution.

Changes

Cohort / File(s) Summary
i18n Configuration
web/src/i18n/i18n.js
Added nsSeparator: false to i18n.init config, disabling automatic namespace separator parsing in translation keys

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

A config tweak, so small and neat,
Namespace separation, bittersweet!
No more colons to parse and split,
Just keys and values, a perfect fit. 🐰✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: disabling the namespace separator in i18n configuration to fix URL display in translations, which matches the changeset's primary purpose.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d3c854f and f688581.

📒 Files selected for processing (1)
  • web/src/i18n/i18n.js
🔇 Additional comments (1)
web/src/i18n/i18n.js (1)

45-45: LGTM! Correctly fixes URL parsing in translations.

Setting nsSeparator: false appropriately disables i18next's default namespace separator, preventing URLs like https://api.openai.com/v1/chat/completions from being incorrectly parsed. This is the standard solution when namespaces are not used.

The codebase contains numerous URLs in translation strings across all language files and does not use namespace syntax in translation calls, confirming this change is safe.


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.

@seefs001
seefs001 merged commit a07406d into QuantumNous:main Dec 26, 2025
ennnnny pushed a commit to ennnnny/new-api that referenced this pull request Mar 17, 2026
jiutubaba pushed a commit to jiutubaba/fx-api that referenced this pull request May 17, 2026
…s-sse-terminal

修复 OpenAI Responses SSE 终止事件识别
salem-2007 added a commit to salem-2007/new-api that referenced this pull request Sep 10, 2026
junjundesk pushed a commit to junjundesk/new-api that referenced this pull request Oct 3, 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.

2 participants