Skip to content

UI: Traditional Chinese for the application shell - #552

Open
NikitkaRa wants to merge 1 commit into
storytold:mainfrom
NikitkaRa:cursor/zh-hant-shell-7e0f
Open

NikitkaRa wants to merge 1 commit into
storytold:mainfrom
NikitkaRa:cursor/zh-hant-shell-7e0f

Conversation

@NikitkaRa

Copy link
Copy Markdown
Contributor

Summary

  • Preferences offers System, English and 繁體中文. The choice is saved in the UI state and can also be set with app.language (system, en or zh-Hant).
  • System follows a zh-Hant, zh-TW, zh-HK or zh-MO locale and uses Taiwan vocabulary. Simplified Chinese (zh, zh-Hans, zh-CN, zh-SG) stays English. On the web build, System stays English until the user picks a language.
  • The choice translates the ribbon tabs, File menu, title bar, status bar and Preferences, 67 strings in all. Ribbon groups, the other dialogs and command ids stay English.

Test plan

  • Catalog tests check that ids are sorted, placeholder names match, zh-TW, zh-HK and zh-MO resolve to 繁體中文 while zh-CN does not, and an unknown saved code falls back to System.
  • A UI test checks that app.language zh-TW renames the File tab to 檔案 and Preferences to 偏好設定, that zh-Hans is rejected, and that en brings File back.
  • cargo fmt --check, cargo clippy --workspace --all-targets -- -D warnings, assets, layers and the wasm check pass.
  • cargo test --workspace passes, apart from three font tests that already fail here because craft-fonts is not installed: symbol_font_characters_draw_in_the_sym_font, korean_composes_in_the_notes_pane and cjk_text_in_the_interface_is_drawn_with_real_glyphs.
  • On a Mac set to 繁體中文, launch DeckCraft and check that the tabs and File menu come up in Traditional Chinese without opening Preferences.

Closes #109

