mirror of
https://github.com/storytold/wordcraft.git
synced 2026-12-01 18:24:54 -06:00
Compare commits
17
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
012afe2dcf | ||
|
|
6c7d31aa6f | ||
|
|
830e629541 | ||
|
|
8b5bfa78bf | ||
|
|
313e14885f | ||
|
|
9a8786a3ab | ||
|
|
4b5a96163c | ||
|
|
5a68da541f | ||
|
|
7dce30c8af | ||
|
|
b4efb2fef1 | ||
|
|
30b8f025d2 | ||
|
|
61c69fceca | ||
|
|
ea7322efac | ||
|
|
3b7779df34 | ||
|
|
b4fffa91cc | ||
|
|
5ad1c48b3e | ||
|
|
1ec6f0bb58 |
+2
-1
@@ -121,7 +121,7 @@ Weights and evidence per area: [docs/target-app-parity.md](docs/target-app-parit
|
||||
| English | en | full | 100% |
|
||||
| Simplified Chinese | zh-hans | partial | ~95% |
|
||||
| Spanish | es | partial | ~95% |
|
||||
| Hindi | hi | none | 0% |
|
||||
| Hindi | hi | partial (interface catalog, native-speaker reviewed; no proofing) | ~75% (2,800 entries; `cargo xtask i18n-report` lists 801 strings without Hindi) |
|
||||
| Arabic | ar | partial (catalog + mirrored UI; no kashida; no proofing; native review open) | ~95% |
|
||||
| French | fr | partial (interface complete, native-speaker reviewed; spelling from the French Language pack, no grammar marks) | 100% (2,615 entries) |
|
||||
| Portuguese | pt-br (pt-PT none) | partial | ~95% |
|
||||
@@ -153,6 +153,7 @@ Ranked, to beta (detail and remaining milestones in [docs/roadmap.md](docs/roadm
|
||||
|
||||
## Progress log
|
||||
|
||||
- 2026-12-01: Hindi interface language (`hi`): File › Options › Interface language offers हिन्दी, and `hi`, `hi-IN` and `hi_IN.UTF-8` system locales pick it. The catalog is craft-i18n's `locales/hi/wordcraft.tsv` (`craft-i18n.rev` at 217f413); interface text is drawn by the embedded Noto Sans Devanagari face. No Hindi proofing, so the Hindi interface doesn't set the language of new documents. Readiness estimates unchanged.
|
||||
- 2026-11-28: Layout indexes numbering definitions for each list and STYLEREF walk. List labels still follow the document's literal labels, start overrides and nested restart rules (#3615).
|
||||
|
||||
- 2026-11-27: Home › Paragraph › Borders with whole table cells selected (the table, rows, columns or a block of cells) borders the cells as one block, as Word does, instead of drawing a box around each paragraph in them: All Borders gives a continuous grid, Outside and Inside follow the block's edges, a single side toggles, and No Border clears the cells (#7874).
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
e56d26244bbac099bfd42e23fb12f78a4be418a7
|
||||
217f4130d7d3dbb21a160f23f6b0021918906cc0
|
||||
|
||||
@@ -62,6 +62,10 @@ pub(crate) fn help_entries(app: &WordApp) -> Vec<HelpEntry> {
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// The least width of the in-place result list, in points: v0.19.1's popup, wide enough for a row's place and
|
||||
/// shortcut beside its name (#7983). The closed field is narrower (about 130).
|
||||
const SEARCH_POPUP_MIN_WIDTH: f32 = 350.0;
|
||||
|
||||
/// Opens the search where this window shows its field (the title bar, or Immersive's screen bar). `false`
|
||||
/// when it shows none: Focus hides it, so the Search dialog takes over.
|
||||
pub(crate) fn open(app: &mut WordApp) -> bool {
|
||||
@@ -101,6 +105,7 @@ pub(super) fn show(app: &mut WordApp, ui: &mut Ui, compact: bool) -> egui::Rect
|
||||
let view = env.view();
|
||||
let cache = SearchCache::for_pass(kept, commands, &view);
|
||||
let out = CommandPalette::new(name.clone(), &cache.entries, &cache.index, Bind::bound(&mut open))
|
||||
.popup_min_width(SEARCH_POPUP_MIN_WIDTH)
|
||||
.face(if compact { PaletteFace::Dialog } else { PaletteFace::InPlace })
|
||||
.look(FieldLook::Quiet)
|
||||
.placeholder(Label::from(name.clone()))
|
||||
|
||||
@@ -12,13 +12,13 @@ use craft::ui::buttons::button::ButtonStyleKey;
|
||||
use craft::ui::buttons::icon_button::IconButtonStyleKey;
|
||||
use craft::ui::buttons::{Button, IconButton};
|
||||
use craft::ui::choice::Switch;
|
||||
use craft::ui::contract::{Bind, BodyCx, Props as _, Show as _, ShowCollection as _, ShowContainer as _, TooltipSpec, Trigger};
|
||||
use craft::ui::contract::{AfterInk, Bind, BodyCx, Props as _, Show as _, ShowCollection as _, ShowContainer as _, TooltipSpec, Trigger};
|
||||
use craft::ui::display::{Divider, Text};
|
||||
use craft::ui::list::{UndoList, UndoMark, UndoRows, UndoWords, footer_text, undo_count};
|
||||
use craft::ui::menu::{Menu, MenuItem};
|
||||
use craft::ui::popover::Popover;
|
||||
use craft::ui::primitives::IconSpec;
|
||||
use craft::ui::runtime::env::Env;
|
||||
use craft::ui::runtime::env::{Env, with_env};
|
||||
use craft::ui::runtime::inspect;
|
||||
use craft::ui::runtime::windows::{WindowAction, WindowHost};
|
||||
use craft::ui::shell::{Title, TitleBar};
|
||||
@@ -108,7 +108,15 @@ fn autosave(app: &mut WordApp, ui: &mut Ui) -> egui::Rect {
|
||||
let on = app.autosaves() && block.is_none();
|
||||
let tip = block.as_ref().map_or_else(|| tl!("AutoSave saves every change to the file (needs a saved document)").to_string(), |b| b.reason());
|
||||
// The small switch, as the old title bar drew it.
|
||||
let out = Switch::new(Bind::given(on)).label(tl!("AutoSave").to_string()).size(ControlSize::Sm).tooltip(TooltipSpec::new(tip)).show(ui);
|
||||
// The label is muted while AutoSave is off (#7681); craft keeps the full ink where muted would fall below text contrast.
|
||||
let ink = if on { AfterInk::Normal } else { AfterInk::Muted };
|
||||
let out = with_env(
|
||||
ui,
|
||||
|o| {
|
||||
o.values.set(ink);
|
||||
},
|
||||
|ui| Switch::new(Bind::given(on)).label(tl!("AutoSave").to_string()).size(ControlSize::Sm).tooltip(TooltipSpec::new(tip)).show(ui),
|
||||
);
|
||||
if out.response.clicked() {
|
||||
match block {
|
||||
None => {
|
||||
|
||||
@@ -110,6 +110,8 @@ impl StackDialog for BookmarkDialog {
|
||||
let (by_location, hidden, name) = (&mut self.by_location, &mut self.hidden, &mut self.name);
|
||||
let mut list = ListManager::new(Label::from(tl!("Bookmark")), Label::from(tl!("Bookmark name:")), entries, Self::actions(&words))
|
||||
.empty(Label::from(tl!("The document has no bookmarks yet.")))
|
||||
.framed(true)
|
||||
.cancel_last(true)
|
||||
.name_box(Bind::bound(name))
|
||||
.name_check(|n| wordcraft_engine::cmd::insert::bookmark_name_ok(n.trim()))
|
||||
.under_list(move |ui| {
|
||||
|
||||
@@ -553,7 +553,7 @@ fn special_table(ui: &mut Ui, form: &mut SymbolForm) -> bool {
|
||||
let columns = vec![
|
||||
ColumnSpec::new(glyph.clone(), Label::Empty, ColumnWidth::fill(0.5)),
|
||||
ColumnSpec::new(name.clone(), word("Special Characters"), ColumnWidth::fill(2.0)),
|
||||
ColumnSpec::new(keys.clone(), word("Shortcut key:"), ColumnWidth::Controls(5.5)),
|
||||
ColumnSpec::new(keys.clone(), word("Shortcut key:"), ColumnWidth::Content),
|
||||
];
|
||||
let positions: Vec<usize> = (0..SPECIAL.len()).collect();
|
||||
let source = keyed(&positions, |at: &usize| *at);
|
||||
|
||||
@@ -256,10 +256,10 @@ impl RibbonDialog {
|
||||
let source = TreeSource(&self.tree);
|
||||
let mut selection = Selection::single(self.selected.clone());
|
||||
let renamable: Vec<TreeItem> = self.tree.iter().filter(|row| self.renamable(&row.item)).map(|row| row.item.clone()).collect();
|
||||
let columns = vec![
|
||||
ColumnSpec::toggle(SHOWN, word("Show"), ToggleColumn::default()),
|
||||
ColumnSpec::new(ColumnKey::new("name"), word("Ribbon tabs"), ColumnWidth::fill(1.0)),
|
||||
];
|
||||
let mut show = ColumnSpec::toggle(SHOWN, word("Show"), ToggleColumn::default());
|
||||
// As wide as its header, not just its check box: "Show" read "S…".
|
||||
show.width = ColumnWidth::Content;
|
||||
let columns = vec![show, ColumnSpec::new(ColumnKey::new("name"), word("Ribbon tabs"), ColumnWidth::fill(1.0))];
|
||||
let rows = &self.tree;
|
||||
let out = List::new(word("Ribbon tabs"))
|
||||
.id(self.tree_id(ui))
|
||||
|
||||
@@ -70,6 +70,7 @@ impl StackDialog for MacrosDialog {
|
||||
let dialog = ListManager::new(tl!("Macros").to_string(), tl!("Macro name:").to_string(), self.entries.clone(), actions)
|
||||
.empty(Label::from(tl!("There are no macros yet. Record one to add it here.").to_string()))
|
||||
.cancel_label(tl!("Close").to_string())
|
||||
.framed(true)
|
||||
// PLAN: assumed `ListManager::name_box(self, Bind<'a, String>) -> Self` (dialogs-w5, S-L310)
|
||||
.name_box(Bind::bound(&mut self.name));
|
||||
let out = dialog.show(ui);
|
||||
|
||||
@@ -22,7 +22,7 @@ use wordcraft_engine::math_gallery::{BUILT_INS, STRUCTURES, SYMBOL_SETS};
|
||||
|
||||
use crate::WordApp;
|
||||
use crate::previews::{MathSource, math_key, math_painter, math_picture, math_thumbnails};
|
||||
use crate::ribbon::common::menu_button;
|
||||
use crate::ribbon::common::{labelled, menu_button};
|
||||
|
||||
/// What each structure button shows.
|
||||
pub(crate) fn button_picture(id: &str) -> &'static str {
|
||||
@@ -286,42 +286,44 @@ pub fn show(row: &mut RibbonRow<'_>, app: &mut WordApp) {
|
||||
let latex = app.session.math_latex;
|
||||
let normal_text = app.session.math_normal_text;
|
||||
row.group(RibbonGroup::new("tools", tl!("Tools").to_string(), crate::icons::spec("equation")), |ui| {
|
||||
math_menu_button(ui, EQUATION_PICTURE, "Equation", |ui, cx| builtin_menu(ui, cx, app));
|
||||
Stack::new().gap(Gap::Tight).show(ui, |ui, _| {
|
||||
ToggleButton::command(CommandRef::with_params("equation.inputFormat", json!({"format": "unicode"})))
|
||||
.label(tl!("Unicode").to_string())
|
||||
.icon(crate::icons::spec("equation"))
|
||||
.tooltip(tl!("Type equations in the linear format (UnicodeMath)").to_string())
|
||||
.selected(!latex)
|
||||
.show(ui);
|
||||
ToggleButton::command(CommandRef::with_params("equation.inputFormat", json!({"format": "latex"})))
|
||||
.label(tl!("LaTeX").to_string())
|
||||
.icon(crate::icons::spec("formula"))
|
||||
.tooltip(tl!("Type equations in LaTeX").to_string())
|
||||
.selected(latex)
|
||||
.show(ui);
|
||||
let face = Button::new(tl!("Convert").to_string()).icon(crate::icons::spec("replace"));
|
||||
let _ = menu_button(ui, face, tl!("Convert").to_string(), None, |ui, _| {
|
||||
for (label, to, all) in [
|
||||
("Current - Professional", "professional", false),
|
||||
("Current - Linear", "linear", false),
|
||||
("All - Professional", "professional", true),
|
||||
("All - Linear", "linear", true),
|
||||
] {
|
||||
MenuItem::command(CommandRef::with_params("equation.convert", json!({"to": to, "all": all})))
|
||||
.label(tl!(label).to_string())
|
||||
.show(ui);
|
||||
}
|
||||
labelled(ui, |ui| {
|
||||
math_menu_button(ui, EQUATION_PICTURE, "Equation", |ui, cx| builtin_menu(ui, cx, app));
|
||||
Stack::new().gap(Gap::Tight).show(ui, |ui, _| {
|
||||
ToggleButton::command(CommandRef::with_params("equation.inputFormat", json!({"format": "unicode"})))
|
||||
.label(tl!("Unicode").to_string())
|
||||
.icon(crate::icons::spec("equation"))
|
||||
.tooltip(tl!("Type equations in the linear format (UnicodeMath)").to_string())
|
||||
.selected(!latex)
|
||||
.show(ui);
|
||||
ToggleButton::command(CommandRef::with_params("equation.inputFormat", json!({"format": "latex"})))
|
||||
.label(tl!("LaTeX").to_string())
|
||||
.icon(crate::icons::spec("formula"))
|
||||
.tooltip(tl!("Type equations in LaTeX").to_string())
|
||||
.selected(latex)
|
||||
.show(ui);
|
||||
let face = Button::new(tl!("Convert").to_string()).icon(crate::icons::spec("replace"));
|
||||
let _ = menu_button(ui, face, tl!("Convert").to_string(), None, |ui, _| {
|
||||
for (label, to, all) in [
|
||||
("Current - Professional", "professional", false),
|
||||
("Current - Linear", "linear", false),
|
||||
("All - Professional", "professional", true),
|
||||
("All - Linear", "linear", true),
|
||||
] {
|
||||
MenuItem::command(CommandRef::with_params("equation.convert", json!({"to": to, "all": all})))
|
||||
.label(tl!(label).to_string())
|
||||
.show(ui);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
Stack::new().gap(Gap::Tight).show(ui, |ui, _| {
|
||||
ToggleButton::command(CommandRef::new("equation.normalText"))
|
||||
.label(tl!("Normal Text").to_string())
|
||||
.icon(crate::icons::spec("case"))
|
||||
.tooltip(tl!("Type normal (non-math) text in the equation").to_string())
|
||||
.selected(normal_text)
|
||||
.show(ui);
|
||||
});
|
||||
Stack::new().gap(Gap::Tight).show(ui, |ui, _| {
|
||||
ToggleButton::command(CommandRef::new("equation.normalText"))
|
||||
.label(tl!("Normal Text").to_string())
|
||||
.icon(crate::icons::spec("case"))
|
||||
.tooltip(tl!("Type normal (non-math) text in the equation").to_string())
|
||||
.selected(normal_text)
|
||||
.show(ui);
|
||||
});
|
||||
})
|
||||
});
|
||||
row.group(RibbonGroup::new("symbols", tl!("Symbols").to_string(), crate::icons::spec("symbol")), |ui| symbols(ui, app));
|
||||
row.group(RibbonGroup::new("structures", tl!("Structures").to_string(), crate::icons::spec("equation")), |ui| {
|
||||
|
||||
@@ -77,7 +77,7 @@ pub struct LangInfo {
|
||||
|
||||
/// The languages WordCraft offers, when their catalogs are embedded. English first: it is the
|
||||
/// fallback and the source language.
|
||||
pub static LANGUAGES: [LangInfo; 29] = [
|
||||
pub static LANGUAGES: [LangInfo; 30] = [
|
||||
LangInfo { code: "en", prefer_hans: false, editing_lang: None },
|
||||
// Simplified Chinese; `zh`, `zh-CN`, `zh-SG` and `zh-Hans-*` resolve here (the crate's matching).
|
||||
LangInfo { code: "zh-hans", prefer_hans: true, editing_lang: None },
|
||||
@@ -139,6 +139,9 @@ pub static LANGUAGES: [LangInfo; 29] = [
|
||||
// Bosnian, Latin script; `bs`, `bs-BA`, `bs_BA.UTF-8` and `bs-Latn-BA` resolve here. Cyrillic
|
||||
// Bosnian (`bs-Cyrl-*`) has no catalog, so it stays in English.
|
||||
LangInfo { code: "bs", prefer_hans: false, editing_lang: None },
|
||||
// Hindi, Devanagari script; `hi`, `hi-IN` and `hi_IN.UTF-8` resolve here. WordCraft doesn't proof
|
||||
// Hindi yet, so it doesn't set the language of new documents.
|
||||
LangInfo { code: "hi", prefer_hans: false, editing_lang: None },
|
||||
];
|
||||
|
||||
/// Interface languages written right to left. Their catalogs are written in typing order and
|
||||
@@ -255,7 +258,7 @@ impl Lang {
|
||||
/// Every registered language in the order a picker lists them: English first (the source
|
||||
/// language and the fallback), then the rest by their own name with accents folded, so
|
||||
/// Čeština sits under C rather than after Z. Names in other scripts follow the Latin ones in
|
||||
/// code point order: Greek, Cyrillic, Arabic, then the CJK languages.
|
||||
/// code point order: Greek, Cyrillic, Arabic, Devanagari, then the CJK languages.
|
||||
pub fn for_picker() -> Vec<Lang> {
|
||||
let mut rest: Vec<Lang> = Lang::all().filter(|l| l.code() != Lang::EN.code()).collect();
|
||||
rest.sort_by_cached_key(|l| name_sort_key(l.name()));
|
||||
|
||||
@@ -149,6 +149,7 @@ const LOCALES: &[(&str, &[&str], Option<&str>)] = &[
|
||||
("ro", &["ro", "ro-RO", "ro-MD"], Some("Română")),
|
||||
("sl", &["sl", "sl-SI", "SL-si"], Some("Slovenščina")),
|
||||
("bs", &["bs", "bs-BA", "bs-Latn-BA"], Some("Bosanski")),
|
||||
("hi", &["hi", "hi-IN", "hi_IN.UTF-8", "hi-Deva-IN"], Some("हिन्दी")),
|
||||
("ar", &["ar", "ar-MA", "ar_EG.UTF-8", "AR-sa", "ar-Arab-AE"], None),
|
||||
];
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ use craft::behavior::{EditEvent, MotionMode, keyed};
|
||||
use craft::ui::buttons::Button;
|
||||
use craft::ui::contract::{Bind, Entry, Props as _, Show, ShowCollection, ShowContainer};
|
||||
use craft::ui::display::{Elide, Shade, Text};
|
||||
use craft::ui::form::{SliderField, SliderFieldLayout};
|
||||
use craft::ui::form::{FieldDecimals, SliderField, SliderFieldLayout};
|
||||
use craft::ui::layout_components::Row;
|
||||
use craft::ui::list::{List, ListRow};
|
||||
use craft::ui::patterns::preferences::{GroupSpec, PageSpec, PrefValue, PreferencesModel, PreferencesPage, RowKind, RowSpec};
|
||||
@@ -778,6 +778,7 @@ impl OptionsModel<'_> {
|
||||
let rate = f64::from(self.app.session.read_aloud.rate());
|
||||
let out = SliderField::new(tl!("Speed"), Bind::given(rate), f64::from(MIN_RATE)..=f64::from(MAX_RATE))
|
||||
.step(0.05)
|
||||
.field_decimals(FieldDecimals::Fixed(2))
|
||||
.layout(SliderFieldLayout::Inline)
|
||||
.short(true)
|
||||
.unit(tl!("×"))
|
||||
|
||||
@@ -8,7 +8,7 @@ use serde_json::Value;
|
||||
use super::{Ui, WordApp, json};
|
||||
|
||||
/// The proofing languages the Language menu offers: tag and English name (translated when drawn).
|
||||
pub(crate) const PROOFING_LANGUAGES: [(&str, &str); 16] = [
|
||||
pub(crate) const PROOFING_LANGUAGES: [(&str, &str); 17] = [
|
||||
("en-US", "English (United States)"),
|
||||
("en-GB", "English (United Kingdom)"),
|
||||
("en-AU", "English (Australia)"),
|
||||
@@ -21,6 +21,7 @@ pub(crate) const PROOFING_LANGUAGES: [(&str, &str); 16] = [
|
||||
("ru-RU", "Russian"),
|
||||
("cs-CZ", "Czech"),
|
||||
("id-ID", "Indonesian"),
|
||||
("hi-IN", "Hindi"),
|
||||
("es-ES", "Spanish (Spain)"),
|
||||
("es-MX", "Spanish (Mexico)"),
|
||||
("es-419", "Spanish (Latin America)"),
|
||||
|
||||
+238
-50
@@ -858,12 +858,13 @@ fn decode_zip_name<'a>(mut raw: &'a [u8], utf8: bool, extra: &'a [u8]) -> Option
|
||||
}
|
||||
}
|
||||
|
||||
/// Reject records the reader cannot include in its central table. `by_index_raw`
|
||||
/// would parse local headers, initialize data-start caches and seek the archive;
|
||||
/// do not make directory identity depend on opening a part a second time.
|
||||
/// The walk already bounds these fields to their 16-bit lengths. Reader-rejected
|
||||
/// metadata leaves identity unknown rather than allowing a retry to invent duplicates.
|
||||
fn reader_accepts_central_record(header: &[u8], extra: &[u8], comment: &[u8], directory_start: u64) -> Option<()> {
|
||||
/// Reject records the reader cannot include in its central table, returning the resolved
|
||||
/// `(local_header_offset, compressed_size)` pair on acceptance. `by_index_raw` would parse local
|
||||
/// headers, initialize data-start caches and seek the archive; do not make directory identity
|
||||
/// depend on opening a part a second time. The walk already bounds these fields to their 16-bit
|
||||
/// lengths. Reader-rejected metadata leaves identity unknown rather than allowing a retry to
|
||||
/// invent duplicates.
|
||||
fn reader_accepts_central_record(header: &[u8], extra: &[u8], comment: &[u8], directory_start: u64) -> Option<(u64, u64)> {
|
||||
let mut local = u64::from(u32_at(header, 42)?);
|
||||
let mut compressed = u64::from(u32_at(header, 20)?);
|
||||
let mut uncompressed = u64::from(u32_at(header, 24)?);
|
||||
@@ -932,7 +933,7 @@ fn reader_accepts_central_record(header: &[u8], extra: &[u8], comment: &[u8], di
|
||||
}
|
||||
// The reader checks the final method after applying AES extra fields and the
|
||||
// final ZIP64 local offset before accepting this record into its table.
|
||||
if (method == 99 && !aes) || local >= directory_start { None } else { Some(()) }
|
||||
if (method == 99 && !aes) || local >= directory_start { None } else { Some((local, compressed)) }
|
||||
}
|
||||
|
||||
/// CP437's upper half; ASCII/control bytes in the lower half keep their byte values.
|
||||
@@ -986,15 +987,22 @@ fn reader_checked_directory<'a>(
|
||||
) -> (Option<CentralDirectory<'a>>, bool) {
|
||||
let selection = find_eocd(bytes);
|
||||
let cd = selection.as_ref().and_then(|selected| central_directory(bytes, limit, selected));
|
||||
let structural_disagreement = selection.as_ref().is_some_and(|selected| {
|
||||
let reader_matches = cd.as_ref().is_some_and(|dir| dir.consistent && directory_matches_reader(dir, zip));
|
||||
let disputed = selection.as_ref().is_some_and(|selected| {
|
||||
selected.disputed
|
||||
|| (cd.is_none()
|
||||
&& !(selected.exact_end
|
||||
&& reader_matches
|
||||
&& cd.as_ref().is_some_and(|dir| !dir.truncated && competing_footers_unreachable(bytes, selected, dir)))
|
||||
});
|
||||
let structural_disagreement = disputed
|
||||
|| selection.as_ref().is_some_and(|selected| {
|
||||
cd.is_none()
|
||||
&& selected
|
||||
.directory
|
||||
.as_ref()
|
||||
.is_some_and(|directory| usize::try_from(directory.start).ok().and_then(|start| u32_at(bytes, start)) == Some(0x0201_4B50)))
|
||||
});
|
||||
if structural_disagreement || cd.as_ref().is_some_and(|dir| !dir.consistent || !directory_matches_reader(dir, zip)) {
|
||||
.is_some_and(|directory| usize::try_from(directory.start).ok().and_then(|start| u32_at(bytes, start)) == Some(0x0201_4B50))
|
||||
});
|
||||
if structural_disagreement || cd.as_ref().is_some_and(|_| !reader_matches) {
|
||||
// A different directory or an inconsistent count can invent duplicates even when
|
||||
// decoded names and the residual agree. No finding may rely on those identities.
|
||||
acc.note("the zip central directory's selection or decoded names disagree with the reader; entry identities are unknown and dependent absence checks were skipped".to_string());
|
||||
@@ -1107,14 +1115,24 @@ impl DirectoryView {
|
||||
}
|
||||
}
|
||||
|
||||
struct EocdCandidate {
|
||||
/// Start of the footer span (the adjacent ZIP64 EOCD record when present, else the ZIP64
|
||||
/// locator 20 bytes before the EOCD when attached, else the EOCD itself).
|
||||
span_start: usize,
|
||||
/// Exclusive end of the EOCD comment (`eocd + 22 + comment_len`).
|
||||
comment_end: usize,
|
||||
directory: Option<DirectoryView>,
|
||||
}
|
||||
|
||||
struct EocdSelection {
|
||||
directory: Option<DirectoryView>,
|
||||
/// Whether the first (latest) selected candidate's comment ended at EOF.
|
||||
exact_end: bool,
|
||||
disputed: bool,
|
||||
}
|
||||
|
||||
/// The locator-targeted ZIP64 record only; never follow the reader's forward scan.
|
||||
fn zip64_directory(bytes: &[u8], eocd: usize) -> Option<DirectoryView> {
|
||||
let locator = eocd.checked_sub(20)?;
|
||||
/// Outer-file offset of an adjacent ZIP64 EOCD record referenced by `locator`.
|
||||
fn zip64_adjacent_record_start(bytes: &[u8], locator: usize) -> Option<usize> {
|
||||
if u32_at(bytes, locator)? != 0x0706_4B50 {
|
||||
return None;
|
||||
}
|
||||
@@ -1124,13 +1142,16 @@ fn zip64_directory(bytes: &[u8], eocd: usize) -> Option<DirectoryView> {
|
||||
return None;
|
||||
}
|
||||
let size = u64_at(bytes, off + 4)?;
|
||||
let count = u64_at(bytes, off + 32)?;
|
||||
let cd_off = u64_at(bytes, off + 48)?;
|
||||
// The locator is only a hint to the reader. A non-adjacent record can steer this
|
||||
// parser to a decoy; reject it rather than following the reader's forward scan.
|
||||
if size < 44
|
||||
|| size.checked_add(12)? != expected
|
||||
|| u32_at(bytes, locator + 16)? > 1
|
||||
(size >= 44 && size.checked_add(12)? == expected).then_some(off)
|
||||
}
|
||||
|
||||
/// The locator-targeted ZIP64 record only; never follow the reader's forward scan.
|
||||
fn zip64_directory(bytes: &[u8], locator: usize, off: usize) -> Option<DirectoryView> {
|
||||
let count = u64_at(bytes, off + 32)?;
|
||||
let cd_off = u64_at(bytes, off + 48)?;
|
||||
if u32_at(bytes, locator + 16)? > 1
|
||||
|| u32_at(bytes, off + 20)? != u32_at(bytes, locator + 4)?
|
||||
|| u32_at(bytes, off + 16)? != u32_at(bytes, off + 20)?
|
||||
|| u64_at(bytes, off + 24)? > count
|
||||
@@ -1142,6 +1163,198 @@ fn zip64_directory(bytes: &[u8], eocd: usize) -> Option<DirectoryView> {
|
||||
Some(DirectoryView { start: cd_off, count, zip64: true, footer_consistent: true })
|
||||
}
|
||||
|
||||
/// Inspect a single EOCD signature at `i`, advancing `last_header` backward as needed.
|
||||
/// Returns `None` when `i` is not a finder-acceptable candidate.
|
||||
fn eocd_candidate_at(bytes: &[u8], i: usize, last_header: &mut Option<usize>) -> Option<EocdCandidate> {
|
||||
const CDFH: [u8; 4] = [0x50, 0x4B, 0x01, 0x02];
|
||||
let comment_end = i.checked_add(22)?.checked_add(usize::from(u16_at(bytes, i + 20)?))?;
|
||||
if comment_end > bytes.len() {
|
||||
return None;
|
||||
}
|
||||
if last_header.is_some_and(|header| header.checked_add(4).is_none_or(|after| after > i)) {
|
||||
*last_header = bytes.get(..i)?.windows(4).rposition(|w| w == CDFH);
|
||||
}
|
||||
let total = u64::from(u16_at(bytes, i + 10)?);
|
||||
let offset = u64::from(u32_at(bytes, i + 16)?);
|
||||
let locator =
|
||||
(total == 0xFFFF || offset == 0xFFFF_FFFF).then(|| i.checked_sub(20)).flatten().filter(|&loc| u32_at(bytes, loc) == Some(0x0706_4B50));
|
||||
let (directory, span_start) = if let Some(loc) = locator {
|
||||
// An unsupported locator target is not permission to choose an earlier
|
||||
// footer: the reader may accept it by scanning. Keep identity unknown.
|
||||
match zip64_adjacent_record_start(bytes, loc) {
|
||||
Some(record_off) => (zip64_directory(bytes, loc, record_off), record_off),
|
||||
None => (None, loc),
|
||||
}
|
||||
} else {
|
||||
if total != 0
|
||||
&& (offset >= u64::try_from(i).ok()? || !last_header.is_some_and(|header| u64::try_from(header).is_ok_and(|header| header >= offset)))
|
||||
{
|
||||
return None;
|
||||
}
|
||||
// read.rs uses files-on-this-disk for ZIP32, not the total field.
|
||||
let count = u64::from(u16_at(bytes, i + 8)?);
|
||||
let dir = DirectoryView {
|
||||
start: offset,
|
||||
count,
|
||||
zip64: false,
|
||||
// Disk mismatch is rejected only after spec.rs selects this footer.
|
||||
// Reject its identities rather than silently selecting an earlier one.
|
||||
footer_consistent: count == total && u16_at(bytes, i + 4)? == u16_at(bytes, i + 6)?,
|
||||
};
|
||||
(Some(dir), i)
|
||||
};
|
||||
Some(EocdCandidate { span_start, comment_end, directory })
|
||||
}
|
||||
|
||||
/// Resolve the local header's compressed size, following the local ZIP64 extra field
|
||||
/// when the 32-bit field holds the `0xFFFF_FFFF` sentinel.
|
||||
fn local_compressed_size(local_header: &[u8], local_extra: &[u8]) -> Option<u64> {
|
||||
let raw = u32_at(local_header, 18)?;
|
||||
if raw != u32::MAX {
|
||||
return Some(u64::from(raw));
|
||||
}
|
||||
let mut offset = 0usize;
|
||||
while offset < local_extra.len() {
|
||||
let tag = u16_at(local_extra, offset)?;
|
||||
let len = usize::from(u16_at(local_extra, offset + 2)?);
|
||||
offset = offset.checked_add(4)?;
|
||||
let end = offset.checked_add(len)?;
|
||||
let field = local_extra.get(offset..end)?;
|
||||
if tag == 0x0001 {
|
||||
// APPNOTE §4.5.3: local ZIP64 extra field stores uncompressed (0..8) then compressed (8..16).
|
||||
return u64_at(field, 8);
|
||||
}
|
||||
offset = end;
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
/// Verified `[data_start, data_end)` payload range for one central-directory record.
|
||||
/// Confirms local header signature, filename bytes, compression method, data-descriptor flag
|
||||
/// consistency, and compressed-size agreement (allowing zeroed local sizes when the
|
||||
/// data-descriptor flag is set), while permitting legitimate local vs central extra-field
|
||||
/// differences. Bounded strictly before the central directory.
|
||||
fn entry_payload_span(
|
||||
bytes: &[u8],
|
||||
local_offset: u64,
|
||||
compressed_size: u64,
|
||||
central_header: &[u8],
|
||||
central_name: &[u8],
|
||||
directory_start: u64,
|
||||
) -> Option<(usize, usize)> {
|
||||
let local = usize::try_from(local_offset).ok()?;
|
||||
let local_header = bytes.get(local..local.checked_add(30)?)?;
|
||||
if u32_at(local_header, 0)? != 0x0403_4B50 {
|
||||
return None;
|
||||
}
|
||||
let name_len = usize::from(u16_at(local_header, 26)?);
|
||||
let extra_len = usize::from(u16_at(local_header, 28)?);
|
||||
let name_start = local.checked_add(30)?;
|
||||
let name_end = name_start.checked_add(name_len)?;
|
||||
if bytes.get(name_start..name_end)? != central_name {
|
||||
return None;
|
||||
}
|
||||
let data_start = name_end.checked_add(extra_len)?;
|
||||
let local_extra = bytes.get(name_end..data_start)?;
|
||||
if u16_at(local_header, 8)? != u16_at(central_header, 10)? {
|
||||
return None;
|
||||
}
|
||||
let local_dd = u16_at(local_header, 6)? & 0x0008 != 0;
|
||||
let central_dd = u16_at(central_header, 8)? & 0x0008 != 0;
|
||||
if local_dd != central_dd {
|
||||
return None;
|
||||
}
|
||||
if local_dd {
|
||||
let zeroed_local = u32_at(local_header, 18)? == 0 && u32_at(local_header, 22)? == 0;
|
||||
if !zeroed_local && local_compressed_size(local_header, local_extra)? != compressed_size {
|
||||
return None;
|
||||
}
|
||||
} else if local_compressed_size(local_header, local_extra)? != compressed_size {
|
||||
return None;
|
||||
}
|
||||
let compressed = usize::try_from(compressed_size).ok()?;
|
||||
let data_end = data_start.checked_add(compressed)?;
|
||||
let cd_start = usize::try_from(directory_start).ok()?;
|
||||
(data_end <= cd_start && data_end <= bytes.len()).then_some((data_start, data_end))
|
||||
}
|
||||
|
||||
/// Verified payload interval of the final record in a complete central directory, provided it is
|
||||
/// also physically last: every preceding central record must have a verified local-header payload
|
||||
/// ending at or before this entry's local header (so no other entry extends past its payload end
|
||||
/// or overlaps it). Only that central-and-physically-last record may shield a competing earlier
|
||||
/// footer.
|
||||
fn final_entry_payload_span(bytes: &[u8], dir: &CentralDirectory) -> Option<(usize, usize)> {
|
||||
if dir.total == 0 {
|
||||
return None;
|
||||
}
|
||||
let mut i = usize::try_from(dir.start).ok()?;
|
||||
let mut max_other_end = 0usize;
|
||||
for idx in 0..dir.total {
|
||||
if u32_at(bytes, i)? != 0x0201_4B50 {
|
||||
return None;
|
||||
}
|
||||
let name_len = usize::from(u16_at(bytes, i + 28)?);
|
||||
let extra_len = usize::from(u16_at(bytes, i + 30)?);
|
||||
let comment_len = usize::from(u16_at(bytes, i + 32)?);
|
||||
let header = bytes.get(i..i + 46)?;
|
||||
let name = bytes.get(i + 46..i + 46 + name_len)?;
|
||||
let extra = bytes.get(i + 46 + name_len..i + 46 + name_len + extra_len)?;
|
||||
let comment = bytes.get(i + 46 + name_len + extra_len..i + 46 + name_len + extra_len + comment_len)?;
|
||||
let next = i.checked_add(46 + name_len + extra_len + comment_len)?;
|
||||
bytes.get(..next)?;
|
||||
let (local, compressed) = reader_accepts_central_record(header, extra, comment, dir.start)?;
|
||||
let (data_start, data_end) = entry_payload_span(bytes, local, compressed, header, name, dir.start)?;
|
||||
if idx + 1 == dir.total {
|
||||
let local_start = usize::try_from(local).ok()?;
|
||||
return (max_other_end <= local_start).then_some((data_start, data_end));
|
||||
}
|
||||
max_other_end = max_other_end.max(data_end);
|
||||
i = next;
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
/// Whether every competing earlier EOCD candidate is provably unreachable: the first (latest)
|
||||
/// candidate already ends at EOF and matched the reader across its full central directory, and
|
||||
/// every disagreeing earlier candidate ends before EOF and lies entirely within the verified
|
||||
/// local-header payload of the central-and-physically-last entry (e.g. a trailing stored nested
|
||||
/// ZIP).
|
||||
fn competing_footers_unreachable(bytes: &[u8], selected: &EocdSelection, dir: &CentralDirectory) -> bool {
|
||||
const SIG: [u8; 4] = [0x50, 0x4B, 0x05, 0x06];
|
||||
const CDFH: [u8; 4] = [0x50, 0x4B, 0x01, 0x02];
|
||||
let Some(first_tuple) = selected.directory.as_ref().map(DirectoryView::tuple) else {
|
||||
return false;
|
||||
};
|
||||
let Some((payload_start, payload_end)) = final_entry_payload_span(bytes, dir) else {
|
||||
return false;
|
||||
};
|
||||
let start = bytes.len().saturating_sub(22 + 0xFFFF);
|
||||
let Some(end) = bytes.len().checked_sub(22) else {
|
||||
return false;
|
||||
};
|
||||
let mut last_header = bytes.get(..end).and_then(|prefix| prefix.windows(4).rposition(|w| w == CDFH));
|
||||
let mut seen_first = false;
|
||||
for i in (start..=end).rev() {
|
||||
if bytes.get(i..i + 4) != Some(&SIG) {
|
||||
continue;
|
||||
}
|
||||
let Some(candidate) = eocd_candidate_at(bytes, i, &mut last_header) else {
|
||||
continue;
|
||||
};
|
||||
if !seen_first {
|
||||
seen_first = true;
|
||||
continue;
|
||||
}
|
||||
if candidate.directory.as_ref().map(DirectoryView::tuple) == Some(first_tuple) {
|
||||
continue;
|
||||
}
|
||||
if candidate.comment_end >= bytes.len() || candidate.span_start < payload_start || candidate.comment_end > payload_end {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
seen_first
|
||||
}
|
||||
|
||||
/// Select in the reader's backward order, then reject competing selection tuples.
|
||||
/// Exact-comment-end remains a layout eligibility guard, never a selection rule:
|
||||
/// removing it would newly parse trailing-data archives frozen as unsupported.
|
||||
@@ -1162,44 +1375,19 @@ fn find_eocd(bytes: &[u8]) -> Option<EocdSelection> {
|
||||
}
|
||||
let comment_end = i.checked_add(22)?.checked_add(usize::from(u16_at(bytes, i + 20)?))?;
|
||||
exact_end |= comment_end == bytes.len();
|
||||
if comment_end > bytes.len() {
|
||||
let Some(candidate) = eocd_candidate_at(bytes, i, &mut last_header) else {
|
||||
continue;
|
||||
}
|
||||
if last_header.is_some_and(|header| header.checked_add(4).is_none_or(|after| after > i)) {
|
||||
last_header = bytes.get(..i)?.windows(4).rposition(|w| w == CDFH);
|
||||
}
|
||||
let total = u64::from(u16_at(bytes, i + 10)?);
|
||||
let offset = u64::from(u32_at(bytes, i + 16)?);
|
||||
let zip64 = (total == 0xFFFF || offset == 0xFFFF_FFFF) && i.checked_sub(20).and_then(|locator| u32_at(bytes, locator)) == Some(0x0706_4B50);
|
||||
let directory = if zip64 {
|
||||
// An unsupported locator target is not permission to choose an earlier
|
||||
// footer: the reader may accept it by scanning. Keep identity unknown.
|
||||
zip64_directory(bytes, i)
|
||||
} else {
|
||||
if total != 0
|
||||
&& (offset >= u64::try_from(i).ok()? || !last_header.is_some_and(|header| u64::try_from(header).is_ok_and(|header| header >= offset)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// read.rs uses files-on-this-disk for ZIP32, not the total field.
|
||||
let count = u64::from(u16_at(bytes, i + 8)?);
|
||||
Some(DirectoryView {
|
||||
start: offset,
|
||||
count,
|
||||
zip64: false,
|
||||
// Disk mismatch is rejected only after spec.rs selects this footer.
|
||||
// Reject its identities rather than silently selecting an earlier one.
|
||||
footer_consistent: count == total && u16_at(bytes, i + 4)? == u16_at(bytes, i + 6)?,
|
||||
})
|
||||
};
|
||||
if let Some(first) = selected.as_mut() {
|
||||
// No tuple can be established for an unsupported ZIP64 target. It
|
||||
// cannot certify agreement with another candidate either.
|
||||
if first.directory.as_ref().map(DirectoryView::tuple) != directory.as_ref().map(DirectoryView::tuple) || directory.is_none() {
|
||||
if first.directory.as_ref().map(DirectoryView::tuple) != candidate.directory.as_ref().map(DirectoryView::tuple)
|
||||
|| candidate.directory.is_none()
|
||||
{
|
||||
first.disputed = true;
|
||||
}
|
||||
} else {
|
||||
selected = Some(EocdSelection { directory, disputed: false });
|
||||
selected = Some(EocdSelection { directory: candidate.directory, exact_end: candidate.comment_end == bytes.len(), disputed: false });
|
||||
}
|
||||
}
|
||||
if exact_end { selected } else { None }
|
||||
|
||||
@@ -140,6 +140,42 @@ fn le16(v: &mut Vec<u8>, x: u16) {
|
||||
fn le32(v: &mut Vec<u8>, x: u32) {
|
||||
v.extend_from_slice(&x.to_le_bytes());
|
||||
}
|
||||
fn le64(v: &mut Vec<u8>, x: u64) {
|
||||
v.extend_from_slice(&x.to_le_bytes());
|
||||
}
|
||||
fn write_zip64_eocd(out: &mut Vec<u8>, count: u64, cd_size: u64, cd_off: u64) -> usize {
|
||||
let off = out.len();
|
||||
le32(out, 0x0606_4B50);
|
||||
le64(out, 44);
|
||||
le16(out, 45);
|
||||
le16(out, 45);
|
||||
le32(out, 0);
|
||||
le32(out, 0);
|
||||
le64(out, count);
|
||||
le64(out, count);
|
||||
le64(out, cd_size);
|
||||
le64(out, cd_off);
|
||||
off
|
||||
}
|
||||
fn write_zip64_locator(out: &mut Vec<u8>, z64_off: u64, total_disks: u32) -> usize {
|
||||
let off = out.len();
|
||||
le32(out, 0x0706_4B50);
|
||||
le32(out, 0);
|
||||
le64(out, z64_off);
|
||||
le32(out, total_disks);
|
||||
off
|
||||
}
|
||||
fn plain_zip64(recs: &[Rec]) -> (Vec<u8>, usize, usize) {
|
||||
let mut out = Vec::new();
|
||||
let offs = write_locals(&mut out, recs);
|
||||
let cd = out.len() as u64;
|
||||
write_cd(&mut out, recs, &offs, &all(recs.len()), 0);
|
||||
let size = out.len() as u64 - cd;
|
||||
let z64_off = write_zip64_eocd(&mut out, recs.len() as u64, size, cd);
|
||||
let loc_off = write_zip64_locator(&mut out, z64_off as u64, 1);
|
||||
write_eocd(&mut out, 0xFFFF, 0xFFFF_FFFF, 0xFFFF_FFFF);
|
||||
(out, z64_off, loc_off)
|
||||
}
|
||||
fn write_locals(out: &mut Vec<u8>, recs: &[Rec]) -> Vec<u64> {
|
||||
let mut offs = Vec::new();
|
||||
for r in recs {
|
||||
@@ -366,13 +402,7 @@ fn stored_nested_case(nested: bool) {
|
||||
assert_eq!(a.offset(), 0);
|
||||
assert_eq!(a.central_directory_start(), 4044);
|
||||
let r = run(&format!("stored nested={nested}"), &z);
|
||||
if nested {
|
||||
// The measured ambiguity-retirement run breaks frozen round21/22
|
||||
// outcomes. Keep this disclosed section-5 residual while it still binds.
|
||||
disputed("stored nested residual", &r).unwrap();
|
||||
} else {
|
||||
assert_clean(&r);
|
||||
}
|
||||
assert_clean(&r);
|
||||
}
|
||||
#[test]
|
||||
fn stored_nested_zip() {
|
||||
@@ -382,6 +412,353 @@ fn stored_nested_zip() {
|
||||
fn stored_no_signature_control() {
|
||||
stored_nested_case(false);
|
||||
}
|
||||
#[test]
|
||||
fn stored_nested_zip_non_final_entry_stays_disputed() {
|
||||
// High 1: identical in shape to stored_nested_zip, but with one further ordinary part after
|
||||
// the embedded-zip entry so the embedded zip is NOT the final central-directory record.
|
||||
let inner = plain(&clean_recs(false));
|
||||
for (nested, label) in [(false, "non-final control"), (true, "non-final stored nested zip")] {
|
||||
let body = if nested { inner.clone() } else { vec![b'z'; inner.len()] };
|
||||
let mut recs = clean_recs(false);
|
||||
recs[0] = rec(
|
||||
b"[Content_Types].xml",
|
||||
ct(&[("/word/document.xml", CT_MAIN), ("/word/footnotes.xml", CT_FN), ("/word/embeddings/pkg.bin", "application/octet-stream")]),
|
||||
);
|
||||
recs.push(rec(b"word/embeddings/pkg.bin", body));
|
||||
recs.push(rec(b"word/extra.xml", r#"<?xml version="1.0" encoding="UTF-8"?><x/>"#));
|
||||
let z = plain(&recs);
|
||||
let mut a = zip::ZipArchive::new(Cursor::new(z.as_slice())).unwrap();
|
||||
assert_eq!(a.len(), 7);
|
||||
assert_eq!(a.offset(), 0);
|
||||
for i in 0..a.len() {
|
||||
let mut f = a.by_index(i).unwrap();
|
||||
let mut buf = Vec::new();
|
||||
std::io::Read::read_to_end(&mut f, &mut buf).unwrap();
|
||||
}
|
||||
let r = run(label, &z);
|
||||
if nested {
|
||||
disputed(label, &r).unwrap();
|
||||
assert!(r.coverage_notes.iter().any(|n| n.contains("selection or decoded names disagree")));
|
||||
} else {
|
||||
assert_clean(&r);
|
||||
}
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn stored_nested_zip_cd_last_not_physically_last_stays_disputed() {
|
||||
// Central directory lists the embedded-zip entry last while another entry's data sits
|
||||
// physically after it in the file. Clearance requires the central-last entry to also be
|
||||
// physically last, so the dispute must stay standing.
|
||||
let inner = plain(&clean_recs(false));
|
||||
for (nested, label) in [(false, "cd-last non-physical control"), (true, "cd-last not physically last stored nested zip")] {
|
||||
let body = if nested { inner.clone() } else { vec![b'z'; inner.len()] };
|
||||
let mut recs = clean_recs(false);
|
||||
recs[0] = rec(
|
||||
b"[Content_Types].xml",
|
||||
ct(&[("/word/document.xml", CT_MAIN), ("/word/footnotes.xml", CT_FN), ("/word/embeddings/pkg.bin", "application/octet-stream")]),
|
||||
);
|
||||
recs.push(rec(b"word/embeddings/pkg.bin", body));
|
||||
recs.push(rec(b"word/extra.xml", r#"<?xml version="1.0" encoding="UTF-8"?><x/>"#));
|
||||
let mut z = Vec::new();
|
||||
let offs = write_locals(&mut z, &recs);
|
||||
assert!(offs[6] > offs[5]);
|
||||
let cd = z.len() as u64;
|
||||
write_cd(&mut z, &recs, &offs, &[0, 1, 2, 3, 4, 6, 5], 0);
|
||||
let size = z.len() as u64 - cd;
|
||||
write_eocd(&mut z, recs.len() as u16, size as u32, cd as u32);
|
||||
let mut a = zip::ZipArchive::new(Cursor::new(z.as_slice())).unwrap();
|
||||
assert_eq!(a.len(), 7, "{label}");
|
||||
assert_eq!(a.offset(), 0, "{label}");
|
||||
for i in 0..a.len() {
|
||||
let mut f = a.by_index(i).unwrap();
|
||||
let mut buf = Vec::new();
|
||||
std::io::Read::read_to_end(&mut f, &mut buf).unwrap();
|
||||
}
|
||||
let r = run(label, &z);
|
||||
if nested {
|
||||
disputed(label, &r).unwrap();
|
||||
assert!(r.coverage_notes.iter().any(|n| n.contains("selection or decoded names disagree")), "{label}");
|
||||
} else {
|
||||
assert_clean(&r);
|
||||
}
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn stored_nested_zip_inconsistent_local_header_stays_disputed() {
|
||||
// High 2: stored_nested_zip shape with the final containing entry's local header made
|
||||
// inconsistent with its central record must keep the dispute standing (Incomplete).
|
||||
let inner = plain(&clean_recs(false));
|
||||
let mut recs = clean_recs(false);
|
||||
recs[0] = rec(
|
||||
b"[Content_Types].xml",
|
||||
ct(&[("/word/document.xml", CT_MAIN), ("/word/footnotes.xml", CT_FN), ("/word/embeddings/pkg.bin", "application/octet-stream")]),
|
||||
);
|
||||
recs.push(rec(b"word/embeddings/pkg.bin", inner.clone()));
|
||||
let base = plain(&recs);
|
||||
let local = {
|
||||
let mut a = zip::ZipArchive::new(Cursor::new(base.as_slice())).unwrap();
|
||||
a.by_name("word/embeddings/pkg.bin").unwrap().header_start() as usize
|
||||
};
|
||||
assert_eq!(&base[local..local + 4], &[0x50, 0x4B, 0x03, 0x04]);
|
||||
|
||||
// 1. Local compressed size disagrees with central compressed size (no data-descriptor flag).
|
||||
let mut bad_size = base.clone();
|
||||
let wrong_size = (inner.len() as u32).saturating_sub(1);
|
||||
bad_size[local + 18..local + 22].copy_from_slice(&wrong_size.to_le_bytes());
|
||||
|
||||
// 2. Local filename bytes disagree with central record's name (same length, same data_start).
|
||||
let mut bad_name = base.clone();
|
||||
let name_len = u16::from_le_bytes(bad_name[local + 26..local + 28].try_into().unwrap()) as usize;
|
||||
bad_name[local + 30 + name_len - 1] = b'x';
|
||||
|
||||
// 3. Data-descriptor bit set only in local header (central flag remains 0) with zeroed local sizes.
|
||||
let mut bad_dd = base.clone();
|
||||
bad_dd[local + 6..local + 8].copy_from_slice(&0x0008u16.to_le_bytes());
|
||||
bad_dd[local + 18..local + 22].copy_from_slice(&0u32.to_le_bytes());
|
||||
bad_dd[local + 22..local + 26].copy_from_slice(&0u32.to_le_bytes());
|
||||
|
||||
for (label, z) in [
|
||||
("inconsistent local compressed size", bad_size),
|
||||
("inconsistent local filename", bad_name),
|
||||
("inconsistent local data-descriptor flag", bad_dd),
|
||||
] {
|
||||
let mut a = zip::ZipArchive::new(Cursor::new(z.as_slice())).unwrap();
|
||||
assert_eq!(a.len(), 6, "{label}");
|
||||
assert_eq!(a.offset(), 0, "{label}");
|
||||
for i in 0..a.len() {
|
||||
let mut f = a.by_index(i).unwrap();
|
||||
let mut buf = Vec::new();
|
||||
std::io::Read::read_to_end(&mut f, &mut buf).unwrap();
|
||||
}
|
||||
let r = run(label, &z);
|
||||
disputed(label, &r).unwrap();
|
||||
assert!(r.coverage_notes.iter().any(|n| n.contains("selection or decoded names disagree")), "{label}");
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn stored_nested_zip_legitimate_local_header_variants_pass() {
|
||||
// High 2 positive boundaries: data-descriptor flag with zeroed local sizes and legitimate
|
||||
// local-vs-central extra-field differences must remain accepted for the final entry.
|
||||
let inner = plain(&clean_recs(false));
|
||||
let mut recs = clean_recs(false);
|
||||
recs[0] = rec(
|
||||
b"[Content_Types].xml",
|
||||
ct(&[("/word/document.xml", CT_MAIN), ("/word/footnotes.xml", CT_FN), ("/word/embeddings/pkg.bin", "application/octet-stream")]),
|
||||
);
|
||||
recs.push(rec(b"word/embeddings/pkg.bin", inner.clone()));
|
||||
|
||||
// Variant 1: data-descriptor flag set in both local and central headers, zeroed local sizes,
|
||||
// trailing 16-byte data descriptor before the central directory.
|
||||
{
|
||||
let mut out = Vec::new();
|
||||
let mut offs = write_locals(&mut out, &recs[..recs.len() - 1]);
|
||||
let last = recs.last().unwrap();
|
||||
offs.push(out.len() as u64);
|
||||
let crc = crc32(&last.body);
|
||||
let len = last.body.len() as u32;
|
||||
le32(&mut out, 0x0403_4B50);
|
||||
le16(&mut out, 20);
|
||||
le16(&mut out, last.flags | 0x0008);
|
||||
le16(&mut out, 0);
|
||||
le16(&mut out, 0);
|
||||
le16(&mut out, 0x21);
|
||||
le32(&mut out, 0);
|
||||
le32(&mut out, 0);
|
||||
le32(&mut out, 0);
|
||||
le16(&mut out, last.name.len() as u16);
|
||||
le16(&mut out, 0);
|
||||
out.extend_from_slice(&last.name);
|
||||
out.extend_from_slice(&last.body);
|
||||
le32(&mut out, 0x0807_4B50);
|
||||
le32(&mut out, crc);
|
||||
le32(&mut out, len);
|
||||
le32(&mut out, len);
|
||||
let cd = out.len() as u64;
|
||||
let mut cd_recs = recs.clone();
|
||||
cd_recs.last_mut().unwrap().flags |= 0x0008;
|
||||
write_cd(&mut out, &cd_recs, &offs, &all(cd_recs.len()), 0);
|
||||
let size = out.len() as u64 - cd;
|
||||
write_eocd(&mut out, cd_recs.len() as u16, size as u32, cd as u32);
|
||||
assert_clean(&run("stored nested zip with data descriptor", &out));
|
||||
}
|
||||
|
||||
// Variant 2: local header carries an extra field absent from the central directory record.
|
||||
{
|
||||
let mut out = Vec::new();
|
||||
let mut offs = write_locals(&mut out, &recs[..recs.len() - 1]);
|
||||
let last = recs.last().unwrap();
|
||||
offs.push(out.len() as u64);
|
||||
let local_extra = [0xFE, 0xCA, 0x04, 0x00, 1, 2, 3, 4];
|
||||
le32(&mut out, 0x0403_4B50);
|
||||
le16(&mut out, 20);
|
||||
le16(&mut out, last.flags);
|
||||
le16(&mut out, 0);
|
||||
le16(&mut out, 0);
|
||||
le16(&mut out, 0x21);
|
||||
le32(&mut out, crc32(&last.body));
|
||||
le32(&mut out, last.body.len() as u32);
|
||||
le32(&mut out, last.body.len() as u32);
|
||||
le16(&mut out, last.name.len() as u16);
|
||||
le16(&mut out, local_extra.len() as u16);
|
||||
out.extend_from_slice(&last.name);
|
||||
out.extend_from_slice(&local_extra);
|
||||
out.extend_from_slice(&last.body);
|
||||
let cd = out.len() as u64;
|
||||
write_cd(&mut out, &recs, &offs, &all(recs.len()), 0);
|
||||
let size = out.len() as u64 - cd;
|
||||
write_eocd(&mut out, recs.len() as u16, size as u32, cd as u32);
|
||||
assert_clean(&run("stored nested zip with local-only extra field", &out));
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn stored_nested_zip64_embedded_final_entry_passes() {
|
||||
// An embedded ZIP64 archive as the central-and-physically-last entry clears cleanly whether
|
||||
// its locator holds an inner-relative offset or an outer-file offset inside the payload.
|
||||
let (inner_rel, inner_z64, inner_loc) = plain_zip64(&clean_recs(false));
|
||||
assert_eq!(zip::ZipArchive::new(Cursor::new(inner_rel.as_slice())).unwrap().len(), 5);
|
||||
let mut recs = clean_recs(false);
|
||||
recs[0] = rec(
|
||||
b"[Content_Types].xml",
|
||||
ct(&[("/word/document.xml", CT_MAIN), ("/word/footnotes.xml", CT_FN), ("/word/embeddings/pkg.bin", "application/octet-stream")]),
|
||||
);
|
||||
recs.push(rec(b"word/embeddings/pkg.bin", inner_rel.clone()));
|
||||
let z_rel = plain(&recs);
|
||||
let payload_start = {
|
||||
let mut a = zip::ZipArchive::new(Cursor::new(z_rel.as_slice())).unwrap();
|
||||
assert_eq!(a.len(), 6);
|
||||
assert_eq!(a.offset(), 0);
|
||||
a.by_name("word/embeddings/pkg.bin").unwrap().data_start() as usize
|
||||
};
|
||||
assert_clean(&run("stored nested zip64 (inner-relative locator)", &z_rel));
|
||||
|
||||
let mut inner_outer = inner_rel;
|
||||
let outer_z64 = (payload_start + inner_z64) as u64;
|
||||
inner_outer[inner_loc + 8..inner_loc + 16].copy_from_slice(&outer_z64.to_le_bytes());
|
||||
recs.pop();
|
||||
recs.push(rec(b"word/embeddings/pkg.bin", inner_outer));
|
||||
let z_outer = plain(&recs);
|
||||
assert_clean(&run("stored nested zip64 (outer-adjusted record inside payload)", &z_outer));
|
||||
}
|
||||
#[test]
|
||||
fn stored_nested_zip64_record_outside_payload_stays_disputed() {
|
||||
// Comment B: a competing ZIP64 footer whose adjacent ZIP64 EOCD record lies outside the final
|
||||
// entry's payload (in its local-header extra field) while the locator+EOCD start at
|
||||
// payload_start must NOT clear the dispute.
|
||||
for (label, total_disks) in
|
||||
[("straddling zip64 record outside payload (valid metadata)", 1u32), ("straddling zip64 record outside payload (multi-disk locator)", 2u32)]
|
||||
{
|
||||
let mut recs = clean_recs(false);
|
||||
recs[0] = rec(
|
||||
b"[Content_Types].xml",
|
||||
ct(&[("/word/document.xml", CT_MAIN), ("/word/footnotes.xml", CT_FN), ("/word/embeddings/pkg.bin", "application/octet-stream")]),
|
||||
);
|
||||
let mut out = Vec::new();
|
||||
let mut offs = write_locals(&mut out, &recs);
|
||||
let pkg_local = out.len();
|
||||
offs.push(pkg_local as u64);
|
||||
let pkg_name = b"word/embeddings/pkg.bin";
|
||||
let mut local_extra = Vec::new();
|
||||
le16(&mut local_extra, 0xCAFE);
|
||||
le16(&mut local_extra, 56);
|
||||
let z64_rel_in_extra = write_zip64_eocd(&mut local_extra, 1, 46, 0);
|
||||
assert_eq!(local_extra.len(), 60);
|
||||
let payload_start = pkg_local + 30 + pkg_name.len() + local_extra.len();
|
||||
let z64_outer_off = pkg_local + 30 + pkg_name.len() + z64_rel_in_extra;
|
||||
assert_eq!(z64_outer_off + 56, payload_start);
|
||||
|
||||
let mut payload = Vec::new();
|
||||
write_zip64_locator(&mut payload, z64_outer_off as u64, total_disks);
|
||||
write_eocd(&mut payload, 0xFFFF, 0xFFFF_FFFF, 0xFFFF_FFFF);
|
||||
assert_eq!(payload.len(), 42);
|
||||
|
||||
le32(&mut out, 0x0403_4B50);
|
||||
le16(&mut out, 20);
|
||||
le16(&mut out, 0);
|
||||
le16(&mut out, 0);
|
||||
le16(&mut out, 0);
|
||||
le16(&mut out, 0x21);
|
||||
le32(&mut out, crc32(&payload));
|
||||
le32(&mut out, payload.len() as u32);
|
||||
le32(&mut out, payload.len() as u32);
|
||||
le16(&mut out, pkg_name.len() as u16);
|
||||
le16(&mut out, local_extra.len() as u16);
|
||||
out.extend_from_slice(pkg_name);
|
||||
out.extend_from_slice(&local_extra);
|
||||
assert_eq!(out.len(), payload_start);
|
||||
out.extend_from_slice(&payload);
|
||||
|
||||
recs.push(rec(pkg_name, payload));
|
||||
let cd = out.len() as u64;
|
||||
write_cd(&mut out, &recs, &offs, &all(recs.len()), 0);
|
||||
let size = out.len() as u64 - cd;
|
||||
write_eocd(&mut out, recs.len() as u16, size as u32, cd as u32);
|
||||
|
||||
let mut a = zip::ZipArchive::new(Cursor::new(out.as_slice())).unwrap();
|
||||
assert_eq!(a.len(), 6, "{label}");
|
||||
assert_eq!(a.offset(), 0, "{label}");
|
||||
for i in 0..a.len() {
|
||||
let mut f = a.by_index(i).unwrap();
|
||||
let mut buf = Vec::new();
|
||||
std::io::Read::read_to_end(&mut f, &mut buf).unwrap();
|
||||
}
|
||||
let r = run(label, &out);
|
||||
disputed(label, &r).unwrap();
|
||||
assert!(r.coverage_notes.iter().any(|n| n.contains("selection or decoded names disagree")), "{label}");
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn stored_nested_zip_preserves_outer_defects() {
|
||||
let inner = plain(&clean_recs(false));
|
||||
let mut recs = clean_recs(false);
|
||||
recs[0] = rec(
|
||||
b"[Content_Types].xml",
|
||||
ct(&[("/word/document.xml", CT_MAIN), ("/word/footnotes.xml", CT_FN), ("/word/embeddings/pkg.bin", "application/octet-stream")]),
|
||||
);
|
||||
recs[2] = rec(b"word/document.xml", doc(&fnref("5")));
|
||||
recs.push(rec(b"word/embeddings/pkg.bin", inner));
|
||||
let z = plain(&recs);
|
||||
let r = run("stored nested outer defect", &z);
|
||||
assert_eq!(r.verdict, Verdict::Fail);
|
||||
assert_eq!(rules(&r), ["REF-NOTE@word/document.xml"]);
|
||||
assert!(r.checks_run.contains(&"PKG-DUP-ENTRY"));
|
||||
}
|
||||
#[test]
|
||||
fn stored_payload_forged_eof_eocd_stays_disputed() {
|
||||
// An inner EOCD whose comment length is forged to reach the outer EOF extends beyond
|
||||
// the entry's verified payload span and remains reachable by an exact-EOF reader.
|
||||
let mut inner = plain(&clean_recs(false));
|
||||
let mut recs = clean_recs(false);
|
||||
recs[0] = rec(
|
||||
b"[Content_Types].xml",
|
||||
ct(&[("/word/document.xml", CT_MAIN), ("/word/footnotes.xml", CT_FN), ("/word/embeddings/pkg.bin", "application/octet-stream")]),
|
||||
);
|
||||
recs.push(rec(b"word/embeddings/pkg.bin", inner.clone()));
|
||||
let outer = plain(&recs);
|
||||
let inner_eocd_in_outer = 4044 - 22;
|
||||
let forged_comment = u16::try_from(outer.len() - inner_eocd_in_outer - 22).unwrap();
|
||||
let inner_eocd = inner.len() - 22;
|
||||
inner[inner_eocd + 20..inner_eocd + 22].copy_from_slice(&forged_comment.to_le_bytes());
|
||||
recs.pop();
|
||||
recs.push(rec(b"word/embeddings/pkg.bin", inner));
|
||||
let z = plain(&recs);
|
||||
let r = run("stored payload forged eof eocd", &z);
|
||||
disputed("forged eof eocd inside stored payload", &r).unwrap();
|
||||
}
|
||||
#[test]
|
||||
fn gap_eocd_outside_payload_stays_disputed() {
|
||||
// A competing EOCD placed in an unreferenced gap after the central directory is not inside
|
||||
// any entry's verified payload span, so it must keep disputing the outer footer.
|
||||
let recs = clean_recs(false);
|
||||
let mut z = Vec::new();
|
||||
let offs = write_locals(&mut z, &recs);
|
||||
let start = z.len() as u32;
|
||||
write_cd(&mut z, &recs, &offs, &all(recs.len()), 0);
|
||||
let size = z.len() as u32 - start;
|
||||
write_eocd(&mut z, (recs.len() - 1) as u16, size, start);
|
||||
write_eocd(&mut z, recs.len() as u16, size, start);
|
||||
let r = run("gap eocd outside payload", &z);
|
||||
disputed("gap eocd outside payload", &r).unwrap();
|
||||
}
|
||||
fn untyped_case(reverse: bool) {
|
||||
let mut p = with_footnotes(&["1"], &fnref("5"));
|
||||
p.put("[Content_Types].xml", ct(&[("/word/footnotes.xml", CT_FN)]));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Localization parity with Microsoft Word
|
||||
|
||||
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (Bosnian interface: `bs` in the language list, `bs-BA` system locales, catalog in storytold/craft-i18n); previously trivial (Arabic: the Home tab's Styles gallery reads from the right, its arrows at the left (#5566); readiness unchanged); previously trivial (table sort and formulas read the Panamanian balboa's `B/.` around a number (`B/. 1,250.50`, `1,250.50 B/.`), as Word does, matched only at the ends of the text so `1/.5` stays a fraction); previously trivial (Arabic: the dialogs of the mirrored Arabic interface read right to left: label-and-field rows, tables (list columns, the Models table), tile galleries and the Add/Remove arrows follow the reading direction, through one `rtl::Table` helper that draws exactly as before in English; no ranked gap closed, readiness estimates unchanged); previously minor (Options › Language redesign: Your languages, Add a language…, Set as default; the Dictionaries folder moved from Proofing); previously trivial (Language packs: the missing-pack bar works on a fresh install and counts the caret's language); previously trivial (Language lists: every installed and available Language pack's language can be chosen in Set Proofing Language, installed ones in Review › Language and the status bar; craft-i18n.rev at 9d6d54d: region names and the Language (Region) template in 35 locales, craft-i18n#145); previously trivial (craft-i18n.rev at cde4900: rows for Options › Language, the missing-pack bar and 28 Language pack language names in 35 locales, craft-i18n#136); previously trivial (craft-proof pin: French elision suggestions first, ca-ES-valencia reads the ca-valencia pack); previously minor (Arabic `ar` interface: craft-i18n catalog, mirrored shell, font fallback, #1195; 28 languages); previously trivial (Language packs: language-packs-2 is published and pinned: 75 packs, adding Danish, German (Germany, Austria, Switzerland), Esperanto, Estonian, Persian, Croatian, Hungarian, Norwegian (Bokmål, Nynorsk), Dutch and Swedish (Sweden, Finland)); previously trivial (Language packs: language-packs-1 is published and pinned, 61 packs; the language requests it covers); previously minor (Language packs: languages beyond English install their spelling dictionary and hyphenation as a pack from File › Options › Language or the missing-pack bar; the default build embeds English Language data only) · **Target:** Microsoft Word (Microsoft 365) for Mac 16.113.4
|
||||
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-12-01 · **Change:** minor (Hindi interface: `hi` in the language list, `hi-IN` system locales, Devanagari interface face, catalog in storytold/craft-i18n); previously minor (Bosnian interface: `bs` in the language list, `bs-BA` system locales, catalog in storytold/craft-i18n); previously trivial (Arabic: the Home tab's Styles gallery reads from the right, its arrows at the left (#5566); readiness unchanged); previously trivial (table sort and formulas read the Panamanian balboa's `B/.` around a number (`B/. 1,250.50`, `1,250.50 B/.`), as Word does, matched only at the ends of the text so `1/.5` stays a fraction); previously trivial (Arabic: the dialogs of the mirrored Arabic interface read right to left: label-and-field rows, tables (list columns, the Models table), tile galleries and the Add/Remove arrows follow the reading direction, through one `rtl::Table` helper that draws exactly as before in English; no ranked gap closed, readiness estimates unchanged); previously minor (Options › Language redesign: Your languages, Add a language…, Set as default; the Dictionaries folder moved from Proofing); previously trivial (Language packs: the missing-pack bar works on a fresh install and counts the caret's language); previously trivial (Language lists: every installed and available Language pack's language can be chosen in Set Proofing Language, installed ones in Review › Language and the status bar; craft-i18n.rev at 9d6d54d: region names and the Language (Region) template in 35 locales, craft-i18n#145); previously trivial (craft-i18n.rev at cde4900: rows for Options › Language, the missing-pack bar and 28 Language pack language names in 35 locales, craft-i18n#136); previously trivial (craft-proof pin: French elision suggestions first, ca-ES-valencia reads the ca-valencia pack); previously minor (Arabic `ar` interface: craft-i18n catalog, mirrored shell, font fallback, #1195; 28 languages); previously trivial (Language packs: language-packs-2 is published and pinned: 75 packs, adding Danish, German (Germany, Austria, Switzerland), Esperanto, Estonian, Persian, Croatian, Hungarian, Norwegian (Bokmål, Nynorsk), Dutch and Swedish (Sweden, Finland)); previously trivial (Language packs: language-packs-1 is published and pinned, 61 packs; the language requests it covers); previously minor (Language packs: languages beyond English install their spelling dictionary and hyphenation as a pack from File › Options › Language or the missing-pack bar; the default build embeds English Language data only) · **Target:** Microsoft Word (Microsoft 365) for Mac 16.113.4
|
||||
|
||||
Interface languages, script support and proofing per language. How translation works (adding a
|
||||
language, the embedded catalogs): `crates/ui-egui/src/i18n.rs`. The catalogs, their format and
|
||||
@@ -21,8 +21,8 @@ native-speaker review (human).
|
||||
|
||||
## What WordCraft ships (measured)
|
||||
|
||||
- **29 interface languages**: English plus `zh-hans`, `zh-hant`, `ja`, Korean `ko` (#1216), `uk`, `es`, `pt-br`,
|
||||
Serbian `sr`/`sr-latn` (#250), Estonian `et`, Turkish `tr`, Russian `ru`, Italian `it` (#594), German `de` (#574), Polish `pl`, Czech `cs`, Hungarian `hu`, French `fr`, Bulgarian `bg`, Vietnamese `vi` (#1434), Swedish `sv` (#1219), Croatian `hr` (#1271), Romanian `ro`, Slovenian `sl`, Dutch `nl`, Danish `da` (#2722) Arabic `ar` (#1195) and Bosnian `bs`. Catalogs have 2,061–2,730 entries
|
||||
- **30 interface languages**: English plus `zh-hans`, `zh-hant`, `ja`, Korean `ko` (#1216), `uk`, `es`, `pt-br`,
|
||||
Serbian `sr`/`sr-latn` (#250), Estonian `et`, Turkish `tr`, Russian `ru`, Italian `it` (#594), German `de` (#574), Polish `pl`, Czech `cs`, Hungarian `hu`, French `fr`, Bulgarian `bg`, Vietnamese `vi` (#1434), Swedish `sv` (#1219), Croatian `hr` (#1271), Romanian `ro`, Slovenian `sl`, Dutch `nl`, Danish `da` (#2722) Arabic `ar` (#1195), Bosnian `bs` and Hindi `hi`. Catalogs have 2,061–2,800 entries
|
||||
each; Polish has every key of every other catalog, including the built-in style names and the equation gallery, except the citation style names only Hungarian, Bulgarian, Swedish, Romanian and Slovenian translate so far. A missing translation falls back to English and never fails a test or
|
||||
build. `cargo xtask i18n-report`, part of `cargo xtask ci`, prints per language the interface
|
||||
strings its catalog lacks: everything the interface audit saw looked up, the ribbon tabs, command
|
||||
@@ -61,7 +61,7 @@ shared items below.
|
||||
| English | en | source (100%) | ✅ | Latin ✅ | yes | **full** | 0 |
|
||||
| Simplified Chinese (Mandarin) | zh-hans | 929 entries; 98% of extracted, ~95% of visible | most; newer panes English | CJK ✅, IME ✅; Windows UI font fixed (#248); interface font chain covers every catalog character, installed CJK font after the embedded ones when it doesn't, PingFang found on macOS 12 (#486); font list by Chinese names (宋体, 微软雅黑, #505); word count counts each Han ideograph and kana as a word, not punctuation (#4547); no vertical text | no | partial | 3–5 |
|
||||
| Spanish | es | ~930; 98% / ~95% | most | Latin ✅ | no | partial | 1–2 |
|
||||
| Hindi | hi | 0 | ❌ | Devanagari shaping via HarfRust, untested; no hyphenation | no | none | 4–6 |
|
||||
| Hindi | hi | 2,800 entries (craft-i18n `locales/hi/wordcraft.tsv`) | most; newer panes English | Devanagari interface face (craft-fonts Noto Sans Devanagari); document shaping via HarfRust; no hyphenation; no proofing | yes | partial | 2–4 (proofing, hyphenation) |
|
||||
| Arabic | ar | ~2,730 entries (craft-i18n `locales/ar/wordcraft.tsv`); 98% / ~95% | most; newer panes English | shaping, joining, lam-alef, bidi ✅ (#207); letters join across a change of formatting and past hidden or deleted text ✅ (#4093); mirrored UI ✅ (#1195; dialogs, tables and galleries read right to left); Arabic UI font fallback; no kashida; no proofing | no | partial | 2–4 (review + kashida/proofing elsewhere) |
|
||||
| French | fr | 2,615 entries (complete catalog) | all | Latin ✅ | no | partial (spelling and suggestions from the French Language pack, elided forms first: `Jadore` → `J'adore`; no grammar marks) | 1–2 (grammar) |
|
||||
| Portuguese | pt-br (pt-PT none) | ~930; 98% / ~95% (pt-BR) | most | Latin ✅ | no | partial | 2–4 (pt-BR finish + pt-PT) |
|
||||
@@ -98,6 +98,7 @@ Slovenian (`sl-SI` system locales, `{"value":"sl"}`) has 2,614 entries: every ke
|
||||
catalog. Counts use count-neutral wording (`Besede: 21`); terminology: [`localization-sl.md`](localization-sl.md).
|
||||
Slovenian proofing is not included.
|
||||
Bosnian (`bs-BA` system locales, `{"value":"bs"}`) is Latin script; Cyrillic Bosnian stays in English. Its craft-i18n catalog has 2,508 WordCraft entries plus the shared catalog, with `one|few|other` plural rows. The catalog is an AI-assisted draft not yet reviewed by a native speaker; Bosnian proofing is not included; terminology: [`localization-bs.md`](localization-bs.md).
|
||||
Hindi (`hi-IN` system locales, `{"value":"hi"}`) is Devanagari script, drawn by the craft-fonts Noto Sans Devanagari interface face. Its craft-i18n catalog has 2,800 WordCraft entries plus the shared catalog, an AI-assisted draft reviewed by a native speaker. Hindi proofing is not included, so the Hindi interface doesn't set the language of new documents.
|
||||
Hungarian follows `hu-HU` system locales and `{"value":"hu"}`, with a complete catalog of 2,419 entries: every key of
|
||||
the Russian catalog, built-in style names shown translated, plus the citation style names. Hungarian proofing is not included; terminology and conventions:
|
||||
[`localization-hu.md`](localization-hu.md).
|
||||
@@ -276,6 +277,7 @@ WordCraft keeps 2,54 cm).
|
||||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-12-01 | minor | Hindi interface (`hi`, Devanagari): listed in `LANGUAGES`, `hi-IN` system locales, saved preference and bundled-font tests; catalog in storytold/craft-i18n (`locales/hi/wordcraft.tsv`), `craft-i18n.rev` at 217f413; no Hindi proofing |
|
||||
| 2026-10-29 | minor | Bosnian interface (`bs`, Latin script): listed in `LANGUAGES`, `bs-BA` system locales, saved preference and bundled-font tests; catalog in storytold/craft-i18n (`locales/bs/wordcraft.tsv`); no Bosnian proofing |
|
||||
| 2026-11-06 | trivial | Arabic: the Home tab's Styles gallery reads from the right: Normal is the rightmost tile and the scroll arrows and More sit at the gallery's left end, as the rest of the mirrored ribbon (#5566); left to right is unchanged; regression test `the_styles_gallery_reads_from_the_right_in_a_right_to_left_interface` |
|
||||
| 2026-11-05 | trivial | Arabic letters join across a change of formatting and past hidden or deleted text (#4093) |
|
||||
|
||||
@@ -128,6 +128,6 @@ modules:
|
||||
# the two equal).
|
||||
- type: git
|
||||
url: https://github.com/storytold/craft-i18n
|
||||
commit: e56d26244bbac099bfd42e23fb12f78a4be418a7
|
||||
commit: 217f4130d7d3dbb21a160f23f6b0021918906cc0
|
||||
dest: craft-i18n
|
||||
- cargo-sources.json
|
||||
|
||||
Reference in New Issue
Block a user