Skip to content

PdfCraft: An open-source PDF reader and editor written by scratch in pure Rust

Merge PR #1976: i18n: add Indonesian, Vietnamese, Hindi and Korean interfaces

aionggd52247c7d73d
diff --cc ATTRIBUTION.md
index 75ebd1d7c,d6de9a209..4f789a8e9
--- a/ATTRIBUTION.md
+++ b/ATTRIBUTION.md
@@@ -4,7 -4,7 +4,7 @@@
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 (276)
-## In this repository (275)
++## In this repository (279)
| Asset | Title | Author | Licence | Source | Used for |
|---|---|---|---|---|---|
diff --cc ATTRIBUTION.toml
index c5e55f063,71f533add..345a33d09
--- a/ATTRIBUTION.toml
+++ b/ATTRIBUTION.toml
@@@ -228,8 -228,39 +228,39 @@@ licence = "MIT OR Apache-2.0
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Lithuanian UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
-sha256 = "7fa70f68a9fa24d0b1cac05fe3aaabaeaca9750c57416124bd317a4eda806d5a"
+sha256 = "6ed886d00ad8cd39d8bf254f4733c8b8c90d5bf2c6868ff9c4ca42765a148786"
+ [[asset]]
+ path = "crates/ui-egui/src/i18n/hi.tsv"
+ title = "Hindi 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 = "Hindi UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
+ sha256 = "72951e5f6ba5f1808c991db5c6ba32f7b2d210b8cc9f20da7634532dc5294e27"
+ [[asset]]
+ path = "crates/ui-egui/src/i18n/id.tsv"
+ title = "Indonesian 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 = "Indonesian UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
+ sha256 = "fa4e8dbd5c81e71000507fcde6bb7f4d702171e162b005c9c4b5e7be1f66b20a"
+ [[asset]]
+ path = "crates/ui-egui/src/i18n/ko.tsv"
+ title = "Korean 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 = "Korean UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
+ sha256 = "408e777db94b4d5807dba807f0ed82aee4fee6f99166c8fc2dc1b7dea0027f85"
+
[[asset]]
path = "assets/icons/accessibility.svg"
diff --cc crates/ui-egui/tests/fonts.rs
index 5157c86c5,80b93f768..6169763d3
--- a/crates/ui-egui/tests/fonts.rs
+++ b/crates/ui-egui/tests/fonts.rs
@@@ -163,7 -164,53 +164,31 @@@ fn system_fallback_covers_devanagari()
assert_eq!(stack.iter().filter(|n| *n == theme::SYSTEM_DEVANAGARI_FALLBACK).count(), 1, "{family:?}");
}
let mut fonts = Fonts::new(TextOptions::default(), defs);
- const DEVANAGARI: &str = "हिंदी पाठ सम्पादन";
+ for id in families() {
+ assert!(fonts.has_glyphs(&id, DEVANAGARI), "{id:?} lacks {DEVANAGARI}");
+ }
+ assert!(layout_widths(&mut fonts, DEVANAGARI).iter().all(|w| w.is_finite() && *w > 0.0));
+ }
+
-/// On a machine with a suitable installed Korean font, the installed definitions include it and
-/// Korean text has glyphs; the embedded-only definitions never name it.
-#[test]
-fn system_fallback_covers_hangul() {
- const HANGUL: &str = "한국어 파일 편집";
- assert!(!theme::font_definitions().font_data.contains_key(theme::SYSTEM_HANGUL_FALLBACK));
- let defs = theme::installed_font_definitions(theme::CjkPreference::Default);
- if !defs.font_data.contains_key(theme::SYSTEM_HANGUL_FALLBACK) {
- eprintln!("skipping system_fallback_covers_hangul: no installed Hangul fallback font (or PDFCRAFT_SYSTEM_FONTS=0)");
- assert!(defs.families.values().all(|stack| !stack.iter().any(|n| n == theme::SYSTEM_HANGUL_FALLBACK)));
- return;
- }
- for (family, stack) in &defs.families {
- assert_eq!(stack.iter().filter(|n| *n == theme::SYSTEM_HANGUL_FALLBACK).count(), 1, "{family:?}: {stack:?}");
- }
- let mut fonts = Fonts::new(TextOptions::default(), defs);
- for id in families() {
- assert!(fonts.has_glyphs(&id, HANGUL), "{id:?} lacks {HANGUL}");
- }
- assert!(layout_widths(&mut fonts, HANGUL).iter().all(|w| w.is_finite() && *w > 0.0));
-}
-
+ /// Built with craft-fonts, Hindi text renders with real glyphs (no tofu) in every family: a
+ /// `Deva` face is a fallback after the app's own fonts. Without craft-fonts it is the installed
+ /// Devanagari fallback's job (see `system_fallback_covers_devanagari`), and the web build has
+ /// neither.
+ #[test]
+ fn devanagari_ui_text_uses_craft_fonts() {
+ if pdfcraft_fonts::ui_devanagari_fonts().is_empty() {
+ eprintln!("skipping devanagari_ui_text_uses_craft_fonts: built without craft-fonts (set CRAFT_FONTS_DIR to run it)");
+ return;
+ }
+ let defs = theme::font_definitions();
+ for family in [FontFamily::Proportional, FontFamily::Monospace] {
+ let stack = &defs.families[&family];
+ let first =
+ stack.iter().position(|n| pdfcraft_fonts::ui_devanagari_fonts().iter().any(|f| f.name() == *n)).expect("a Deva face is a fallback");
+ let own = stack.iter().position(|n| n == "Inter" || n == "JetBrainsMono").expect("the app's own font");
+ assert!(own < first, "{family:?}: {stack:?}");
+ }
+ let mut fonts = Fonts::new(TextOptions::default(), defs);
for id in families() {
assert!(fonts.has_glyphs(&id, DEVANAGARI), "{id:?} lacks {DEVANAGARI}");
}