Compare commits

..
23 changed files with 121 additions and 413 deletions
+5 -8
View File
@@ -409,19 +409,16 @@ fn full_sync_tolerates_only_unsupported_errors() {
}
/// Apple's ENOTSUP is 45 (EOPNOTSUPP is 102), and std maps only the latter to
/// `ErrorKind::Unsupported`: F_FULLFSYNC refused with ENOTSUP must still save. On Linux, 45 is
/// EL2NSYNC and stays a failed save. On FreeBSD and other BSDs, 45 is ENOTSUP (the same value as
/// EOPNOTSUPP), so this host's std reports `ErrorKind::Unsupported` and the flush is tolerated
/// even when the `apple` flag is false — which is the real helper's behaviour on those systems.
/// `ErrorKind::Unsupported`: F_FULLFSYNC refused with ENOTSUP must still save. Elsewhere 45 is
/// another error (EL2NSYNC on Linux) and stays a failed save.
#[cfg(not(target_arch = "wasm32"))]
#[test]
fn full_sync_tolerates_apple_enotsup() {
use std::io::{Error, ErrorKind};
use std::io::Error;
let enotsup = Error::from_raw_os_error(45);
assert!(flush_unsupported_on(&enotsup, true, true), "ENOTSUP on Apple");
let host_maps_45_unsupported = enotsup.kind() == ErrorKind::Unsupported;
assert_eq!(flush_unsupported_on(&enotsup, true, false), host_maps_45_unsupported, "45 on other Unix");
assert_eq!(flush_unsupported_on(&enotsup, false, false), host_maps_45_unsupported, "45 on Windows");
assert!(!flush_unsupported_on(&enotsup, true, false), "45 on other Unix");
assert!(!flush_unsupported_on(&enotsup, false, false), "45 on Windows");
assert!(flush_unsupported_on(&Error::from_raw_os_error(25), true, true), "ENOTTY on Apple");
assert!(!flush_unsupported_on(&Error::from_raw_os_error(5), true, true), "EIO on Apple");
assert!(!flush_unsupported_on(&Error::from_raw_os_error(28), true, true), "ENOSPC on Apple");
-29
View File
@@ -548,35 +548,6 @@ mod tests {
}
}
/// The fill-handle menus (the right-drag menu and the Auto Fill Options button) and the
/// Home › Fill menu have a row in every catalog, with no silent English fallback (#4458).
#[test]
fn fill_menu_labels_are_translated_in_every_catalog() {
let keys = [
"Copy Cells",
"Fill Series",
"Fill Formatting Only",
"Fill Without Formatting",
"Fill Days",
"Fill Weekdays",
"Fill Months",
"Fill Years",
"Auto Fill Options",
"Series…",
"Down",
"Up",
];
for key in keys {
assert_eq!(Language::En.tr(key), key);
for language in Language::ALL.into_iter().filter(|l| *l != Language::En) {
let code = language.code();
let shown = language.translated(key).unwrap_or_else(|| panic!("{code}: no row for {key:?}"));
assert!(!shown.trim().is_empty() && !shown.contains('\n'), "{code}: bad translation of {key:?}: {shown:?}");
assert_ne!(shown, key, "{code}: the row for {key:?} is still English");
}
}
}
#[test]
fn fill_puts_each_value_in_once() {
// A value holding a placeholder (a macro named `{steps}`) is shown as it is.
-9
View File
@@ -728,15 +728,6 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"\\@char has non-numeric argument {argument}" => "\\@char má nečíselný argument {argument}",
"\\@char with invalid code point {code}" => "\\@char s neplatným kódovým bodem {code}",
"Invalid environment name character: {character}" => "Neplatný znak v názvu prostředí: {character}",
"Copy Cells" => "Kopírovat buňky",
"Fill Series" => "Vyplnit řady",
"Fill Formatting Only" => "Vyplnit pouze formáty",
"Fill Without Formatting" => "Vyplnit bez formátování",
"Fill Days" => "Vyplnit dny",
"Fill Weekdays" => "Vyplnit pracovní dny",
"Fill Months" => "Vyplnit měsíce",
"Fill Years" => "Vyplnit roky",
"Auto Fill Options" => "Možnosti automatického vyplnění",
_ => return None,
})
}
-12
View File
@@ -650,18 +650,6 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"\\@char has non-numeric argument {argument}" => "\\@char hat ein nicht numerisches Argument {argument}",
"\\@char with invalid code point {code}" => "\\@char mit ungültigem Codepunkt {code}",
"Invalid environment name character: {character}" => "Ungültiges Zeichen im Umgebungsnamen: {character}",
"Copy Cells" => "Zellen kopieren",
"Fill Series" => "Datenreihe ausfüllen",
"Fill Formatting Only" => "Nur Formate ausfüllen",
"Fill Without Formatting" => "Ohne Formatierung ausfüllen",
"Fill Days" => "Tage ausfüllen",
"Fill Weekdays" => "Wochentage ausfüllen",
"Fill Months" => "Monate ausfüllen",
"Fill Years" => "Jahre ausfüllen",
"Auto Fill Options" => "Optionen für automatisches Ausfüllen",
"Series…" => "Reihe…",
"Down" => "Nach unten",
"Up" => "Nach oben",
_ => return None,
})
}
-9
View File
@@ -1135,15 +1135,6 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"\\@char has non-numeric argument {argument}" => "Το \\@char έχει μη αριθμητικό όρισμα {argument}",
"\\@char with invalid code point {code}" => "\\@char με μη έγκυρο σημείο κώδικα {code}",
"Invalid environment name character: {character}" => "Μη έγκυρος χαρακτήρας στο όνομα περιβάλλοντος: {character}",
"Copy Cells" => "Αντιγραφή κελιών",
"Fill Series" => "Συμπλήρωση σειράς",
"Fill Formatting Only" => "Συμπλήρωση μόνο μορφοποίησης",
"Fill Without Formatting" => "Συμπλήρωση χωρίς μορφοποίηση",
"Fill Days" => "Συμπλήρωση ημερών",
"Fill Weekdays" => "Συμπλήρωση εργάσιμων ημερών",
"Fill Months" => "Συμπλήρωση μηνών",
"Fill Years" => "Συμπλήρωση ετών",
"Auto Fill Options" => "Επιλογές αυτόματης συμπλήρωσης",
_ => return None,
})
}
-12
View File
@@ -656,18 +656,6 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"\\@char has non-numeric argument {argument}" => "\\@char tiene un argumento no numérico {argument}",
"\\@char with invalid code point {code}" => "\\@char con un punto de código no válido {code}",
"Invalid environment name character: {character}" => "Carácter no válido en el nombre del entorno: {character}",
"Copy Cells" => "Copiar celdas",
"Fill Series" => "Rellenar serie",
"Fill Formatting Only" => "Rellenar solo formatos",
"Fill Without Formatting" => "Rellenar sin formato",
"Fill Days" => "Rellenar días",
"Fill Weekdays" => "Rellenar días laborables",
"Fill Months" => "Rellenar meses",
"Fill Years" => "Rellenar años",
"Auto Fill Options" => "Opciones de autorrelleno",
"Series…" => "Serie…",
"Down" => "Hacia abajo",
"Up" => "Hacia arriba",
_ => return None,
})
}
-12
View File
@@ -618,18 +618,6 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"\\@char has non-numeric argument {argument}" => "\\@char a un argument non numérique {argument}",
"\\@char with invalid code point {code}" => "\\@char avec un point de code non valide {code}",
"Invalid environment name character: {character}" => "Caractère non valide dans le nom d'environnement : {character}",
"Copy Cells" => "Copier les cellules",
"Fill Series" => "Remplir la série",
"Fill Formatting Only" => "Remplir les formats uniquement",
"Fill Without Formatting" => "Remplir sans la mise en forme",
"Fill Days" => "Remplir les jours",
"Fill Weekdays" => "Remplir les jours ouvrés",
"Fill Months" => "Remplir les mois",
"Fill Years" => "Remplir les années",
"Auto Fill Options" => "Options de remplissage automatique",
"Series…" => "Série…",
"Down" => "Vers le bas",
"Up" => "Vers le haut",
_ => return None,
})
}
-9
View File
@@ -1139,15 +1139,6 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"\\@char has non-numeric argument {argument}" => "\\@char ha un argomento non numerico {argument}",
"\\@char with invalid code point {code}" => "\\@char con punto di codice non valido {code}",
"Invalid environment name character: {character}" => "Carattere non valido nel nome dell'ambiente: {character}",
"Copy Cells" => "Copia celle",
"Fill Series" => "Riempi serie",
"Fill Formatting Only" => "Riempi solo formattazione",
"Fill Without Formatting" => "Riempi senza formattazione",
"Fill Days" => "Riempi giorni",
"Fill Weekdays" => "Riempi giorni feriali",
"Fill Months" => "Riempi mesi",
"Fill Years" => "Riempi anni",
"Auto Fill Options" => "Opzioni di riempimento automatico",
_ => return None,
})
}
-9
View File
@@ -1288,15 +1288,6 @@ pub(super) const EXTRA: &[(&str, &str)] = &[
"Drag to fill cells. Drag from inside a cell to select a range.",
"ドラッグしてセルをオートフィルします。セルの内側からドラッグすると範囲を選択します。",
),
("Copy Cells", "セルのコピー"),
("Fill Series", "連続データを入力"),
("Fill Formatting Only", "書式のみを入力"),
("Fill Without Formatting", "書式なしで入力"),
("Fill Days", "日単位で入力"),
("Fill Weekdays", "平日単位で入力"),
("Fill Months", "月単位で入力"),
("Fill Years", "年単位で入力"),
("Auto Fill Options", "オートフィル オプション"),
];
/// Translates an interface label; `None` for a label the catalog does not know, so `i18n.rs` can
-12
View File
@@ -616,18 +616,6 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"\\@char has non-numeric argument {argument}" => "\\@char 의 인수 {argument} 이(가) 숫자가 아닙니다",
"\\@char with invalid code point {code}" => "\\@char 의 코드 포인트 {code} 이(가) 잘못되었습니다",
"Invalid environment name character: {character}" => "환경 이름에 잘못된 문자가 있습니다: {character}",
"Copy Cells" => "셀 복사",
"Fill Series" => "연속 데이터 채우기",
"Fill Formatting Only" => "서식만 채우기",
"Fill Without Formatting" => "서식 없이 채우기",
"Fill Days" => "일 단위 채우기",
"Fill Weekdays" => "평일 단위 채우기",
"Fill Months" => "월 단위 채우기",
"Fill Years" => "연 단위 채우기",
"Auto Fill Options" => "자동 채우기 옵션",
"Series…" => "연속 데이터…",
"Down" => "아래쪽",
"Up" => "위쪽",
_ => return None,
})
}
-9
View File
@@ -691,15 +691,6 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"\\@char has non-numeric argument {argument}" => "\\@char heeft een niet-numeriek argument {argument}",
"\\@char with invalid code point {code}" => "\\@char met ongeldig codepunt {code}",
"Invalid environment name character: {character}" => "Ongeldig teken in de omgevingsnaam: {character}",
"Copy Cells" => "Cellen kopiëren",
"Fill Series" => "Reeks vullen",
"Fill Formatting Only" => "Alleen opmaak vullen",
"Fill Without Formatting" => "Vullen zonder opmaak",
"Fill Days" => "Dagen vullen",
"Fill Weekdays" => "Werkdagen vullen",
"Fill Months" => "Maanden vullen",
"Fill Years" => "Jaren vullen",
"Auto Fill Options" => "Opties voor automatisch vullen",
_ => return None,
})
}
-9
View File
@@ -1127,15 +1127,6 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"\\@char has non-numeric argument {argument}" => "\\@char ma nienumeryczny argument {argument}",
"\\@char with invalid code point {code}" => "\\@char z nieprawidłowym punktem kodowym {code}",
"Invalid environment name character: {character}" => "Nieprawidłowy znak w nazwie środowiska: {character}",
"Copy Cells" => "Kopiuj komórki",
"Fill Series" => "Wypełnij serią",
"Fill Formatting Only" => "Wypełnij tylko formatami",
"Fill Without Formatting" => "Wypełnij bez formatowania",
"Fill Days" => "Wypełnij dniami",
"Fill Weekdays" => "Wypełnij dniami roboczymi",
"Fill Months" => "Wypełnij miesiącami",
"Fill Years" => "Wypełnij latami",
"Auto Fill Options" => "Opcje autowypełniania",
_ => return None,
})
}
-9
View File
@@ -1143,15 +1143,6 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"\\@char has non-numeric argument {argument}" => "\\@char tem um argumento não numérico {argument}",
"\\@char with invalid code point {code}" => "\\@char com ponto de código inválido {code}",
"Invalid environment name character: {character}" => "Caractere inválido no nome do ambiente: {character}",
"Copy Cells" => "Copiar Células",
"Fill Series" => "Preencher Série",
"Fill Formatting Only" => "Preencher Somente Formatos",
"Fill Without Formatting" => "Preencher Sem Formatação",
"Fill Days" => "Preencher Dias",
"Fill Weekdays" => "Preencher Dias Úteis",
"Fill Months" => "Preencher Meses",
"Fill Years" => "Preencher Anos",
"Auto Fill Options" => "Opções de Autopreenchimento",
_ => return None,
})
}
-9
View File
@@ -1189,15 +1189,6 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"\\@char has non-numeric argument {argument}" => "\\@char are un argument nenumeric {argument}",
"\\@char with invalid code point {code}" => "\\@char cu punct de cod nevalid {code}",
"Invalid environment name character: {character}" => "Caracter nevalid în numele mediului: {character}",
"Copy Cells" => "Copiere celule",
"Fill Series" => "Umplere serie",
"Fill Formatting Only" => "Umplere doar formate",
"Fill Without Formatting" => "Umplere fără formatare",
"Fill Days" => "Umplere zile",
"Fill Weekdays" => "Umplere zile lucrătoare",
"Fill Months" => "Umplere luni",
"Fill Years" => "Umplere ani",
"Auto Fill Options" => "Opțiuni de umplere automată",
_ => return None,
})
}
-9
View File
@@ -1193,15 +1193,6 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"\\@char has non-numeric argument {argument}" => "У \\@char нечисловой аргумент {argument}",
"\\@char with invalid code point {code}" => "\\@char с недопустимой кодовой точкой {code}",
"Invalid environment name character: {character}" => "Недопустимый символ в имени окружения: {character}",
"Copy Cells" => "Копировать ячейки",
"Fill Series" => "Заполнить ряд",
"Fill Formatting Only" => "Заполнить только форматы",
"Fill Without Formatting" => "Заполнить без форматирования",
"Fill Days" => "Заполнить по дням",
"Fill Weekdays" => "Заполнить по рабочим дням",
"Fill Months" => "Заполнить по месяцам",
"Fill Years" => "Заполнить по годам",
"Auto Fill Options" => "Параметры автозаполнения",
_ => return None,
})
}
-12
View File
@@ -609,18 +609,6 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"\\@char has non-numeric argument {argument}" => "\\@char ima nenumerički argument {argument}",
"\\@char with invalid code point {code}" => "\\@char sa nevažećom kodnom tačkom {code}",
"Invalid environment name character: {character}" => "Nevažeći znak u nazivu okruženja: {character}",
"Copy Cells" => "Kopiraj ćelije",
"Fill Series" => "Popuni niz",
"Fill Formatting Only" => "Popuni samo oblikovanja",
"Fill Without Formatting" => "Popuni bez oblikovanja",
"Fill Days" => "Popuni dane",
"Fill Weekdays" => "Popuni radne dane",
"Fill Months" => "Popuni mesece",
"Fill Years" => "Popuni godine",
"Auto Fill Options" => "Opcije automatskog popunjavanja",
"Series…" => "Niz…",
"Down" => "Nadole",
"Up" => "Nagore",
_ => return None,
})
}
-12
View File
@@ -581,18 +581,6 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"\\@char has non-numeric argument {argument}" => "\\@char sayısal olmayan bir bağımsız değişkene sahip: {argument}",
"\\@char with invalid code point {code}" => "\\@char geçersiz bir kod noktası içeriyor: {code}",
"Invalid environment name character: {character}" => "Ortam adında geçersiz karakter: {character}",
"Copy Cells" => "Hücreleri Kopyala",
"Fill Series" => "Seriyi Doldur",
"Fill Formatting Only" => "Yalnızca Biçimleri Doldur",
"Fill Without Formatting" => "Biçimlendirmeden Doldur",
"Fill Days" => "Günleri Doldur",
"Fill Weekdays" => "İş Günlerini Doldur",
"Fill Months" => "Ayları Doldur",
"Fill Years" => "Yılları Doldur",
"Auto Fill Options" => "Otomatik Doldurma Seçenekleri",
"Series…" => "Seri…",
"Down" => "Aşağı",
"Up" => "Yukarı",
_ => return None,
})
}
+3 -12
View File
@@ -907,7 +907,7 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"Delete chart" => "Видалити діаграму",
"Delete…" => "Delete…",
"Dismiss" => "Dismiss",
"Down" => "Вниз",
"Down" => "Down",
"Edit chart title" => "Редагувати назву діаграми",
"Erase ink strokes" => "Erase ink strokes",
"Every command run in this session (replayable)" => "Every command run in this session (replayable)",
@@ -954,7 +954,7 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"Search and run any command" => "Search and run any command",
"Search commands" => "Search commands",
"Select and move ink and shapes" => "Select and move ink and shapes",
"Series…" => "Ряд…",
"Series…" => "Series…",
"Share: export or save a copy" => "Share: export or save a copy",
"Show Formulas (⌃`)" => "Show Formulas (⌃`)",
"Slicer" => "Slicer",
@@ -969,7 +969,7 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"Undo" => "Undo",
"Undo list" => "Undo list",
"Unhide Sheet…" => "Unhide Sheet…",
"Up" => "Угору",
"Up" => "Up",
"Version, contributors and the AI models that helped" => "Version, contributors and the AI models that helped",
"What-If Analysis" => "What-If Analysis",
"Zoom In" => "Zoom In",
@@ -1131,15 +1131,6 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"\\@char has non-numeric argument {argument}" => "\\@char має нечисловий аргумент {argument}",
"\\@char with invalid code point {code}" => "\\@char з неприпустимою кодовою точкою {code}",
"Invalid environment name character: {character}" => "Неприпустимий символ у назві середовища: {character}",
"Copy Cells" => "Копіювати комірки",
"Fill Series" => "Заповнити ряд",
"Fill Formatting Only" => "Заповнити лише формати",
"Fill Without Formatting" => "Заповнити без форматування",
"Fill Days" => "Заповнити дні",
"Fill Weekdays" => "Заповнити робочі дні",
"Fill Months" => "Заповнити місяці",
"Fill Years" => "Заповнити роки",
"Auto Fill Options" => "Параметри автозаповнення",
_ => return None,
})
}
-12
View File
@@ -577,18 +577,6 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"\\@char has non-numeric argument {argument}" => "\\@char có đối số không phải số {argument}",
"\\@char with invalid code point {code}" => "\\@char có điểm mã không hợp lệ {code}",
"Invalid environment name character: {character}" => "Ký tự không hợp lệ trong tên môi trường: {character}",
"Copy Cells" => "Sao chép ô",
"Fill Series" => "Điền chuỗi",
"Fill Formatting Only" => "Chỉ điền định dạng",
"Fill Without Formatting" => "Điền không kèm định dạng",
"Fill Days" => "Điền theo ngày",
"Fill Weekdays" => "Điền theo ngày làm việc",
"Fill Months" => "Điền theo tháng",
"Fill Years" => "Điền theo năm",
"Auto Fill Options" => "Tùy chọn tự động điền",
"Series…" => "Chuỗi…",
"Down" => "Xuống",
"Up" => "Lên",
_ => return None,
})
}
-12
View File
@@ -600,18 +600,6 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"\\@char has non-numeric argument {argument}" => "\\@char 的参数 {argument} 不是数字",
"\\@char with invalid code point {code}" => "\\@char 的码位 {code} 无效",
"Invalid environment name character: {character}" => "环境名称中有无效字符: {character}",
"Copy Cells" => "复制单元格",
"Fill Series" => "填充序列",
"Fill Formatting Only" => "仅填充格式",
"Fill Without Formatting" => "不带格式填充",
"Fill Days" => "以天数填充",
"Fill Weekdays" => "以工作日填充",
"Fill Months" => "以月填充",
"Fill Years" => "以年填充",
"Auto Fill Options" => "自动填充选项",
"Series…" => "序列…",
"Down" => "向下",
"Up" => "向上",
_ => return None,
})
}
+12 -31
View File
@@ -599,12 +599,12 @@ fn xlsb_external_link_ordinals_preserve_missing_slots_on_xlsx_save() {
s1.extend(wide("Data"));
wb_records.extend(record(156, &s1));
wb_records.extend(record(144, &[]));
// Book 0 = self, Book 1 = non-workbook DDE ("ext1"), Book 2 = valid workbook ("ext2").
// Book 0 = self, Book 1 = missing ("missing"), Book 2 = valid ("ext2").
wb_records.extend(record(357, &[]));
wb_records.extend(record(355, &wide("ext1")));
wb_records.extend(record(355, &wide("missing")));
wb_records.extend(record(355, &wide("ext2")));
let mut xti = 2u32.to_le_bytes().to_vec();
for (bk, first, last) in [(1u32, -2i32, -2i32), (2, 0, 0)] {
for (bk, first, last) in [(1u32, 0i32, 0i32), (2, 0, 0)] {
xti.extend(bk.to_le_bytes());
xti.extend(first.to_le_bytes());
xti.extend(last.to_le_bytes());
@@ -612,17 +612,6 @@ fn xlsb_external_link_ordinals_preserve_missing_slots_on_xlsx_save() {
wb_records.extend(record(362, &xti));
wb_records.extend(record(132, &[]));
// DDE link part (links/dde1.bin): sbt=1 ("Excel", "topic") with item "R1C1".
let mut dde_bin = Vec::new();
let mut dde_begin = 1u16.to_le_bytes().to_vec();
dde_begin.extend(wide("Excel"));
dde_begin.extend(wide("topic"));
dde_bin.extend(record(360, &dde_begin));
dde_bin.extend(record(577, &wide("R1C1")));
dde_bin.extend(record(586, &[0u8; 7]));
dde_bin.extend(record(587, &[]));
dde_bin.extend(record(588, &[]));
let mut ext_bin = Vec::new();
let mut begin_sup = 0u16.to_le_bytes().to_vec();
begin_sup.extend(wide("rId1"));
@@ -643,7 +632,12 @@ fn xlsb_external_link_ordinals_preserve_missing_slots_on_xlsx_save() {
data.extend(0u32.to_le_bytes());
record(9, &data)
};
let ptg_1 = [0x39, 0, 0, 1, 0, 0, 0];
let ptg_1 = {
let mut v = vec![0x3A, 0, 0];
v.extend(0u32.to_le_bytes());
v.extend(0u16.to_le_bytes());
v
};
let ptg_2 = {
let mut v = vec![0x3A, 1, 0];
v.extend(0u32.to_le_bytes());
@@ -654,8 +648,8 @@ fn xlsb_external_link_ordinals_preserve_missing_slots_on_xlsx_save() {
data.extend(fmla_num(0, 11.0, &ptg_1));
data.extend(fmla_num(1, 22.0, &ptg_2));
let rels = r#"<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="one" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="../data/one.bin"/><Relationship Id="strings" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings" Target="../text/strings.bin"/><Relationship Id="ext1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink" Target="../links/dde1.bin"/><Relationship Id="ext2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink" Target="../links/externalLink2.bin"/></Relationships>"#;
let types = r#"<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Override PartName="/records/book.bin" ContentType="application/vnd.ms-excel.sheet.binary.macroEnabled.main"/><Override PartName="/data/one.bin" ContentType="application/vnd.ms-excel.worksheet"/><Override PartName="/text/strings.bin" ContentType="application/vnd.ms-excel.sharedStrings"/><Override PartName="/links/dde1.bin" ContentType="application/vnd.ms-excel.externalLink"/><Override PartName="/links/externalLink2.bin" ContentType="application/vnd.ms-excel.externalLink"/></Types>"#;
let rels = r#"<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="one" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="../data/one.bin"/><Relationship Id="strings" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings" Target="../text/strings.bin"/><Relationship Id="ext2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink" Target="../links/externalLink2.bin"/></Relationships>"#;
let types = r#"<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Override PartName="/records/book.bin" ContentType="application/vnd.ms-excel.sheet.binary.macroEnabled.main"/><Override PartName="/data/one.bin" ContentType="application/vnd.ms-excel.worksheet"/><Override PartName="/text/strings.bin" ContentType="application/vnd.ms-excel.sharedStrings"/><Override PartName="/links/externalLink2.bin" ContentType="application/vnd.ms-excel.externalLink"/></Types>"#;
let link_rels = r#"<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath" Target="SecondBook.xlsx" TargetMode="External"/></Relationships>"#;
let bytes = make_zip(&[
("[Content_Types].xml", types.as_bytes()),
@@ -664,31 +658,18 @@ fn xlsb_external_link_ordinals_preserve_missing_slots_on_xlsx_save() {
("records/_rels/book.bin.rels", rels.as_bytes()),
("data/one.bin", &worksheet(&data, &[])),
("text/strings.bin", &sst()),
("links/dde1.bin", &dde_bin),
("links/externalLink2.bin", &ext_bin),
("links/_rels/externalLink2.bin.rels", link_rels.as_bytes()),
]);
let (wb, report) = read_xlsb(&bytes).unwrap();
assert!(report.warnings.iter().any(|w| w.contains("unresolved or non-workbook external links")), "{:?}", report.warnings);
assert!(report.warnings.iter().any(|w| w.contains("replaced with their cached values")), "{:?}", report.warnings);
assert!(report.warnings.iter().any(|w| w.contains("unresolved external link")), "{:?}", report.warnings);
assert!(wb.sheets[0].cell(CellRef::new(0, 0)).is_some_and(|c| c.formula.is_none() && c.value == Value::Number(11.0)));
assert_eq!(wb.sheets[0].cell(CellRef::new(0, 1)).and_then(|c| c.formula.as_ref()).map(|f| f.text.as_str()), Some("[1]SheetA!$A$1"));
// Also verify numeric structured-table headers like `SUM(Sales[2024])` are not mistaken for
// external ordinals when an omitted DDE link triggers ordinal remapping.
assert_eq!(crate::xlsb::remap_external_formula("SUM(Sales[2024])", &[None, None, Some(1)]), Ok(None));
assert_eq!(crate::xlsb::remap_external_formula("Sales[[#Headers],[2024]]", &[None, None, Some(1)]), Ok(None));
assert_eq!(
crate::xlsb::remap_external_formula("'[2]Other Sheet'!A1+SUM(Sales[2024])", &[None, None, Some(1)]),
Ok(Some("'[1]Other Sheet'!A1+SUM(Sales[2024])".into()))
);
assert_eq!(crate::xlsb::remap_external_formula("[1]!'R1C1'+SUM(Sales[2024])", &[None, None, Some(1)]), Err(()));
let saved = write_xlsx(&wb).unwrap();
let (reopened, rep2) = read_xlsx(&saved).unwrap();
assert!(!rep2.warnings.iter().any(|w| w.contains("dropped")), "{:?}", rep2.warnings);
assert!(reopened.sheets[0].cell(CellRef::new(0, 0)).is_some_and(|c| c.formula.is_none() && c.value == Value::Number(11.0)));
assert_eq!(reopened.sheets[0].cell(CellRef::new(0, 1)).and_then(|c| c.formula.as_ref()).map(|f| f.text.as_str()), Some("[1]SheetA!$A$1"));
let saved2 = write_xlsx(&reopened).unwrap();
+100 -154
View File
@@ -199,7 +199,7 @@ pub fn read_xlsb(bytes: &[u8]) -> Result<(Workbook, ReadReport), IoError> {
wb.preserved = Some(Arc::new(preserved));
}
if let Some(remap) = ordinal_map {
remap_workbook_external_ordinals(&mut wb, &remap, &mut report);
remap_workbook_external_ordinals(&mut wb, &remap);
}
for warning in package.warnings() {
report.warn(warning);
@@ -227,79 +227,59 @@ fn preserve_external_links(
let mut refs_xml = format!("<externalReferences xmlns:r=\"{NS_REL}\">");
let mut remap = vec![None; links.len() + 1];
let mut next_ordinal = 0usize;
let mut had_unpreserved = false;
let mut had_missing = false;
let mut shifted = false;
for (i, (_, link)) in links.iter().enumerate() {
let Some(craft_xlsx::ExternalLink::Book(book)) = link else {
had_unpreserved = true;
let Some(link) = link else {
had_missing = true;
continue;
};
if book.target.is_none() {
had_unpreserved = true;
continue;
}
next_ordinal += 1;
let old_ordinal = i + 1;
remap[old_ordinal] = Some(next_ordinal);
if next_ordinal != old_ordinal {
shifted = true;
}
let rid = format!("rId{next_ordinal}");
let part_name = format!("xl/externalLinks/externalLink{next_ordinal}.xml");
let (xml, rels) = external_link_part_xml(book);
let (xml, rels) = external_link_part_xml(link);
p.rels.push(PreservedRel { id: rid.clone(), rel_type: format!("{NS_REL}/externalLink"), target: part_name.clone(), external: false });
p.parts.push(PreservedPart { name: part_name, content_type: CT_EXT_LINK.into(), data: xml.into_bytes().into(), rels });
let _ = write!(refs_xml, "<externalReference r:id=\"{rid}\"/>");
}
if had_unpreserved {
report.warn("XLSB: unresolved or non-workbook external links kept their cached values; their targets could not be preserved");
if had_missing {
report.warn("XLSB: unresolved external link kept its cached values; its target could not be preserved");
}
let preserved = if next_ordinal == 0 {
None
} else {
refs_xml.push_str("</externalReferences>");
p.elements.push(PreservedXml { slot: "externalReferences".into(), xml: refs_xml });
Some(p)
};
(preserved, had_unpreserved.then_some(remap))
if next_ordinal == 0 {
return (None, None);
}
refs_xml.push_str("</externalReferences>");
p.elements.push(PreservedXml { slot: "externalReferences".into(), xml: refs_xml });
(Some(p), shifted.then_some(remap))
}
fn remap_workbook_external_ordinals(wb: &mut Workbook, remap: &[Option<usize>], report: &mut ReadReport) {
let mut dropped = false;
fn remap_workbook_external_ordinals(wb: &mut Workbook, remap: &[Option<usize>]) {
for sheet_arc in &mut wb.sheets {
let sheet = Arc::make_mut(sheet_arc);
let coords: Vec<CellRef> = sheet.cells.iter().filter(|(_, c)| c.formula.is_some()).map(|(pos, _)| pos).collect();
for pos in coords {
let Some(cell) = sheet.cells.get_mut(pos) else { continue };
let Some(fm) = &cell.formula else { continue };
match remap_external_formula(&fm.text, remap) {
Ok(Some(rewritten)) => {
let mut updated = (**fm).clone();
updated.text = rewritten;
cell.formula = Some(Arc::new(updated));
}
Ok(None) => {}
Err(()) => {
cell.formula = None;
dropped = true;
}
if let Some(rewritten) = remap_external_formula(&fm.text, remap) {
let mut updated = (**fm).clone();
updated.text = rewritten;
cell.formula = Some(Arc::new(updated));
}
}
}
let mut kept_names = Vec::with_capacity(wb.names.len());
for mut name in std::mem::take(&mut wb.names) {
match remap_external_formula(&name.formula, remap) {
Ok(Some(rewritten)) => {
name.formula = rewritten;
kept_names.push(name);
}
Ok(None) => kept_names.push(name),
Err(()) => dropped = true,
for name in &mut wb.names {
if let Some(rewritten) = remap_external_formula(&name.formula, remap) {
name.formula = rewritten;
}
}
wb.names = kept_names;
if dropped {
report.warn("XLSB: formulas referencing unresolved external links were replaced with their cached values");
}
}
pub(crate) fn remap_external_formula(text: &str, remap: &[Option<usize>]) -> Result<Option<String>, ()> {
fn remap_external_formula(text: &str, remap: &[Option<usize>]) -> Option<String> {
let bytes = text.as_bytes();
let mut out: Option<String> = None;
let mut i = 0;
@@ -319,137 +299,103 @@ pub(crate) fn remap_external_formula(text: &str, remap: &[Option<usize>]) -> Res
if j > i + 1
&& j < bytes.len()
&& bytes[j] == b']'
&& is_external_ordinal(text, i, j)
&& let Ok(old) = text[i + 1..j].parse::<usize>()
&& let Some(&Some(new_n)) = remap.get(old)
&& new_n != old
{
let Some(&Some(new_n)) = remap.get(old) else {
return Err(());
};
if new_n != old {
let buf = out.get_or_insert_with(|| String::with_capacity(text.len()));
buf.push_str(&text[copied..=i]);
let _ = write!(buf, "{new_n}]");
i = j + 1;
copied = i;
continue;
}
let buf = out.get_or_insert_with(|| String::with_capacity(text.len()));
buf.push_str(&text[copied..=i]);
let _ = write!(buf, "{new_n}]");
i = j + 1;
copied = i;
continue;
}
}
i += 1;
}
if let Some(mut buf) = out {
buf.push_str(&text[copied..]);
Ok(Some(buf))
Some(buf)
} else {
Ok(None)
None
}
}
/// True when `[digits]` at `open..=close` is an external-book ordinal (`[1]Sheet!A1`,
/// `'[1]Other Sheet'!A1`, `[1]!Name`) rather than a numeric structured-table column (`Sales[2024]`,
/// `Sales[[#Headers],[2024]]`).
fn is_external_ordinal(text: &str, open: usize, close: usize) -> bool {
let bytes = text.as_bytes();
let prev = open.checked_sub(1).map(|k| bytes[k]);
if let Some(b) = prev
&& (b.is_ascii_alphanumeric() || matches!(b, b'_' | b'.' | b'\\' | b']' | b'['))
{
return false;
}
let mut k = close + 1;
if prev == Some(b'\'') {
while k < bytes.len() {
if bytes[k] == b'\'' {
if bytes.get(k + 1) == Some(&b'\'') {
k += 2;
continue;
}
return bytes.get(k + 1) == Some(&b'!');
}
k += 1;
}
return false;
}
if bytes.get(k) == Some(&b'!') {
return true;
}
let start = k;
while k < bytes.len() && (bytes[k].is_ascii_alphanumeric() || matches!(bytes[k], b'_' | b'.') || bytes[k] >= 0x80) {
k += 1;
}
k > start && bytes.get(k) == Some(&b'!')
}
fn external_link_part_xml(book: &craft_xlsx::ExternalBook) -> (String, Vec<PreservedRel>) {
fn external_link_part_xml(link: &craft_xlsx::ExternalLink) -> (String, Vec<PreservedRel>) {
let mut xml = format!("{XML_DECL}<externalLink xmlns=\"{NS_MAIN}\" xmlns:r=\"{NS_REL}\">");
let mut rels = Vec::new();
xml.push_str("<externalBook");
if let Some(target) = &book.target {
xml.push_str(" r:id=\"rId1\"");
rels.push(PreservedRel { id: "rId1".into(), rel_type: format!("{NS_REL}/externalLinkPath"), target: target.clone(), external: true });
}
xml.push('>');
if !book.sheet_names.is_empty() {
xml.push_str("<sheetNames>");
for name in &book.sheet_names {
let _ = write!(xml, "<sheetName val=\"{}\"/>", esc_attr(name));
if let craft_xlsx::ExternalLink::Book(book) = link {
xml.push_str("<externalBook");
if let Some(target) = &book.target {
xml.push_str(" r:id=\"rId1\"");
rels.push(PreservedRel { id: "rId1".into(), rel_type: format!("{NS_REL}/externalLinkPath"), target: target.clone(), external: true });
}
xml.push_str("</sheetNames>");
}
if !book.defined_names.is_empty() {
xml.push_str("<definedNames>");
for dn in &book.defined_names {
let _ = write!(xml, "<definedName name=\"{}\"", esc_attr(&dn.name));
if let Some(refers_to) = &dn.refers_to {
let _ = write!(xml, " refersTo=\"{}\"", esc_attr(refers_to));
xml.push('>');
if !book.sheet_names.is_empty() {
xml.push_str("<sheetNames>");
for name in &book.sheet_names {
let _ = write!(xml, "<sheetName val=\"{}\"/>", esc_attr(name));
}
if let Some(sheet_id) = dn.sheet_id {
let _ = write!(xml, " sheetId=\"{sheet_id}\"");
}
xml.push_str("/>");
xml.push_str("</sheetNames>");
}
xml.push_str("</definedNames>");
}
if !book.sheet_data.is_empty() {
xml.push_str("<sheetDataSet>");
for sd in &book.sheet_data {
let _ = write!(xml, "<sheetData sheetId=\"{}\"", sd.sheet_id);
if sd.refresh_error {
xml.push_str(" refreshError=\"1\"");
if !book.defined_names.is_empty() {
xml.push_str("<definedNames>");
for dn in &book.defined_names {
let _ = write!(xml, "<definedName name=\"{}\"", esc_attr(&dn.name));
if let Some(refers_to) = &dn.refers_to {
let _ = write!(xml, " refersTo=\"{}\"", esc_attr(refers_to));
}
if let Some(sheet_id) = dn.sheet_id {
let _ = write!(xml, " sheetId=\"{sheet_id}\"");
}
xml.push_str("/>");
}
xml.push('>');
let mut rows: BTreeMap<u32, Vec<(craft_xlsx::CellRef, &craft_xlsx::Value)>> = BTreeMap::new();
for (pos, val) in &sd.cells {
rows.entry(pos.row).or_default().push((*pos, val));
}
for (r, cells) in rows {
let _ = write!(xml, "<row r=\"{}\">", r + 1);
for (pos, val) in cells {
let r_attr = CellRef::new(pos.row, pos.col);
match val {
craft_xlsx::Value::Empty => {
let _ = write!(xml, "<cell r=\"{r_attr}\"/>");
}
craft_xlsx::Value::Number(n) => {
let _ = write!(xml, "<cell r=\"{r_attr}\"><v>{n}</v></cell>");
}
craft_xlsx::Value::Text(t) => {
let _ = write!(xml, "<cell r=\"{r_attr}\" t=\"str\"><v>{}</v></cell>", esc(t));
}
craft_xlsx::Value::Bool(b) => {
let _ = write!(xml, "<cell r=\"{r_attr}\" t=\"b\"><v>{}</v></cell>", if *b { "1" } else { "0" });
}
craft_xlsx::Value::Error(e) => {
let _ = write!(xml, "<cell r=\"{r_attr}\" t=\"e\"><v>{}</v></cell>", esc(map_cell_error(*e).as_str()));
xml.push_str("</definedNames>");
}
if !book.sheet_data.is_empty() {
xml.push_str("<sheetDataSet>");
for sd in &book.sheet_data {
let _ = write!(xml, "<sheetData sheetId=\"{}\"", sd.sheet_id);
if sd.refresh_error {
xml.push_str(" refreshError=\"1\"");
}
xml.push('>');
let mut rows: BTreeMap<u32, Vec<(craft_xlsx::CellRef, &craft_xlsx::Value)>> = BTreeMap::new();
for (pos, val) in &sd.cells {
rows.entry(pos.row).or_default().push((*pos, val));
}
for (r, cells) in rows {
let _ = write!(xml, "<row r=\"{}\">", r + 1);
for (pos, val) in cells {
let r_attr = CellRef::new(pos.row, pos.col);
match val {
craft_xlsx::Value::Empty => {
let _ = write!(xml, "<cell r=\"{r_attr}\"/>");
}
craft_xlsx::Value::Number(n) => {
let _ = write!(xml, "<cell r=\"{r_attr}\"><v>{n}</v></cell>");
}
craft_xlsx::Value::Text(t) => {
let _ = write!(xml, "<cell r=\"{r_attr}\" t=\"str\"><v>{}</v></cell>", esc(t));
}
craft_xlsx::Value::Bool(b) => {
let _ = write!(xml, "<cell r=\"{r_attr}\" t=\"b\"><v>{}</v></cell>", if *b { "1" } else { "0" });
}
craft_xlsx::Value::Error(e) => {
let _ = write!(xml, "<cell r=\"{r_attr}\" t=\"e\"><v>{}</v></cell>", esc(map_cell_error(*e).as_str()));
}
}
}
xml.push_str("</row>");
}
xml.push_str("</row>");
xml.push_str("</sheetData>");
}
xml.push_str("</sheetData>");
xml.push_str("</sheetDataSet>");
}
xml.push_str("</sheetDataSet>");
xml.push_str("</externalBook>");
} else {
xml.push_str("<ddeLink ddeService=\"external\" ddeTopic=\"external\"/>");
}
xml.push_str("</externalBook></externalLink>");
xml.push_str("</externalLink>");
(xml, rels)
}
+1 -2
View File
@@ -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-15 · **Change:** 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,
@@ -146,7 +146,6 @@ language (none so far) and of localized function names.
| Date | Change | Summary |
|---|---|---|
| 2026-11-18 | minor | The fill-handle menus (right-drag menu and Auto Fill Options: Copy Cells, Fill Series, Fill Formatting Only, Fill Without Formatting, Fill Days, Fill Weekdays, Fill Months, Fill Years, and the button's own name) have a row in all 18 non-English catalogs, and Series…, Down and Up from the Home › Fill menu in the nine catalogs that lacked them; the Ukrainian rows that held English are translated. A test fails when one goes missing (#4458). The translations are AI-assisted and not yet reviewed by native speakers |
| 2026-11-15 | minor | The RaTeX equation parser's messages follow the interface language: its 33 fixed messages are catalog keys, and its 33 messages that carry a piece of the source (a command, token, environment name or count) are read back into templates (`i18n::unfill`) whose translation is filled with the same pieces. A message of another shape, such as RaTeX's internal ones or the chemistry parser's, stays English. 66 new keys in every catalog (#4261) |
| 2026-11-10 | minor | Ukrainian Chart is `Діаграма`, matching [craft-i18n#211](https://github.com/storytold/craft-i18n/pull/211) and distinct from Diagram (`Схема`) |
| 2026-11-10 | minor | Diagram and Decorative Text labels in all 18 non-English catalogs; Diagram never repeats the catalog's chart word (German `Schema`, Ukrainian `Схема`, Romanian `Schemă`), see [feature-names.md](feature-names.md) |