Skip to content

feat(i18n): 支持官网、桌面端与管理端多语言#209

Merged
ryan-wong-coder merged 1 commit into
mainfrom
feat/i18n-localized-clients
Jul 20, 2026
Merged

feat(i18n): 支持官网、桌面端与管理端多语言#209
ryan-wong-coder merged 1 commit into
mainfrom
feat/i18n-localized-clients

Conversation

@ryan-wong-coder

Copy link
Copy Markdown
Collaborator

改动内容

  • 官网、桌面客户端和管理端加入中文、英文、俄文、日文、法文、韩文切换
  • 根据浏览器语言自动选择界面语言,并在本地保存用户选择
  • 桌面端首次引导同步支持多语言
  • 官网首页根据当前语言展示由真实客户端代码渲染的对应语言截图
  • 移除桌面端尚未支持的主题设置入口
  • 增加 TrustDB 浏览器页签图标

影响

用户可以在三套界面中统一切换语言;官网展示的客户端画面会和官网语言保持一致。

验证

  • website: npm run build
  • clients/desktop/frontend: npm run build
  • clients/web: npm run build
  • clients/web: npm run test:unit(10 个测试文件、26 项测试通过)
  • git diff --check

@ryan-wong-coder
ryan-wong-coder merged commit 5bd5c0d into main Jul 20, 2026
13 of 14 checks passed
@ryan-wong-coder
ryan-wong-coder deleted the feat/i18n-localized-clients branch July 20, 2026 04:49

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cb0cdc03ca

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +183 to +184
for (const [original, translated] of sortedEntries) {
if (original.length > 1 && output.includes(original)) output = output.split(original).join(translated)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Stop translating dynamic evidence names

Because the DOM translator is installed on the whole document and this loop replaces any matching Chinese substring in every text node, user data rendered by the app is translated too. For example, the desktop records list renders r.file_name/r.file_path as plain text, and a real evidence file named 测试存证.txt will be displayed as sample-evidence.txt in English because that string is in the message table; paths or tenant/client names containing UI words can be altered the same way. That makes the UI show different evidence metadata from what was actually submitted, so dynamic record data needs to be excluded or translations need to be applied only to explicit UI copy.

Useful? React with 👍 / 👎.

Comment thread website/src/i18n/index.js
const saved = localStorage.getItem(storageKey);
if (saved && supported.has(saved)) return saved;
} catch { /* local storage can be unavailable in embedded shells */ }
return normalizeLocale(navigator.languages?.[0] || navigator.language);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Honor secondary browser language preferences

This only consults navigator.languages[0], so users whose primary browser locale is unsupported but whose next preference is supported, such as ['de-DE', 'en-US'], fall all the way back to Simplified Chinese instead of English. Since the feature is supposed to choose from the browser language preferences automatically, iterate the full navigator.languages list and select the first supported normalized locale before defaulting to zh-CN.

Useful? React with 👍 / 👎.

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