From 4caec8dae99397688ace5d21d178f2ab4fe099f0 Mon Sep 17 00:00:00 2001 From: Markus Date: Wed, 18 Nov 2026 21:04:43 +0100 Subject: [PATCH 1/2] feat(i18n): reconstruct PR6 on main and address locale review --- .gitignore | 3 + README.md | 1 + artifacts/pr6-description.md | 20 + artifacts/pr6-review-response.md | 46 ++ docs/api.md | 94 +++- e2e/app/built-locale.html | 10 + e2e/app/embed.html | 2 + e2e/app/main.tsx | 8 + e2e/embed.spec.ts | 30 ++ e2e/harness.ts | 4 +- e2e/locale-built.spec.ts | 282 +++++++++++ e2e/locale-docx.spec.ts | 23 + e2e/locale-xlsx.spec.ts | 21 + e2e/locale.spec.ts | 85 ++++ package.json | 4 + src/collab/react.tsx | 15 +- src/embed.ts | 25 +- src/index.ts | 1 + src/locales/de.ts | 2 + src/react/DocViewer.tsx | 114 ++--- src/react/comments/Comments.ts | 18 +- src/react/comments/CommentsPanel.tsx | 72 +-- src/react/common/Dialog.tsx | 9 +- src/react/common/ZoomControl.tsx | 12 +- src/react/docx/DocxToolbar.tsx | 231 ++++----- src/react/docx/DocxView.tsx | 129 ++--- src/react/docx/FindBar.tsx | 20 +- src/react/docx/HeaderFooterDialog.tsx | 60 ++- src/react/docx/PageSetupDialog.tsx | 82 ++-- src/react/docx/render.tsx | 14 +- src/react/edit/Toolbar.tsx | 21 +- src/react/file/DetailsDialog.tsx | 29 +- src/react/file/FileMenu.tsx | 58 ++- src/react/file/importFile.ts | 8 +- src/react/file/print.tsx | 13 +- src/react/picture/PictureView.tsx | 8 +- src/react/pptx/PptxToolbar.tsx | 216 ++++----- src/react/pptx/PptxView.tsx | 66 +-- src/react/pptx/Slide.tsx | 10 +- src/react/source/SourceEditor.tsx | 12 +- src/react/strings/de.ts | 635 +++++++++++++++++++++++++ src/react/strings/en.ts | 649 ++++++++++++++++++++++++++ src/react/strings/index.tsx | 74 +++ src/react/styles.css | 2 +- src/react/xlsx/XlsxToolbar.tsx | 225 ++++----- src/react/xlsx/XlsxView.tsx | 96 ++-- src/react/xlsx/drawings.tsx | 12 +- src/react/xlsx/print.tsx | 8 +- test/strings-render.test.tsx | 82 ++++ test/strings.test.ts | 103 ++++ vite.config.ts | 2 +- 51 files changed, 2993 insertions(+), 773 deletions(-) create mode 100644 artifacts/pr6-description.md create mode 100644 artifacts/pr6-review-response.md create mode 100644 e2e/app/built-locale.html create mode 100644 e2e/locale-built.spec.ts create mode 100644 e2e/locale-docx.spec.ts create mode 100644 e2e/locale-xlsx.spec.ts create mode 100644 e2e/locale.spec.ts create mode 100644 src/locales/de.ts create mode 100644 src/react/strings/de.ts create mode 100644 src/react/strings/en.ts create mode 100644 src/react/strings/index.tsx create mode 100644 test/strings-render.test.tsx create mode 100644 test/strings.test.ts diff --git a/.gitignore b/.gitignore index a410154..fd190e5 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,6 @@ playground/public/samples/large-* dist-site packages/*/LICENSE __pycache__ + +# Local production-localization validation logs and generated exports +/artifacts/pr6-validation/ diff --git a/README.md b/README.md index c65288b..134271c 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,7 @@ Also online at [p10node.github.io/office-engine](https://p10node.github.io/offic - **Comments**: threads with replies, resolve, edit / delete, @mentions; on DOCX text, XLSX cells and PPTX slides, stored in the file the way Word, Excel and PowerPoint store them - **Real-time collaboration**: live edits, avatars, collaborators' cursors, offline edits sync on reconnect - **Dark mode and theming**: `theme="dark"` or `"auto"` (follows the OS), or a theme object with design tokens for colors, type and shape ([Theming](docs/theming.md)); documents keep their own colors +- **Translatable UI**: every text of the bars, menus and dialogs from one typed table; only English bundled by default; German available through an optional import with `de-DE` formatting (see [UI texts](docs/api.md#ui-texts)); any text replaceable through `strings` - **Embed anywhere**: React component, hook, vanilla `mount()`, `` web component, single ` + + +``` + +Document content stays in its original language. Default new sheet names, the author "Me" and new text box content also stay unchanged; the “Page 1 of 5” header/footer preset inserts text in the UI language. Font names, formula names and help, number format previews, host-provided labels and engine/transport errors (including main-thread fetch errors such as `HTTP 404 while fetching …`, collaboration errors such as `Document is still syncing`, and parsing-worker messages) are not translated by the table. Print, PDF and HTML export inherit the active UI table for viewer-generated labels; document content remains unchanged. + ## Without a React build ```html @@ -205,7 +295,7 @@ import { IconsProvider, XlsxView } from '@p10node/office-engine' ``` -``: attributes `src`, `name`, `editable`, `toolbar="false"`, `thumbnails="false"`, `save="false"`, `download="false"`, `file-menu="false"`, `open="false"`, `capture-select-all="false"`, `theme="dark"` (or `"auto"`), `collab` / `room` / `user` / `base` (real-time collaboration; `user` also writes the comments), `comments="false"`; properties `.file = File` and `.icons` (map or resolver, as `icons` above); events `load`, `error`, `comment` (`detail`: a `CommentEvent`). +``: attributes `src`, `name`, `editable`, `toolbar="false"`, `thumbnails="false"`, `save="false"`, `download="false"`, `file-menu="false"`, `open="false"`, `capture-select-all="false"`, `theme="dark"` (or `"auto"`), `locale="en-GB"` (number/date formatting), `collab` / `room` / `user` / `base` (real-time collaboration; `user` also writes the comments), `comments="false"`; properties `.file = File`, `.icons` (map or resolver, as `icons` above) and `.strings = { … }` (see [UI texts](#ui-texts)); events `load`, `error`, `comment` (`detail`: a `CommentEvent`). ## Core API (no React) diff --git a/e2e/app/built-locale.html b/e2e/app/built-locale.html new file mode 100644 index 0000000..af1df32 --- /dev/null +++ b/e2e/app/built-locale.html @@ -0,0 +1,10 @@ + + +
+ + diff --git a/e2e/app/embed.html b/e2e/app/embed.html index 4608cef..a066139 100644 --- a/e2e/app/embed.html +++ b/e2e/app/embed.html @@ -9,6 +9,8 @@