PdfCraft: An open-source PDF reader and editor written by scratch in pure Rust
i18n: Czech interface language (#68)
Petr Leo Compelf0f923b82e5a
diff --git a/ATTRIBUTION.md b/ATTRIBUTION.mdindex 0a1aa1995..9266509a5 100644--- a/ATTRIBUTION.md+++ b/ATTRIBUTION.md@@ -4,10 +4,11 @@Every asset PdfCraft includes, bundles or uses to build its published material, with its author, source and licence. The policy is in [AGENTS.md](AGENTS.md) §1. The machine-readable list, with SHA-256 hashes, is [ATTRIBUTION.toml](ATTRIBUTION.toml). Licence texts are kept beside the assets and summarised in [NOTICE](NOTICE).-## In this repository (244)+## In this repository (245)| Asset | Title | Author | Licence | Source | Used for ||---|---|---|---|---|---|+| `crates/ui-egui/src/i18n/cs.tsv` | Czech interface translation catalog | PdfCraft contributors | MIT OR Apache-2.0 | Contributor-original: clean-room translations of PdfCraft's English UI labels, no proprietary localisation resources | Czech UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs || `crates/ui-egui/src/i18n/pt-br.tsv` | Brazilian Portuguese interface translation catalog | PdfCraft contributors | MIT OR Apache-2.0 | Contributor-original: clean-room translations of PdfCraft's English UI labels, no proprietary localisation resources | Brazilian Portuguese UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs || `crates/ui-egui/src/i18n/ja.tsv` | Japanese interface translation catalog | PdfCraft contributors | MIT OR Apache-2.0 | Contributor-original: clean-room translations of PdfCraft's English UI labels, no proprietary localisation resources | Japanese UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs || `assets/icons/accessibility.svg` | Lucide icon "accessibility" | Lucide Contributors (portions Cole Bemis, Feather) | ISC | https://github.com/lucide-icons/lucide (npm lucide-static 1.49.0, icons/accessibility.svg) | UI icon, embedded via crates/ui-egui/src/icon_data.rs |diff --git a/ATTRIBUTION.toml b/ATTRIBUTION.tomlindex 16871bb1b..cb5af20c7 100644--- a/ATTRIBUTION.toml+++ b/ATTRIBUTION.toml@@ -10,6 +10,17 @@# licence: SPDX expression from the allowlist in AGENTS.md §1.2. adobe_data = true marks the closed list of# Adobe-authored non-visual technical data allowed by AGENTS.md §1.1.+[[asset]]+path = "crates/ui-egui/src/i18n/cs.tsv"+title = "Czech interface translation catalog"+author = "PdfCraft contributors"+source = "Contributor-original: clean-room translations of PdfCraft's English UI labels, no proprietary localisation resources"+licence = "MIT OR Apache-2.0"+licence_file = "LICENSE-MIT"+kind = "translation"+usage = "Czech UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"+sha256 = "1137fb2a70a57314006cc245d413e44895815a1d65f42c1fb841fa2650de43d5"+[[asset]]path = "crates/ui-egui/src/i18n/pt-br.tsv"title = "Brazilian Portuguese interface translation catalog"diff --git a/Cargo.lock b/Cargo.lockindex 04e8753f7..e9a71c7cc 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -3776,6 +3776,7 @@ dependencies = ["rfd","serde","serde_json",+ "skrifa 0.44.0","wasm-bindgen","wasm-bindgen-futures","web-sys",diff --git a/ROADMAP.md b/ROADMAP.mdindex cc136f104..c6a7a0a47 100644--- a/ROADMAP.md+++ b/ROADMAP.md@@ -138,6 +138,7 @@ Newest first. One line per session: the date, what moved, and the new overall pe- **2026-10-07 (session 15):** Five community issues, each with a regression test: in two-page view, Next page moves a whole spread (#77, #70); Export to Word opens in Word again, with control characters dropped and receipt-length pages kept within Word's 22 in, checked in Microsoft Word (#78, #72); macOS opens PDFs from Finder, Open With and the Dock (Apple events through the audited `fmv-macos-events`, PDF declared in the Info.plist), and the packaging no longer describes the image editor it was copied from (#82, #73); Add text keeps the box being typed when you click elsewhere, with Done and Discard beside it, reproduced and checked with real OS input (#86, #74); sharper, higher-contrast text, most visible on Windows, with every text colour at WCAG AA in both themes (#84, #76; the console window was already gone in 0.2.1). Still open: #79 (layered "not verified" signature appearances), #80 (native macOS menu bar), #81 (Homebrew and Scoop). P0 88%, P1 53%; 805 features 50.2% shipped (53.7% weighted). ≈ 30–35%.- **2026-10-06 (community navigation):** Linux-only middle-button vertical scrolling in the document and Organize grid, toggled by clicking the wheel, with cancellation that protects page tools and selection. Scrolling stays on after releasing the wheel, even if the pointer moved before release. Manual feedback led to a Chromium-style distance^2.2 speed curve, a 15-screen-point dead zone, and continuous redraws that use elapsed frame time; the former linear speed cap is removed. Headless UI/control regressions cover fractional movement, consistent travel at 30/60/120/144 fps, pause/resume and cancellation. Other platforms retain their existing middle-button input behavior, with a regression that checks the custom scroller neither blocks input nor changes the cursor or consumes Escape. No new dependency. Automatic scrolling remains partial because keyboard-started timed scrolling is absent. Overall effort estimate remains ≈ 30–35%.- **2026-10-06 (session 14):** Issues: move and resize existing text boxes in Edit text (#59, closes #40); Windows release builds open no console window and the Start Menu shortcut has its icon (#58, #57; rolled out to every Craft app); native Windows ARM64 installers, installed and run on an ARM64 runner in CI (#66, #71; the intermittent ARM64 test crash was a WARP shader-JIT race between parallel GPU-rendering tests, not our code); XFA forms are detected and explained instead of failing silently (#65, #60 stays open for real XFA). Also: squiggly underline tool, comment opacity, Preferences ▸ Identity, drag-and-drop/hover tests; community table export to Word/HTML/RTF (#62, with linear-time detection and a column cap). #63 (timestamps/LTV with outbound network) held for review fixes and an owner decision on network access. ≈ 30–35% (unchanged).+- **2026-10-06 (community, #68):** Interface language: Czech (Čeština, `ui.set language=cs`) joins English and Japanese. It translates every registered File/Edit/Pages/View/Help command and every label routed through the translation table, with tests that fail when a menu label lacks Czech; the interface fonts are tested to cover Czech diacritics. Dialogs and panels remain English (misc.prefs-language: partial).- **2026-10-06:** M1: invalid object-number ranges in xref tables and streams take the existing reconstruction path, with the reason recorded, instead of overflowing or aliasing another object. Synthetic open/repair regression added. Overall estimate unchanged (≈ 30–35%).- **2026-10-05 (session 13, later):** FreeBSD: CI builds and tests the workspace in a FreeBSD 14.3 VM (#45) and the release ships a FreeBSD x86_64 tarball, checked in CI (#42); README lists FreeBSD. Fuzzing: the nightly job's 11 hangs fixed (#41: our parser's exponential retries, inline images, Type 3 fan-out), plus a JBIG2 hang (#43, vendored hayro-jbig2) and a Type 1 font stack overflow (#46, skrifa 0.47); a full run now finds 0 crashes. Landed community PRs #36 (text editing, Japanese replacements), #47 (English/Japanese interface) and #48 (XFDF colour crash). Windows launch crash with Intel's Vulkan driver fixed by using Direct3D 12 (#49, issue #37); one copy of the Japanese font instead of two (#51, −8.3 MB); full screen and About get real tests (#50). P0 88%, P1 52%. ≈ 30–35%.diff --git a/crates/ui-egui/Cargo.toml b/crates/ui-egui/Cargo.tomlindex 35fd3f5c1..28de6aa25 100644--- a/crates/ui-egui/Cargo.toml+++ b/crates/ui-egui/Cargo.toml@@ -42,3 +42,5 @@ pdfcraft-cos = { workspace = true }pdfcraft-model = { workspace = true }egui_kittest = { workspace = true, features = ["eframe", "wgpu"] }image = { version = "0.25", default-features = false, features = ["png"] }+# Glyph-coverage test of the interface fonts; the same skrifa pdfcraft-fonts already uses.+skrifa = "0.44"diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsvnew file mode 100644index 000000000..13ff814a0--- /dev/null+++ b/crates/ui-egui/src/i18n/cs.tsv@@ -0,0 +1,94 @@+# Czech (cs) catalog. Format: see the header of ja.tsv+# (context <TAB> source <TAB> translation; @id, @plural and other contexts; escapes \n \t \\).+# Plural forms (see `plural_cs` in i18n/mod.rs): one (1) | few (2–4) | other (0, 5+).+#+# Clean-room: written from the meaning of the English labels, following common Czech desktop+# conventions (menus are nouns, commands are infinitives); not taken from Adobe Acrobat's Czech+# localisation or any other product's translation. Terminology: annotations are "komentáře",+# pages are "stránky", form fields are "formulářová pole". Product and format names (PdfCraft,+# PDF, Word, HTML…) stay in Latin letters; the trailing "…" of dialog commands is kept.++ Menu Nabídka+ File Soubor+ Edit Úpravy+ Pages Stránky+ View Zobrazení+ Help Nápověda+ Zoom Zvětšení+ Actual size Skutečná velikost+ Zoom to page level Celá stránka+ Fit to width Přizpůsobit šířce+ Display theme Motiv vzhledu+ Side panels Postranní panely+ Preferences Předvolby+ Preferences… Předvolby…+ Interface language Jazyk rozhraní+ Identity Identita+ Name on new comments Jméno autora nových komentářů+ Enable Acrobat JavaScript Povolit Acrobat JavaScript+ OK OK+ Open… Otevřít…+ New blank PDF Nový prázdný dokument PDF+ Create PDF from file… Vytvořit PDF ze souboru…+ Create PDF from images… Vytvořit PDF z obrázků…+ Create PDF from clipboard Vytvořit PDF ze schránky+ Combine files… Sloučit soubory…+ Save Uložit+ Save as… Uložit jako…+ Close file Zavřít soubor+ Close all Zavřít vše+ Revert Vrátit k uložené verzi+ Print… Tisk…+ Document properties… Vlastnosti dokumentu…+ Export to image… Exportovat jako obrázek…+ Reduce file size… Zmenšit velikost souboru…+ Optimize PDF… Optimalizovat PDF…+ Export to text… Exportovat jako text…+ Export to Word… Exportovat do formátu Word…+ Export to HTML… Exportovat do formátu HTML…+ Export to RTF… Exportovat do formátu RTF…+ Export all images… Exportovat všechny obrázky…+ Protect using password… Chránit heslem…+ Remove security Odebrat zabezpečení+ Security properties… Vlastnosti zabezpečení…+ Undo Zpět+ Redo Znovu+ Find… Najít…+ Advanced search… Rozšířené hledání…+ Take a snapshot Pořídit snímek+ Clear form Vymazat formulář+ Copy pages Kopírovat stránky+ Cut pages Vyjmout stránky+ Paste pages Vložit stránky+ Find tools and commands… Najít nástroje a příkazy…+ Fit visible Přizpůsobit viditelnému obsahu+ Marquee zoom Zvětšit vybranou oblast+ Full screen mode Režim celé obrazovky+ Read mode Režim čtení+ Switch light / dark theme Přepnout světlý / tmavý motiv+ Comments panel Panel komentářů+ Form fields panel Panel formulářových polí+ Signatures panel Panel podpisů+ Organize pages Uspořádat stránky+ New bookmark Nová záložka+ Rotate pages clockwise Otočit stránky po směru hodinových ručiček+ Rotate pages counterclockwise Otočit stránky proti směru hodinových ručiček+ Delete pages Odstranit stránky+ Insert blank page Vložit prázdnou stránku+ Rotate pages… Otočit stránky…+ Duplicate pages Duplikovat stránky+ Crop pages Oříznout stránky+ Set page boxes… Nastavit rámečky stránek…+ Insert pages from file… Vložit stránky ze souboru…+ Replace pages… Nahradit stránky…+ Extract pages… Extrahovat stránky…+ Split document… Rozdělit dokument…+ Number pages… Očíslovat stránky…+ Keyboard shortcuts Klávesové zkratky+ Join the ArtCraft Discord Připojit se ke komunitě ArtCraft na Discordu+ PdfCraft web page Webová stránka PdfCraft+ PdfCraft on GitHub PdfCraft na GitHubu+ ArtCraft website Web ArtCraft+ Check for updates… Zkontrolovat aktualizace…+ About PdfCraft O aplikaci PdfCraft+ Auto Automatickydiff --git a/crates/ui-egui/src/i18n/mod.rs b/crates/ui-egui/src/i18n/mod.rsindex cd694648f..f9f007f77 100644--- a/crates/ui-egui/src/i18n/mod.rs+++ b/crates/ui-egui/src/i18n/mod.rs@@ -55,15 +55,25 @@ fn plural_none(_: u64) -> usize {0}+/// Czech: 1 → one, 2–4 → few, everything else (0, 5+) → other.+fn plural_cs(n: u64) -> usize {+ match n {+ 1 => 0,+ 2..=4 => 1,+ _ => 2,+ }+}+/// Portuguese: 0 and 1 take the singular, everything else the plural.fn plural_pt(n: u64) -> usize {usize::from(n > 1)}/// The registry. English first: it is the fallback and the source language.-pub static LANGUAGES: [LangInfo; 3] = [+pub static LANGUAGES: [LangInfo; 4] = [LangInfo { code: "en", name: "English", source: "", plural: plural_one_other, catalog: OnceLock::new() },LangInfo { code: "ja", name: "日本語", source: include_str!("ja.tsv"), plural: plural_none, catalog: OnceLock::new() },+ LangInfo { code: "cs", name: "Čeština", source: include_str!("cs.tsv"), plural: plural_cs, catalog: OnceLock::new() },// Brazilian Portuguese; `pt`, `pt-BR` and `pt-PT` locales all resolve here (see `candidates`).LangInfo { code: "pt-br", name: "Português (Brasil)", source: include_str!("pt-br.tsv"), plural: plural_pt, catalog: OnceLock::new() },];@@ -514,6 +524,36 @@ mod tests {assert_eq!(restored.language, "pt-br");}+ /// Czech covers every registered menu title and menu command label (#68), keeps ellipses, and+ /// only leaves untranslated what is deliberately the same in Czech.+ #[test]+ fn czech_covers_every_menu_label() {+ let cs = Lang::from_code("cs").expect("cs registered");+ assert_eq!(cs.name(), "Čeština");+ assert_eq!(tr(cs, "File"), "Soubor");+ assert_eq!(tr(cs, "Žluťoučký kůň.pdf"), "Žluťoučký kůň.pdf");+ assert_eq!((0..=6).map(|n| (cs.0.plural)(n)).collect::<Vec<_>>(), [2, 0, 1, 1, 1, 2, 2]);+ for spec in pdfcraft_engine::commands::COMMANDS {+ let Some(menu) = spec.menu else { continue };+ assert!(has(cs, menu), "Czech lacks the menu title {menu:?}");+ assert!(has(cs, spec.label), "Czech lacks the {menu} menu label {:?} ({})", spec.label, spec.id);+ }+ const KEEP_AS_IS: &[&str] = &["OK"];+ let (entries, _) = parse_entries(cs.0.source, cs.0.plural_forms());+ for e in &entries {+ assert!(e.source != e.translation || KEEP_AS_IS.contains(&e.source.as_str()), "{:?} is untranslated", e.source);+ assert!(!e.translation.contains("..."), "use … rather than three dots: {:?}", e.translation);+ assert_eq!(e.translation.trim(), e.translation, "stray whitespace: {:?}", e.translation);+ }+ let mut app = crate::PdfCraftApp::default();+ app.set_option("language", "cs").unwrap();+ assert!(app.set_option("language", "cz").is_err());+ assert_eq!(app.language, "cs");+ let mut restored = crate::PdfCraftApp::default();+ restored.restore(&app.persist());+ assert_eq!(restored.language, "cs");+ }+/// Every bundled catalog is well-formed and consistent with its sources.#[test]fn bundled_catalogs_are_consistent() {diff --git a/crates/ui-egui/tests/fonts.rs b/crates/ui-egui/tests/fonts.rsindex 807ce95ce..16a0e61e8 100644--- a/crates/ui-egui/tests/fonts.rs+++ b/crates/ui-egui/tests/fonts.rs@@ -56,3 +56,29 @@ fn ui_fonts_work_without_craft_fonts() {let ctx = egui::Context::default();theme::install_fonts(&ctx);}++/// Latin-script catalogs (Czech, Brazilian Portuguese) are drawn entirely by the app's own faces+/// (Inter, JetBrains Mono): no letter falls through to egui's defaults or a CJK fallback. (egui's+/// `has_glyphs` can't answer this: with only the primary face it is also the replacement face.)+#[test]+fn primary_ui_fonts_cover_latin_catalogs() {+ use skrifa::MetadataProvider as _;+ let defs = theme::font_definitions();+ for (code, catalog) in [("cs", include_str!("../src/i18n/cs.tsv")), ("pt-br", include_str!("../src/i18n/pt-br.tsv"))] {+ let mut text = String::from("áčďéěíňóřšťúůýžÁČĎÉĚÍŇÓŘŠŤÚŮÝŽãõçâêôàÃÕÇÂÊÔÀ…");+ for line in catalog.lines().filter(|l| !l.starts_with('#')) {+ if let Some(translation) = line.split('\t').nth(2) {+ text.extend(translation.chars().filter(|c| !c.is_whitespace()));+ }+ }+ for name in ["Inter", "Inter-Medium", "Inter-SemiBold", "JetBrainsMono"] {+ let data = &defs.font_data[name];+ let font = skrifa::FontRef::from_index(&data.font, data.index).unwrap();+ let charmap = font.charmap();+ let mut missing: Vec<char> = text.chars().filter(|c| charmap.map(*c).is_none()).collect();+ missing.sort_unstable();+ missing.dedup();+ assert!(missing.is_empty(), "{code}: {name} lacks {missing:?}");+ }+ }+}diff --git a/docs/localization.md b/docs/localization.mdindex 524ee7f5b..25da8e33d 100644--- a/docs/localization.md+++ b/docs/localization.md@@ -1,6 +1,6 @@# Interface language-Choose **Edit > Preferences > Interface language** and select **Auto**, **English**, **日本語** or **Português (Brasil)**. The change applies immediately and persists between launches. Command ids, document contents and file names are unchanged.+Choose **Edit > Preferences > Interface language** and select **Auto**, **English**, **日本語**, **Čeština** or **Português (Brasil)**. The change applies immediately and persists between launches. Command ids, document contents and file names are unchanged.**Auto** (the default) follows the system language: `LC_ALL`, `LC_MESSAGES` or `LANG`, then the preferred-languages list on macOS. Any Portuguese locale (`pt_BR`, `pt_PT`) uses the Brazilian catalog. A system language without a catalog, such as French, shows English. Windows has no system-language detection yet, so **Auto** shows English there unless `LANG` is set.@@ -10,11 +10,11 @@ The control channel exposes the setting through `ui.set`:{"method":"ui.set","params":{"key":"language","value":"ja"}}```-The value is `auto` or a language code (`en`, `ja`, `pt-br`), in any case. `ui.state` reports `language` as written in the preferences (`auto`, `en`, `ja` or `pt-br`). Unknown values return an error without changing the current setting. Preferences saved before this setting existed follow the system language.+The value is `auto` or a language code (`en`, `ja`, `cs`, `pt-br`), in any case. `ui.state` reports `language` as written in the preferences (`auto`, `en`, `ja`, `cs` or `pt-br`). Unknown values return an error without changing the current setting. Preferences saved before this setting existed follow the system language.This first translation pass covers the main menu and core registered menu commands. Untranslated labels use English. Vertical Japanese PDF rendering is an existing viewer feature; this change does not add vertical text editing.-Japanese interface text uses BIZ UDPGothic from [craft-fonts](https://github.com/storytold/craft-fonts), an optional build input that every release includes (`CRAFT_FONTS_DIR`; see the README). A build made without it has no Japanese face, so Japanese labels show replacement boxes. Brazilian Portuguese needs only the bundled Latin faces.+Japanese interface text uses BIZ UDPGothic from [craft-fonts](https://github.com/storytold/craft-fonts), an optional build input that every release includes (`CRAFT_FONTS_DIR`; see the README). A build made without it has no Japanese face, so Japanese labels show replacement boxes. Czech and Brazilian Portuguese need only the bundled Latin faces (tested in `tests/fonts.rs`).## How translations workdiff --git a/parity/acrobat-features.toml b/parity/acrobat-features.tomlindex ac06a880d..0143d0978 100644--- a/parity/acrobat-features.toml+++ b/parity/acrobat-features.toml@@ -9807,7 +9807,7 @@ status = "partial"commands = []tools = []evidence = ["crates/ui-egui/src/i18n/mod.rs::language_persists_and_invalid_input_keeps_current_language", "crates/ui-egui/src/i18n/mod.rs::bundled_catalogs_are_consistent", "crates/ui-egui/tests/control.rs::language_switch_preserves_document_and_command_ids"]-notes = "Preferences switches Auto (system language)/English/Japanese/Brazilian Portuguese and persists; ui.set language auto|en|ja|pt-br and ui.state expose it. TSV catalogs per language (same system as PhotoCraft). Core menu labels translated; dialogs, panels, Windows system-language detection and more languages remain open."+notes = "Preferences switches Auto (system language)/English/Japanese/Czech/Brazilian Portuguese and persists; ui.set language auto|en|ja|cs|pt-br and ui.state expose it. TSV catalogs per language (same system as PhotoCraft). Core menu labels translated (Czech: every registered menu command, tested); dialogs, panels, Windows system-language detection and more languages remain open."[[feature]]id = "misc.prefs-reading"