Skip to content

fix(desktop): localize knowledge-base document display - #324

Merged
waterbro-8 merged 2 commits into
mainfrom
fix/knowledge-base-i18n
Sep 18, 2026
Merged

waterbro-8 merged 2 commits into
mainfrom
fix/knowledge-base-i18n

Conversation

@sun-970

@sun-970 sun-970 commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • File types show localized names (e.g., "Markdown 文档") instead of raw extensions ("MD")
  • File sizes use i18n keys with proper Chinese formatting ("9 字节" instead of "9 B")
  • Version timestamps formatted as locale-aware strings (e.g., "2026-08-02 08:58") instead of raw ISO
  • File names displayed without extensions in list and detail views
  • Added docs.fileType.* and docs.size* i18n keys for zh-CN and en

Context

This fixes the localization issues described in the knowledge-base document panel (记忆与协作 → 岗位文档 → 知识资料):

Before After
MD Markdown 文档
9 B 9 字节
版本 2026-08T08:58:50.178Z 更新于 2026-08-02 08:58
knowledge/1.md 1 (with knowledge/ as parent)

Scope

This PR focuses on localization fixes only. Document lifecycle operations (edit, rename, archive, delete) require server-side route additions and are tracked separately.

Test plan

  • docs-panel.test.tsx — all 7 tests pass
  • doc-viewer.test.tsx — all 12 tests pass
  • Manual verification in zh-CN and en locales

Closes: bytefolk/doc#64

- File types show localized names (e.g., "Markdown 文档") instead of
  raw extensions ("MD")
- File sizes use i18n keys with proper Chinese formatting ("9 字节"
  instead of "9 B")
- Version timestamps formatted as locale-aware strings (e.g.,
  "2026-08-02 08:58") instead of raw ISO
- File names displayed without extensions in list and detail views
- Added docs.fileType.* and docs.size* i18n keys for zh-CN and en

Closes: #64

@waterbro-8 waterbro-8 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed current head.

  • File type / size strings now go through i18n (docs.fileType.*, docs.size*) instead of raw extensions and B.
  • List and viewer hide the filename extension while keeping the full name on title.
  • Viewer timestamp uses a stable YYYY-MM-DD HH:mm style via toLocaleString.
  • Diff is limited to the knowledge-base panel/viewer plus locale catalogs.

Residual (non-blocking):

  • stripExtension is duplicated in DocsPanel and DocViewer.
  • toLocaleString(undefined, …) follows the runtime/OS locale, not the in-app zh/en catalog. Fine for this slice if the desktop shell already matches the UI language.
  • PR is still BEHIND main; needs an update-branch before merge.

Approve the localization slice.

@waterbro-8

Copy link
Copy Markdown
Collaborator

Approved. Kicked update-branch onto current main so this can leave BEHIND; waiting on that CI.

@waterbro-8
waterbro-8 merged commit 1b3eaca into main Sep 18, 2026
11 checks passed
@waterbro-8
waterbro-8 deleted the fix/knowledge-base-i18n branch September 18, 2026 07:27
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.

[Knowledge Base] Newly created documents cannot be edited or archived, and UI is not fully localized for Chinese

2 participants