anishguduru pushed a commit to anishguduru/deckcraft that referenced this pull request Oct 16, 2026
…g copied (storytold#552)

* M1: stream data read from a file points into the file instead of being copied

Every stream COS loaded was copied out of the document's bytes
(`data[start..end].to_vec()`) and kept in the object cache until the document
closed. Anything that reads every object therefore left a second copy of all
stream data behind. That includes a full save, which edits needing a rewrite
(repaired files, security changes, redaction) run on every change. A full save
of a 208 MB document left 208 MB cached on it.

`Stream::raw` is now `Bytes`: owned bytes, or a range of a larger shared
buffer. Streams parsed from a document's own bytes are ranges of that buffer,
which the document keeps anyway. Decrypted and newly built streams own their
bytes as before. A stream added to a document from another document's file gets
its own copy of just its bytes (`Document::set`/`add`), so it never keeps
another whole file alive.

Results, measured with an exact heap counter:
- A full save of a 208 MB document leaves 0.2 MB cached instead of 208.2 MB.
- The first full save of a freshly opened document is about twice as fast:
  10 → 5 ms at 40 MB, 38 → 21 ms at 200 MB.

Output is identical: 68 incremental and full saves of five originals,
encrypted ones included, hash the same before and after.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* M1: the full-save capacity test (storytold#523) builds its stream from Bytes

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Brandon Thomas <echelon@gmail.com>
anishguduru pushed a commit to anishguduru/deckcraft that referenced this pull request Oct 16, 2026
* M14: bound large-PDF memory use (storytold#307)

Inspect large documents lazily, share parser/resource metadata, bound full-save
and raster retention, and cache signature candidate discovery safely.

Preserve upstream rendering deduplication, pixel alignment, signature previews,
and organizer insertion behavior, with regression coverage for their interaction.

Validated with 1,336 workspace tests, 193 parser tests, strict workspace Clippy,
30 WASM crate checks, 1x/2x GUI protocols, and same-PDF workflow comparisons.

* cos: drop the writer cache-policy probe and its test-only hooks in production paths

* cos: the temporary reader keeps parsed objects until a count or owned-bytes budget

Since storytold#552 a stream read from the file is a view into the input, so clearing the whole parse
cache after every read saved little memory and cost most of the full-save slowdown (every
object parsed twice, indirect /Length objects re-parsed per stream). Clear only past
OBJECTS entries or STREAM_BYTES of data of the cache's own (decrypted streams, strings).

* cos: the writers refuse a document opened with a stream limit (read-only inspection)

* cos: a full save fails rather than writing null when an object reads differently the second time

* render: parsing is not timed by the watchdog; timing tests with wide margins

A slow first parse (a huge or damaged file) made the whole pool fail every page for its
lifetime. Parsing, shared or private, is now its own untimed stage, as on main before the
shared parser; rendering is timed from when parsing ends. The init-timeout tests become one
deterministic test (a 2 s parse against a 10 ms limit, shared and private). Watchdog tests
use limits and injected delays ~10x apart instead of 25-50 ms against real renders. Also:
saturating retired-worker count, main's stop-flag test runs on private parsers (the first
shared timeout is a private retry), set_queue documents that unlisted results are dropped,
and retire() documents the permanent per-worker-parser fallback.

* render: page numbers in the lazy page tree use checked conversion

* render: the lazy inspector is compared with lopdf on named destinations and object streams too

* ui: on-screen pages always render; pages turned back to stay cached; stable thumbnail tags

- Visible pages and tiles are always admitted and uploaded (the viewport bounds them); the
  byte and count limits decide only how much prefetch fits. A HiDPI two-up view or a 5K
  viewport left pages on 'Rendering...' for good.
- Pages no longer demanded stay cached, nearest the current page first, while the 128 MiB
  allowance and the 24-page count have room: paging back no longer re-renders.
- Thumbnail density follows the demand count rounded up to a power of two, so rows scrolling
  in and out of an organize grid don't change every thumbnail's tag and re-render it.
- A suspended (background) tab drains its pool's finished results instead of holding them.
- Organize drag-and-drop ends on the primary button only.
- Tests: the stale-result test uses valid pixels and checks nothing was uploaded; the
  organizer wheel test runs 40 steps; regressions for the first three fixes.

* vendor: mark the hayro-syntax lock and SegmentList patches and list them as (8) and (9); clippy 1.99 as_chunks in a raster test

* render: clippy 1.99 — contains over iter().any() in a raster test

---------

Co-authored-by: Brandon Thomas <echelon@gmail.com>
The window had no string catalog, so a system language or an explicit
choice could not change what it says. Preferences now offers System,
English and 繁體中文. System follows a zh-Hant, zh-TW, zh-HK or zh-MO
locale. The ribbon tabs, File menu, title bar, status bar and
Preferences use that choice. Ribbon groups and the other dialogs stay
in English.

Closes storytold#109

Co-authored-by: Cursor <cursoragent@cursor.com>
@NikitkaRa
NikitkaRa force-pushed the cursor/zh-hant-shell-7e0f branch from 3790a96 to bbde997 Compare October 16, 2026 17:54
@aiongg aiongg added the missing feature The reference application has it and we do not, or only part of it label Nov 4, 2026

@aiongg aiongg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

AI-generated review (Opus). Not a maintainer decision.

Changes needed (not certain):

Adds a shell string catalog with Traditional Chinese, a language choice in Preferences and an app.language command. Locale mapping and fallback are careful, but a few paths are left out.

  • The catalog is a fixed (id, English, Traditional Chinese) table in crates/ui-egui/src/i18n.rs. Adding a second language means reshaping every row, and other Craft apps load shared per-locale catalogs instead.
  • Cancel, Esc or closing Preferences restores dark mode and interface size but not the interface language. preferences_snapshot and restore_preferences (crates/ui-egui/src/dialogs.rs:150-172) should save and restore app.ui.language.
  • tab_label (crates/ui-egui/src/i18n.rs:252-272) has no entries for Handout Master, Notes Master or SmartArt Design (crates/ui-egui/src/ribbon.rs:137,139,157), so those tabs stay English.
  • title.home, title.play, title.redo, title.save and title.undo are in the catalog but never looked up. The quick-access toolbar tooltips (crates/ui-egui/src/qat.rs:44-50) stay English.
  • The status bar's Language tooltip and "(not checked)" suffix (crates/ui-egui/src/status.rs) and the AutoCorrect Options… button in Preferences are still literals.
  • ROADMAP.md gets a second status line dated 2026-10-13 under the existing 2026-10-14 one instead of updating it.
  • Locale mapping is careful: zh-TW, zh-HK, zh-MO and zh-Hant (with _, encoding suffixes and case variants) resolve to Traditional Chinese, Simplified tags stay English, and an unknown saved code falls back to System.

Claims checked:

  • verified: Preferences offers System, English and 繁體中文; the choice is saved in the UI state and can be set with app.language (system, en, zh-Hant) (crates/ui-egui/src/dialogs.rs:2151 combo box runs app.language; crates/ui-egui/src/lib.rs:274 UiState.language (struct has serde default); crates/ui-egui/src/lib.…
  • verified: System follows a zh-Hant, zh-TW, zh-HK or zh-MO locale; Simplified Chinese (zh, zh-Hans, zh-CN, zh-SG) stays English (crates/ui-egui/src/i18n.rs:93 is_traditional matches only zh-hant/zh-tw/zh-hk/zh-mo and their subtags; resolve_tag returns En otherwise)
  • verified: On the web build, System stays English until the user picks a language (crates/ui-egui/src/i18n.rs:117-121 read_system_tag returns None on wasm32, and resolve maps None to En)
  • contradicted: The ribbon tabs are translated (crates/ui-egui/src/i18n.rs:252-272 tab_label has no Handout Master, Notes Master or SmartArt Design rows, and those names come from crates/ui-egui/src/ribbon.rs:137,139,157, so they fall through to English)
  • contradicted: The title bar is translated (crates/ui-egui/src/ribbon.rs title_bar translates only Edited, Search, Present, Comments and appearance; the quick-access toolbar labels at crates/ui-egui/src/qat.rs:44-50 stay English, and the title.home/play/redo/save/undo rows in crates/ui-egui/src/i18n.rs are never…
  • verified: The File menu, status bar and Preferences are translated (crates/ui-egui/src/backstage.rs nav_text covers every Nav item; crates/ui-egui/src/status.rs uses status.* rows for the slide counter, view and zoom controls; crates/ui-egui/src/dialogs.rs:2146-2198 uses pref.* rows. The Language tooltip, '(…
  • unverified: 67 strings in all (crates/ui-egui/src/i18n.rs CATALOG has 12 nav, 16 pref, 11 status, 18 tab and 10 title rows (67); five title rows are unused)

Recommendation: update the pull request; it will be reviewed again.

Reviewed at bbde997.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

missing feature The reference application has it and we do not, or only part of it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Traditional Chinese (zh-Hant, Taiwan) interface translation

2 participants