diff --git a/crates/calc/src/lib.rs b/crates/calc/src/lib.rs index 794a3f97f..92aa9526c 100644 --- a/crates/calc/src/lib.rs +++ b/crates/calc/src/lib.rs @@ -12,7 +12,7 @@ mod trimrange; pub use eval::{Area, SPECIAL_FUNCTIONS, is_known_function}; pub use precision::DisplayedPrecision; -pub use recalc::{Bounded, Calc, Key, evaluate, evaluate_bounded, now_serial}; +pub use recalc::{Bounded, Calc, Key, evaluate, evaluate_bounded, evaluate_expr, now_serial}; #[cfg(test)] mod tests; diff --git a/crates/engine/src/cmd/edit/paste_special.rs b/crates/engine/src/cmd/edit/paste_special.rs index 9a736cb1d..45b8472e7 100644 --- a/crates/engine/src/cmd/edit/paste_special.rs +++ b/crates/engine/src/cmd/edit/paste_special.rs @@ -421,6 +421,11 @@ pub(super) fn paste_special(s: &mut Session, p: &Json) -> Result { if let (Some(a), Some(b)) = (m.start.offset(dr, dc), m.end.offset(dr, dc)) { let nm = RangeRef::new(a, b); let sh = cx.sheet_mut(dest_sheet)?; + // A table can't hold merged cells (Excel removes the table on open): the + // cells are pasted there unmerged. + if sh.tables.iter().any(|t| t.range.intersects(&nm)) { + continue; + } sh.merges.retain(|x| !x.intersects(&nm)); sh.merges.push(nm); } diff --git a/crates/engine/src/cmd/format.rs b/crates/engine/src/cmd/format.rs index a3f0b03b3..0525e922a 100644 --- a/crates/engine/src/cmd/format.rs +++ b/crates/engine/src/cmd/format.rs @@ -642,6 +642,11 @@ fn merge(s: &mut Session, p: &Json, how: &str) -> Result { let ranges = target_ranges(s, p)?; let how = if how == "center" && s.doc()?.wb.sheet(sheet).is_some_and(|sh| ranges.iter().all(|r| sh.merges.contains(r))) { "unmerge" } else { how }; + // Excel has no merged cells in a table (a file with one loses the table when Excel opens it): + // merging there is refused, unmerging is still allowed. + if how != "unmerge" && s.doc()?.wb.sheet(sheet).is_some_and(|sh| sh.tables.iter().any(|t| ranges.iter().any(|r| t.range.intersects(r)))) { + return Err(EngineError::Other("You can't merge cells in a table.".into())); + } edit(s, |cx| { let mut touched = Vec::new(); // Areas whose merging changes: a merged cell blocks a dynamic array's spill. diff --git a/crates/engine/src/cmd/insert/links.rs b/crates/engine/src/cmd/insert/links.rs index c90fc946a..b0b489295 100644 --- a/crates/engine/src/cmd/insert/links.rs +++ b/crates/engine/src/cmd/insert/links.rs @@ -56,10 +56,10 @@ pub(super) fn open_link(s: &mut Session, p: &Json) -> Result { None => { let sheet = target_sheet(s, p)?; let at = cell_param_on(s, p, "cell", sheet)?.unwrap_or(s.doc()?.selection.active); - let Some(h) = s.doc()?.wb.sheet(sheet).and_then(|sh| sh.hyperlinks.get(&at)) else { + let Some(h) = crate::links::cell_link(&s.doc()?.wb, sheet, at) else { return Err(EngineError::Other("There's no hyperlink in this cell.".into())); }; - h.target.clone() + h.target } }; match crate::links::classify(&target) { diff --git a/crates/engine/src/cmd/insert/table.rs b/crates/engine/src/cmd/insert/table.rs index 2a517766c..9cb6b7202 100644 --- a/crates/engine/src/cmd/insert/table.rs +++ b/crates/engine/src/cmd/insert/table.rs @@ -74,6 +74,13 @@ pub(super) fn insert_table(s: &mut Session, p: &Json) -> Result { RangeRef::new(r.start, CellRef::new((r.end.row + 1).min(MAX_ROWS - 1), r.end.col)) }; let sh = cx.sheet_mut(sheet)?; + // As in Excel, the table unmerges the merged cells it covers: a table can't hold them. + let merged = sh.merges.len(); + sh.merges.retain(|m| !m.intersects(&r)); + if sh.merges.len() != merged { + cx.structural = true; + } + let sh = cx.sheet_mut(sheet)?; let mut names: Vec = Vec::new(); // Lower-case names taken, and the next suffix for each header, so that thousands of equal // headers don't take cubic time. diff --git a/crates/engine/src/cmd/inspect.rs b/crates/engine/src/cmd/inspect.rs index e91a269fb..d6646743d 100644 --- a/crates/engine/src/cmd/inspect.rs +++ b/crates/engine/src/cmd/inspect.rs @@ -136,7 +136,7 @@ fn cell_get(s: &mut Session, p: &Json) -> Result { "style": style, "merge": sh.merge_at(c).map(|m| m.a1()), "comment": sh.comments.get(&c), - "hyperlink": sh.hyperlinks.get(&c), + "hyperlink": crate::links::cell_link(&d.wb, sheet, c), "python": cell.and_then(|x| x.py.as_deref()).map(|py| json!({ "code": py.code, "output": if py.object { "object" } else { "value" }, diff --git a/crates/engine/src/links.rs b/crates/engine/src/links.rs index 4c2318f07..2b26c925b 100644 --- a/crates/engine/src/links.rs +++ b/crates/engine/src/links.rs @@ -9,7 +9,9 @@ //! external addresses; only the host, after showing the address and getting OK from the user, //! opens one through [`crate::Session::open_confirmed_link`], which no command reaches. -use gridcraft_core::RangeRef; +use gridcraft_core::{CellRef, RangeRef}; +use gridcraft_formula::Expr; +use gridcraft_model::{Hyperlink, Workbook}; use serde_json::{Value as Json, json}; use crate::{EngineError, Result, Session, UiRequest}; @@ -86,6 +88,50 @@ pub fn classify(target: &str) -> LinkKind { } } +/// The link of a cell: the one stored with it, or, for a cell whose formula is `HYPERLINK(target, …)`, +/// the target that formula currently evaluates to. A scheme-less web address (`google.com`) is +/// opened over `https`, as Excel does. +pub fn cell_link(wb: &Workbook, sheet: usize, at: CellRef) -> Option { + let sh = wb.sheet(sheet)?; + if let Some(h) = sh.hyperlinks.get(&at) { + return Some(h.clone()); + } + let expr = sh.cell(at)?.formula.as_ref()?.expr()?; + let Expr::Call(name, args) = &expr else { return None }; + if name != "HYPERLINK" { + return None; + } + let value = gridcraft_calc::evaluate_expr(wb, sheet, at, args.first()?); + let target = value.display().trim().to_string(); + if target.is_empty() || matches!(value, gridcraft_core::Value::Error(_)) { + return None; + } + // a defined name or a table of that spelling (`sales.data`) stays an internal target + let internal_name = wb.name(&target, sheet).is_some() || wb.table(&target).is_some(); + let target = if looks_like_web_address(&target) && !internal_name { format!("https://{target}") } else { target }; + let external = !matches!(classify(&target), LinkKind::Internal(_)); + Some(Hyperlink { target, tooltip: None, external }) +} + +fn looks_like_web_address(t: &str) -> bool { + if t.contains(|c: char| c.is_whitespace() || matches!(c, '\\' | '!')) { + return false; + } + // the host ends at the path, query or fragment (`google.com/x`, `google.com?q=1`, `google.com#top`) + let host = t.split(['/', '?', '#']).next().unwrap_or(t); + // with an optional port (`example.com:8443`); any other colon is a scheme or a sheet reference + let host = match host.split_once(':') { + Some((h, port)) if !port.is_empty() && port.len() <= 5 && port.bytes().all(|b| b.is_ascii_digit()) => h, + Some(_) => return false, + None => host, + }; + let Some((_, tld)) = host.rsplit_once('.') else { return false }; + tld.len() >= 2 + && tld.chars().all(|c| c.is_ascii_alphabetic()) + && !["xlsx", "xlsm", "xlsb", "xls", "csv", "txt", "pdf", "doc", "docx"].contains(&tld.to_ascii_lowercase().as_str()) + && RangeRef::parse(t).is_none() +} + #[cfg(test)] mod tests { use super::*; diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 07cc1b936..852982248 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -8172,6 +8172,99 @@ fn history_charges_the_storage_of_empty_comment_replies() { assert!(crate::sheet_text_bytes(&sheet) >= 500 * std::mem::size_of::<(String, String)>()); } +#[test] +fn tables_never_hold_merged_cells() { + // Excel removes a table that contains a merged cell when it opens the file. Merging in a + // table is refused; making or resizing a table over merged cells unmerges them; pasting into + // a table skips the merges. + let base = || { + let mut s = s(); + s.execute("range.setValues", json!({"range": "A1:D4", "values": [["A", "B", "C", "D"], [1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]})) + .unwrap(); + s + }; + let merges = |s: &Session| s.doc().unwrap().wb.active().unwrap().merges.clone(); + + let mut s = base(); + s.execute("insert.table", json!({"range": "A1:C4"})).unwrap(); + for id in ["home.mergeCells", "home.mergeCenter", "home.mergeAcross"] { + for range in ["A2:B2", "A1:B1", "C3:D3"] { + let e = s.execute(id, json!({"range": range})).unwrap_err().to_string(); + assert!(e.contains("can't merge cells in a table"), "{id} {range}: {e}"); + } + } + assert!(merges(&s).is_empty()); + s.execute("home.mergeCells", json!({"range": "E2:F2"})).unwrap(); + assert_eq!(merges(&s), vec![gridcraft_core::RangeRef::parse("E2:F2").unwrap()]); + + // A table over merged cells unmerges them; undo brings them back. + let mut s = base(); + s.execute("home.mergeCells", json!({"range": "A2:B2"})).unwrap(); + s.execute("home.mergeCells", json!({"range": "C3:D4"})).unwrap(); + s.execute("home.mergeCells", json!({"range": "F1:G1"})).unwrap(); + s.execute("insert.table", json!({"range": "A1:C4"})).unwrap(); + assert_eq!(merges(&s), vec![gridcraft_core::RangeRef::parse("F1:G1").unwrap()]); + s.execute("edit.undo", json!({})).unwrap(); + assert_eq!(merges(&s).len(), 3); + s.execute("edit.redo", json!({})).unwrap(); + + // Resizing a table over merged cells is refused, as in Excel; the merge stays. + let mut s = base(); + s.execute("insert.table", json!({"range": "A1:B4", "name": "T"})).unwrap(); + s.execute("home.mergeCells", json!({"range": "C2:D2"})).unwrap(); + let e = s.execute("table.resize", json!({"table": "T", "range": "A1:C4"})).unwrap_err().to_string(); + assert!(e.contains("can't overlap merged cells"), "{e}"); + s.execute("home.unmergeCells", json!({"range": "C2:D2"})).unwrap(); + s.execute("table.resize", json!({"table": "T", "range": "A1:C4"})).unwrap(); + + // Merged cells pasted into a table arrive unmerged; elsewhere they stay merged. + s.execute("home.mergeCells", json!({"range": "E2:F3"})).unwrap(); + s.execute("edit.copy", json!({"range": "E2:F3"})).unwrap(); + s.execute("edit.paste", json!({"at": "A2"})).unwrap(); + s.execute("edit.paste", json!({"at": "H2"})).unwrap(); + assert_eq!(merges(&s), vec![gridcraft_core::RangeRef::parse("E2:F3").unwrap(), gridcraft_core::RangeRef::parse("H2:I3").unwrap()]); + + // The saved file has no merge inside the table. + let saved = s.execute("file.saveBytes", json!({"format": "xlsx"})).unwrap(); + let bytes = crate::io::base64_decode(saved["base64"].as_str().unwrap()).unwrap(); + let (back, _) = crate::io::open_bytes("t.xlsx", &bytes).unwrap(); + let sh = back.active().unwrap(); + assert_eq!(sh.tables.len(), 1); + assert_eq!(sh.tables[0].range, gridcraft_core::RangeRef::parse("A1:C4").unwrap()); + assert!(sh.merges.iter().all(|m| sh.tables.iter().all(|t| !t.range.intersects(m)))); +} + +#[test] +fn hyperlink_function_makes_a_cell_link() { + let mut s = s(); + s.link_policy = crate::links::LinkPolicy::Allow; + s.execute("cell.set", json!({"cell": "A1", "input": "https://example.com/x"})).unwrap(); + s.execute("cell.set", json!({"cell": "B2", "input": "=HYPERLINK(A1,\"Go\")"})).unwrap(); + s.execute("cell.set", json!({"cell": "C3", "input": "=HYPERLINK(\"google.com\")"})).unwrap(); + s.take_ui_requests(); + s.execute("link.open", json!({"cell": "B2"})).unwrap(); + assert_eq!(s.take_ui_requests(), vec![crate::UiRequest::OpenUrl("https://example.com/x".into())]); + s.execute("link.open", json!({"cell": "C3"})).unwrap(); + assert_eq!(s.take_ui_requests(), vec![crate::UiRequest::OpenUrl("https://google.com".into())]); + assert!(s.execute("link.open", json!({"cell": "A1"})).is_err()); + // a scheme-less address with a query, fragment or port opens over https too + for (cell, input, url) in [ + ("D1", "=HYPERLINK(\"google.com?q=rust\")", "https://google.com?q=rust"), + ("D2", "=HYPERLINK(\"google.com#results\")", "https://google.com#results"), + ("D3", "=HYPERLINK(\"example.com:8443/x\")", "https://example.com:8443/x"), + ] { + s.execute("cell.set", json!({"cell": cell, "input": input})).unwrap(); + s.execute("link.open", json!({"cell": cell})).unwrap(); + assert_eq!(s.take_ui_requests(), vec![crate::UiRequest::OpenUrl(url.into())], "{input}"); + } + // a table named like an address stays an internal target + s.execute("range.setValues", json!({"range": "F1:G2", "values": [["a", "b"], [1, 2]]})).unwrap(); + s.execute("insert.table", json!({"range": "F1:G2", "name": "sales.data"})).unwrap(); + s.execute("cell.set", json!({"cell": "D4", "input": "=HYPERLINK(\"sales.data\")"})).unwrap(); + let link = crate::links::cell_link(&s.doc().unwrap().wb, 0, gridcraft_core::CellRef::parse("D4").unwrap()).unwrap(); + assert_eq!(link.target, "sales.data"); +} + /// #1348: the selection a workbook opens with, and the one a sheet gets on its first visit, take /// a merged active cell whole, as a click on it does: a merge at A1 and one elsewhere. A /// selection the sheet remembers comes back as it was, even inside a merged cell. diff --git a/crates/engine/tests/it/command_sequence_fuzz.rs b/crates/engine/tests/it/command_sequence_fuzz.rs index 8b48ae0c4..0b1328685 100644 --- a/crates/engine/tests/it/command_sequence_fuzz.rs +++ b/crates/engine/tests/it/command_sequence_fuzz.rs @@ -12,7 +12,7 @@ //! and saving, reloading or recalculating never panics either; //! - a non-undoable command never changes cell content (it would be lost to undo); //! - the structure stays valid: active sheet in range, sheet and table names valid and unique, -//! merges and tables on the sheet and not overlapping, legacy arrays anchored at their +//! merges and tables on the sheet and not overlapping (nor a merge inside a table), legacy arrays anchored at their //! top-left cell, the selection on the sheet; //! - a full recalculation from scratch gives the values the incremental recalculation left //! (catches stale dependency graphs); @@ -442,6 +442,10 @@ fn structure_problem(wb: &Workbook, sel: &gridcraft_engine::Selection) -> Option if let Some(o) = sh.tables.iter().skip(k + 1).find(|o| overlaps(&t.range, &o.range)) { return Some(format!("{}: tables `{}` ({}) and `{}` ({}) overlap", sh.name, t.name, t.range, o.name, o.range)); } + // Excel removes a table that holds a merged cell when it opens the file. + if let Some(m) = sh.merges.iter().find(|m| overlaps(&t.range, m)) { + return Some(format!("{}: table `{}` ({}) holds merged cells {m}", sh.name, t.name, t.range)); + } } } if sel.ranges.is_empty() || !sel.active.is_valid() || sel.ranges.iter().any(|r| !r.start.is_valid() || !r.end.is_valid()) { diff --git a/crates/engine/tests/it/sheet_copy_spill.rs b/crates/engine/tests/it/sheet_copy_spill.rs index aed68baf9..481f9889e 100644 --- a/crates/engine/tests/it/sheet_copy_spill.rs +++ b/crates/engine/tests/it/sheet_copy_spill.rs @@ -17,7 +17,7 @@ fn value(s: &Session, sheet: &str, cell: &str) -> Value { fn copied_sheet_keeps_spill_values_through_full_recalc() { let mut s = Session::new(); run(&mut s, "file.new", json!({"sample": "grades"})); - run(&mut s, "home.mergeCells", json!({"range": "F:H"})); + run(&mut s, "home.mergeCells", json!({"range": "F15:H20"})); run(&mut s, "cell.set", json!({"cell": "J54", "input": "=SEQUENCE(5)*C6"})); run(&mut s, "selection.set", json!({"range": "15:15"})); run(&mut s, "sheet.move", json!({"copy": true, "sheet": 0, "to": 1})); diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index 4621736d9..f52686101 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -531,7 +531,13 @@ impl Dialog { Choice { key: "operation", label: "Operation", - options: vec![("none", "None"), ("add", "Add"), ("subtract", "Subtract"), ("multiply", "Multiply"), ("divide", "Divide")], + options: vec![ + ("none", "None"), + ("add", "Paste Special|Add"), + ("subtract", "Subtract"), + ("multiply", "Multiply"), + ("divide", "Divide"), + ], }, Check { key: "skipBlanks", label: "Skip blanks" }, Check { key: "transpose", label: "Transpose (E)" }, @@ -673,7 +679,7 @@ impl Dialog { vec![ Check { key: "tab", label: "Tab" }, Check { key: "semicolon", label: "Semicolon" }, - Check { key: "comma", label: "Comma" }, + Check { key: "comma", label: "Text to Columns|Comma" }, Check { key: "space", label: "Space" }, Text { key: "other", label: "Other:" }, Check { key: "treatConsecutive", label: "Treat consecutive delimiters as one" }, diff --git a/crates/ui-egui/src/grid/interact.rs b/crates/ui-egui/src/grid/interact.rs index d11416d68..fdf303930 100644 --- a/crates/ui-egui/src/grid/interact.rs +++ b/crates/ui-egui/src/grid/interact.rs @@ -410,6 +410,13 @@ fn handle_row_header_press(app: &mut SheetApp, input: &InteractionInput<'_>, p: } } +/// The link of cell `c` on the active sheet as the session holds it now: a click may have just +/// committed an edit the frame's workbook snapshot predates (a `HYPERLINK` target cell). +fn current_cell_link(app: &SheetApp, c: CellRef) -> Option { + let d = app.session.active()?; + gridcraft_engine::links::cell_link(&d.wb, d.wb.active_sheet(), c) +} + fn handle_press(app: &mut SheetApp, input: &InteractionInput<'_>) { let (geo, sh, wb, resp) = (input.geo, input.sheet, input.workbook, input.response); let (pos, mods, sel) = (input.position, input.modifiers, &input.selection); @@ -553,7 +560,7 @@ fn handle_press(app: &mut SheetApp, input: &InteractionInput<'_>) { } } else if mods.command || sel_mods.command { // Ctrl+click (without Alt) on a hyperlink's text follows it instead of adding the cell to the selection. - if let Some(h) = sh.hyperlinks.get(&c).cloned() + if let Some(h) = current_cell_link(app, c) && acts && !mods.alt && p.x < geo.cell_rect(sh, c).left() + geo.cell_rect(sh, c).width() * 0.8 @@ -570,7 +577,7 @@ fn handle_press(app: &mut SheetApp, input: &InteractionInput<'_>) { let _ = app.run("cell.toggleCheckbox", json!({"cell": c.a1()})); } // A click on a hyperlink's text follows it (like Excel); elsewhere in the cell selects. - if let Some(h) = sh.hyperlinks.get(&c).cloned() + if let Some(h) = current_cell_link(app, c) && acts && !mods.any() { diff --git a/crates/ui-egui/src/grid/show.rs b/crates/ui-egui/src/grid/show.rs index 562e1d92a..e1c5227a8 100644 --- a/crates/ui-egui/src/grid/show.rs +++ b/crates/ui-egui/src/grid/show.rs @@ -781,7 +781,7 @@ pub(crate) fn paint_overlays(input: OverlayInput<'_>) { ); } // Hyperlink tooltip. - if let Some(h) = hover.and_then(|c| sh.hyperlinks.get(&c)) + if let Some(h) = hover.and_then(|c| gridcraft_engine::links::cell_link(wb, si, c)) && app.editor.is_none() { let tip = h.tooltip.clone().unwrap_or_else(|| format!("{}\nClick once to follow. Click and hold to select this cell.", h.target)); diff --git a/crates/ui-egui/src/i18n.rs b/crates/ui-egui/src/i18n.rs index 7be979474..edb1bf64d 100644 --- a/crates/ui-egui/src/i18n.rs +++ b/crates/ui-egui/src/i18n.rs @@ -667,6 +667,24 @@ mod tests { } } + #[test] + fn paste_special_add_and_text_to_columns_comma_have_their_own_keys() { + // "Add" is also the Solver button and "Comma" also the cell style (Spanish Excel: Sumar + // vs Agregar, Coma vs Millares), so the two dialog options are keyed by context. English + // shows the plain label, and a catalog that translates the plain label translates the + // keyed one too, so the dialog option doesn't fall back to English. + for (keyed, plain) in [("Paste Special|Add", "Add"), ("Text to Columns|Comma", "Comma")] { + assert_eq!(Language::En.tr(keyed), plain); + for language in Language::ALL { + let shown = language.tr(keyed); + assert!(!shown.contains('|'), "{} shows a context prefix for {keyed}: {shown}", language.code()); + if language.tr(plain) != plain { + assert_ne!(shown, plain, "{} translates {plain:?} but not {keyed:?}", language.code()); + } + } + } + } + #[test] fn translations_never_show_the_context_prefix() { // `tr` returns a found translation as it is, so a catalog that keeps `context|` in its diff --git a/crates/ui-egui/src/i18n/el.rs b/crates/ui-egui/src/i18n/el.rs index 573b6ba2d..6f5e09ddc 100644 --- a/crates/ui-egui/src/i18n/el.rs +++ b/crates/ui-egui/src/i18n/el.rs @@ -672,6 +672,7 @@ pub(super) fn translate(text: &str) -> Option<&'static str> { "Values and number formats" => "Τιμές και μορφές αριθμών", "Operation" => "Πράξη", "Add" => "Πρόσθεση", + "Paste Special|Add" => "Πρόσθεση", "Subtract" => "Αφαίρεση", "Multiply" => "Πολλαπλασιασμός", "Divide" => "Διαίρεση", @@ -709,6 +710,7 @@ pub(super) fn translate(text: &str) -> Option<&'static str> { "Tab" => "Στηλοθέτης", "Semicolon" => "Ερωτηματικό (;)", "Comma" => "Κόμμα", + "Text to Columns|Comma" => "Κόμμα", "Space" => "Διάστημα", "Other:" => "Άλλο:", "Treat consecutive delimiters as one" => "Αντιμετώπιση διαδοχικών διαχωριστικών ως ενός", diff --git a/crates/ui-egui/src/i18n/it.rs b/crates/ui-egui/src/i18n/it.rs index dbd1a66da..41127f0bb 100644 --- a/crates/ui-egui/src/i18n/it.rs +++ b/crates/ui-egui/src/i18n/it.rs @@ -553,6 +553,7 @@ pub(super) fn translate(text: &str) -> Option<&'static str> { "Values and number formats" => "Valori e formati numero", "Operation" => "Operazione", "Add" => "Aggiungi", + "Paste Special|Add" => "Aggiungi", "Subtract" => "Sottrai", "Multiply" => "Moltiplica", "Divide" => "Dividi", @@ -592,6 +593,7 @@ pub(super) fn translate(text: &str) -> Option<&'static str> { "Tab" => "Tabulazione", "Semicolon" => "Punto e virgola", "Comma" => "Virgola", + "Text to Columns|Comma" => "Virgola", "Space" => "Spazio", "Other:" => "Altro:", "Treat consecutive delimiters as one" => "Considera delimitatori consecutivi come uno solo", diff --git a/crates/ui-egui/src/i18n/ja.rs b/crates/ui-egui/src/i18n/ja.rs index fd809f065..64c7570bb 100644 --- a/crates/ui-egui/src/i18n/ja.rs +++ b/crates/ui-egui/src/i18n/ja.rs @@ -570,6 +570,7 @@ pub(super) const DIALOGS: &[(&str, &str)] = &[ ("Values and number formats", "値と数値の書式"), ("Operation", "演算"), ("Add", "加算"), + ("Paste Special|Add", "加算"), ("Subtract", "減算"), ("Multiply", "乗算"), ("Divide", "除算"), @@ -609,6 +610,7 @@ pub(super) const DIALOGS: &[(&str, &str)] = &[ ("Tab", "タブ"), ("Semicolon", "セミコロン"), ("Comma", "コンマ"), + ("Text to Columns|Comma", "コンマ"), ("Space", "スペース"), ("Other:", "その他:"), ("Treat consecutive delimiters as one", "連続した区切り文字は 1 文字として扱う"), diff --git a/crates/ui-egui/src/i18n/pl.rs b/crates/ui-egui/src/i18n/pl.rs index 0f12f8a87..982e97676 100644 --- a/crates/ui-egui/src/i18n/pl.rs +++ b/crates/ui-egui/src/i18n/pl.rs @@ -544,6 +544,7 @@ pub(super) fn translate(text: &str) -> Option<&'static str> { "Values and number formats" => "Wartości i formaty liczb", "Operation" => "Operacja", "Add" => "Dodaj", + "Paste Special|Add" => "Dodaj", "Subtract" => "Odejmij", "Multiply" => "Pomnóż", "Divide" => "Podziel", @@ -583,6 +584,7 @@ pub(super) fn translate(text: &str) -> Option<&'static str> { "Tab" => "Tabulator", "Semicolon" => "Średnik", "Comma" => "Przecinek", + "Text to Columns|Comma" => "Przecinek", "Space" => "Spacja", "Other:" => "Inny:", "Treat consecutive delimiters as one" => "Traktuj kolejne ograniczniki jako jeden", diff --git a/crates/ui-egui/src/i18n/pt.rs b/crates/ui-egui/src/i18n/pt.rs index e8f542634..ff54207a3 100644 --- a/crates/ui-egui/src/i18n/pt.rs +++ b/crates/ui-egui/src/i18n/pt.rs @@ -580,6 +580,7 @@ pub(super) fn translate(text: &str) -> Option<&'static str> { "Values and number formats" => "Valores e formatos de número", "Operation" => "Operação", "Add" => "Adicionar", + "Paste Special|Add" => "Adicionar", "Subtract" => "Subtrair", "Multiply" => "Multiplicar", "Divide" => "Dividir", @@ -619,6 +620,7 @@ pub(super) fn translate(text: &str) -> Option<&'static str> { "Tab" => "Tabulação", "Semicolon" => "Ponto e vírgula", "Comma" => "Vírgula", + "Text to Columns|Comma" => "Vírgula", "Space" => "Espaço", "Other:" => "Outros:", "Treat consecutive delimiters as one" => "Considerar delimitadores consecutivos como um só", diff --git a/crates/ui-egui/src/i18n/ro.rs b/crates/ui-egui/src/i18n/ro.rs index c427c0b6a..70e2fd069 100644 --- a/crates/ui-egui/src/i18n/ro.rs +++ b/crates/ui-egui/src/i18n/ro.rs @@ -550,6 +550,7 @@ pub(super) fn translate(text: &str) -> Option<&'static str> { "Values and number formats" => "Valori și formate de număr", "Operation" => "Operație", "Add" => "Adăugare", + "Paste Special|Add" => "Adăugare", "Subtract" => "Scădere", "Multiply" => "Înmulțire", "Divide" => "Împărțire", @@ -589,6 +590,7 @@ pub(super) fn translate(text: &str) -> Option<&'static str> { "Tab" => "Tab", "Semicolon" => "Punct și virgulă", "Comma" => "Virgulă", + "Text to Columns|Comma" => "Virgulă", "Space" => "Spațiu", "Other:" => "Altele:", "Treat consecutive delimiters as one" => "Delimitatorii consecutivi se tratează ca unul singur", diff --git a/crates/ui-egui/src/i18n/ru.rs b/crates/ui-egui/src/i18n/ru.rs index c729a0f60..0862e9acd 100644 --- a/crates/ui-egui/src/i18n/ru.rs +++ b/crates/ui-egui/src/i18n/ru.rs @@ -484,6 +484,7 @@ pub(super) fn translate(text: &str) -> Option<&'static str> { "Action" => "Действие", "Action Journal" => "Журнал действий", "Add" => "Добавить", + "Paste Special|Add" => "Добавить", "Add Chart Element" => "Добавить элемент диаграммы", "Add subtotal to (columns, e.g. C,D):" => "Добавить итоги по (столбцы, например C,D):", "Add to Dictionary" => "Добавить в словарь", @@ -546,6 +547,7 @@ pub(super) fn translate(text: &str) -> Option<&'static str> { "Columns (blank = all, e.g. A,C):" => "Столбцы (пусто = все, например A,C):", "Combo" => "Комбинированная", "Comma" => "Запятая", + "Text to Columns|Comma" => "Запятая", "Comment:" => "Комментарий:", "Comments and notes (C)" => "Комментарии и заметки (C)", "Comments pane" => "Область комментариев", diff --git a/crates/ui-egui/src/i18n/uk.rs b/crates/ui-egui/src/i18n/uk.rs index 79b9db5db..2fb9e851f 100644 --- a/crates/ui-egui/src/i18n/uk.rs +++ b/crates/ui-egui/src/i18n/uk.rs @@ -548,6 +548,7 @@ pub(super) fn translate(text: &str) -> Option<&'static str> { "Values and number formats" => "Values and number formats", "Operation" => "Operation", "Add" => "Add", + "Paste Special|Add" => "Add", "Subtract" => "Subtract", "Multiply" => "Multiply", "Divide" => "Divide", @@ -587,6 +588,7 @@ pub(super) fn translate(text: &str) -> Option<&'static str> { "Tab" => "Tab", "Semicolon" => "Semicolon", "Comma" => "Comma", + "Text to Columns|Comma" => "Comma", "Space" => "Space", "Other:" => "Other:", "Treat consecutive delimiters as one" => "Treat consecutive delimiters as one", diff --git a/docs/localization-parity.md b/docs/localization-parity.md index ea4ac7833..e3a4d0580 100644 --- a/docs/localization-parity.md +++ b/docs/localization-parity.md @@ -1,6 +1,6 @@ # Localization parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-18 · **Change:** minor (fill-handle and Home › Fill menu labels in every catalog); previously minor (RaTeX equation parser messages follow the interface language); previously minor (status bar statistics, resize tips, picture-in-cell text, sheet notes, Format Control title, equation errors, Goal Seek and macro toasts follow the interface language); previously minor (Arabic PDF export no longer fails when a character or the Arabic font is missing; Arabic PDF cells keep their reading direction and RTL pages mirror); previously minor (Brazilian Portuguese function help); previously minor (Ukrainian Chart is Діаграма); previously minor (Diagram and Decorative Text labels, Diagram distinct from Chart); previously minor (CJK fallback baseline alignment); previously minor (Arabic bidi display, editing and cell reading direction; missing translations are listed by `cargo xtask i18n-report` and never fail a check); previously minor (Arabic font fallback; missing translations are listed by `cargo xtask i18n-report` and never fail a check); previously minor (number formats honour the `B1`/`B2` calendar prefixes, checked against Excel; earlier: missing translations are listed by `cargo xtask i18n-report` and never fail a check; Arabic text sorts by its letters, not its vowel marks); previously minor (AutoFit estimates Arabic text width from measured glyph widths); previously minor (missing translations are listed by `cargo xtask i18n-report` and never fail a check; Arabic text sorts by its letters, not its vowel marks) · **Target:** Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4 +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-18 · **Change:** minor (Paste Special's Add and Text to Columns' Comma get their own keys); previously minor (Ukrainian Chart is Діаграма); previously minor (Diagram and Decorative Text labels, Diagram distinct from Chart); previously minor (CJK fallback baseline alignment); previously minor (Arabic bidi display, editing and cell reading direction; missing translations are listed by `cargo xtask i18n-report` and never fail a check); previously minor (Arabic font fallback; missing translations are listed by `cargo xtask i18n-report` and never fail a check); previously minor (number formats honour the `B1`/`B2` calendar prefixes, checked against Excel; earlier: fill-handle and Home › Fill menu labels in every catalog); previously minor (RaTeX equation parser messages follow the interface language); previously minor (status bar statistics, resize tips, picture-in-cell text, sheet notes, Format Control title, equation errors, Goal Seek and macro toasts follow the interface language); previously minor (Arabic PDF export no longer fails when a character or the Arabic font is missing; Arabic PDF cells keep their reading direction and RTL pages mirror); previously minor (Brazilian Portuguese function help); previously minor (Ukrainian Chart is Діаграма); previously minor (Diagram and Decorative Text labels, Diagram distinct from Chart); previously minor (CJK fallback baseline alignment); previously minor (Arabic bidi display, editing and cell reading direction; missing translations are listed by `cargo xtask i18n-report` and never fail a check); previously minor (Arabic font fallback; missing translations are listed by `cargo xtask i18n-report` and never fail a check); previously minor (number formats honour the `B1`/`B2` calendar prefixes, checked against Excel; earlier: missing translations are listed by `cargo xtask i18n-report` and never fail a check; Arabic text sorts by its letters, not its vowel marks); previously minor (AutoFit estimates Arabic text width from measured glyph widths); previously minor (missing translations are listed by `cargo xtask i18n-report` and never fail a check; Arabic text sorts by its letters, not its vowel marks) · **Target:** Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4 Per-language status against Excel, which ships its UI in dozens of languages (Windows language packs cover 100+), with localized function names, argument separators, number and date formats, @@ -158,6 +158,7 @@ language (none so far) and of localized function names. | 2026-10-26 | minor | Arabic text renders in cells and the interface: a system Arabic face (Tahoma, Arial or Segoe UI on Windows, Geeza Pro on macOS, Noto Sans or Naskh Arabic on Linux) joins the script fallbacks, fontconfig's Arabic choice, when it has Arabic letters, leads the Arabic fallbacks and draws Arabic wherever the UI or cell font has none, such as the default cell fonts (part of #229; a UI font with Arabic of its own, such as DejaVu Sans in the Flatpak, still draws interface Arabic, left for a follow-up), and craft-fonts' Noto Sans Arabic is a required face allowed on the web. Workbook fonts without Arabic keep every script fallback. Shaping and bidirectional layout remain separate work | | 2026-10-27 | minor | Number formats honour the `B1`/`B2` calendar prefixes: never shown; `B2` renders year, month, day and Arabic month and weekday names in the tabular Hijri calendar (1 Jan 2001 = 6 Shawwal 1421; leap years 2, 5, 7, 10, 13, 15, 18, 21, 24, 26 and 29 of the 30-year cycle, which is what Excel shows). Checked against Excel 16.0 (build 20527, en-US) on every serial and about 1,700 format/value pairs: a locale or currency tag before `B2` keeps the date Gregorian, a misplaced `B` and digit or a prefix before a number format is rejected, serial 60 has no Hijri date, serial 0 shows as serial 1, two-word month names use a no-break space. Not matched: Excel's weekday/month-name mix-ups in one `B2` section and its weekday-only quirks | | 2026-10-27 | minor | AutoFit column width, wrapped-row height and PivotTable column fit estimate Arabic letters at ~0.48 em (measured 0.36–0.53 em shaped, Noto Sans/Naskh Arabic and DejaVu Sans) instead of 1 em, Arabic-Indic digits as wide as ASCII digits, and give vowel marks and direction marks no width; vowelled Arabic no longer fits ~3.5× too wide | +| 2026-10-26 | minor | Paste Special's Add operation and Text to Columns' Comma delimiter are keyed `Paste Special\|Add` and `Text to Columns\|Comma`, so they can be translated apart from the Solver's Add button and the Comma cell style (Spanish: Sumar vs Agregar, Coma vs Millares); every catalog keeps the text it showed | | 2026-10-26 | minor | Arabic PDF cells, headers and chart labels support joined letters, combining marks, digits, bold/italic, rotation and grapheme wrapping | | 2026-10-23 | minor | Missing translations are reported, never a failure: `cargo xtask i18n-report` prints, per language, the strings other catalogs translate and it lacks (plus Spanish function help rows keyed by English the function catalog no longer has) and always passes; `cargo xtask ci` runs it first. Coverage and per-language parity tests and tests of one language's exact wording are gone; UI tests take the expected text from the catalog. Duplicate-key, placeholder, context-prefix and line-shape checks stay | | 2026-10-21 | minor | Romanian interface (`ro`, Română): 970 labels covering every key of the other catalogs (`crates/ui-egui/src/i18n/ro.rs`), `ro-*` system locales, the View-tab switcher and `app.language.set`; context keys show no prefix (File › Options test). English formulas and formats; AI-assisted draft pending native-speaker review |