mirror of
https://github.com/storytold/gridcraft.git
synced 2026-11-22 13:58:28 -06:00
Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
927d4d60a6 | ||
|
|
62e594c4f8 | ||
|
|
80a51416ed | ||
|
|
11a5711ab1 | ||
|
|
0b2b5c6a79 | ||
|
|
606fa7a37e | ||
|
|
d4ed031ec3 | ||
|
|
544a50c5cf | ||
|
|
60e9ae0222 |
@@ -409,16 +409,19 @@ 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. Elsewhere 45 is
|
||||
/// another error (EL2NSYNC on Linux) and stays a failed save.
|
||||
/// `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.
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
#[test]
|
||||
fn full_sync_tolerates_apple_enotsup() {
|
||||
use std::io::Error;
|
||||
use std::io::{Error, ErrorKind};
|
||||
let enotsup = Error::from_raw_os_error(45);
|
||||
assert!(flush_unsupported_on(&enotsup, true, true), "ENOTSUP on Apple");
|
||||
assert!(!flush_unsupported_on(&enotsup, true, false), "45 on other Unix");
|
||||
assert!(!flush_unsupported_on(&enotsup, false, false), "45 on Windows");
|
||||
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(&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");
|
||||
|
||||
@@ -548,6 +548,35 @@ 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.
|
||||
|
||||
@@ -728,6 +728,15 @@ 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,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -650,6 +650,18 @@ 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,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1135,6 +1135,15 @@ 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,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -656,6 +656,18 @@ 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,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -618,6 +618,18 @@ 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,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1139,6 +1139,15 @@ 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,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1288,6 +1288,15 @@ 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
|
||||
|
||||
@@ -616,6 +616,18 @@ 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,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -691,6 +691,15 @@ 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,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1127,6 +1127,15 @@ 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,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1143,6 +1143,15 @@ 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,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1189,6 +1189,15 @@ 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,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1193,6 +1193,15 @@ 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,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -609,6 +609,18 @@ 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,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -581,6 +581,18 @@ 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,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -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,6 +1131,15 @@ 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,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -577,6 +577,18 @@ 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,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -600,6 +600,18 @@ 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,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -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 = missing ("missing"), Book 2 = valid ("ext2").
|
||||
// Book 0 = self, Book 1 = non-workbook DDE ("ext1"), Book 2 = valid workbook ("ext2").
|
||||
wb_records.extend(record(357, &[]));
|
||||
wb_records.extend(record(355, &wide("missing")));
|
||||
wb_records.extend(record(355, &wide("ext1")));
|
||||
wb_records.extend(record(355, &wide("ext2")));
|
||||
let mut xti = 2u32.to_le_bytes().to_vec();
|
||||
for (bk, first, last) in [(1u32, 0i32, 0i32), (2, 0, 0)] {
|
||||
for (bk, first, last) in [(1u32, -2i32, -2i32), (2, 0, 0)] {
|
||||
xti.extend(bk.to_le_bytes());
|
||||
xti.extend(first.to_le_bytes());
|
||||
xti.extend(last.to_le_bytes());
|
||||
@@ -612,6 +612,17 @@ 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"));
|
||||
@@ -632,12 +643,7 @@ fn xlsb_external_link_ordinals_preserve_missing_slots_on_xlsx_save() {
|
||||
data.extend(0u32.to_le_bytes());
|
||||
record(9, &data)
|
||||
};
|
||||
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_1 = [0x39, 0, 0, 1, 0, 0, 0];
|
||||
let ptg_2 = {
|
||||
let mut v = vec![0x3A, 1, 0];
|
||||
v.extend(0u32.to_le_bytes());
|
||||
@@ -648,8 +654,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="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 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 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()),
|
||||
@@ -658,18 +664,59 @@ 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("external link")), "{:?}", report.warnings);
|
||||
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!(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("[2]SheetA!$A$1"));
|
||||
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 mut zip = zip::ZipArchive::new(std::io::Cursor::new(saved)).unwrap();
|
||||
let mut wb_xml = String::new();
|
||||
std::io::Read::read_to_string(&mut zip.by_name("xl/workbook.xml").unwrap(), &mut wb_xml).unwrap();
|
||||
assert!(wb_xml.contains("<externalReference/><externalReference r:id="), "{wb_xml}");
|
||||
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();
|
||||
let mut zip = zip::ZipArchive::new(std::io::Cursor::new(saved2)).unwrap();
|
||||
let read_zip = |z: &mut zip::ZipArchive<std::io::Cursor<Vec<u8>>>, name: &str| {
|
||||
let mut s = String::new();
|
||||
std::io::Read::read_to_string(&mut z.by_name(name).unwrap(), &mut s).unwrap();
|
||||
s
|
||||
};
|
||||
let wb_xml = read_zip(&mut zip, "xl/workbook.xml");
|
||||
let ref_ids: Vec<&str> =
|
||||
wb_xml.split("<externalReference ").skip(1).filter_map(|s| s.split("r:id=\"").nth(1).and_then(|t| t.split('"').next())).collect();
|
||||
assert_eq!(ref_ids.len(), 1, "only the surviving external link should be emitted: {wb_xml}");
|
||||
let wb_rels = read_zip(&mut zip, "xl/_rels/workbook.xml.rels");
|
||||
let link_target = wb_rels
|
||||
.split("<Relationship ")
|
||||
.find(|r| r.contains(&format!("Id=\"{}\"", ref_ids[0])))
|
||||
.and_then(|r| r.split("Target=\"").nth(1))
|
||||
.and_then(|s| s.split('"').next())
|
||||
.expect("externalReference r:id should resolve in workbook.xml.rels")
|
||||
.trim_start_matches('/');
|
||||
let link_part = if link_target.starts_with("xl/") { link_target.to_string() } else { format!("xl/{link_target}") };
|
||||
let link_xml = read_zip(&mut zip, &link_part);
|
||||
assert!(link_xml.contains("<externalBook ") && link_xml.contains("<sheetName val=\"SheetA\"/>"), "{link_xml}");
|
||||
let (dir, file) = link_part.rsplit_once('/').unwrap();
|
||||
let link_rels = read_zip(&mut zip, &format!("{dir}/_rels/{file}.rels"));
|
||||
assert!(
|
||||
link_rels.contains("externalLinkPath") && link_rels.contains("Target=\"SecondBook.xlsx\"") && link_rels.contains("TargetMode=\"External\""),
|
||||
"{link_rels}"
|
||||
);
|
||||
}
|
||||
|
||||
+214
-78
@@ -194,9 +194,13 @@ pub fn read_xlsb(bytes: &[u8]) -> Result<(Workbook, ReadReport), IoError> {
|
||||
}
|
||||
import_defined_names(&book, &file_to_model, &mut wb);
|
||||
let external_links = package.external_links(&book).map_err(map_error)?;
|
||||
if let Some(preserved) = preserve_external_links(&external_links) {
|
||||
let (preserved, ordinal_map) = preserve_external_links(&external_links, &mut report);
|
||||
if let Some(preserved) = preserved {
|
||||
wb.preserved = Some(Arc::new(preserved));
|
||||
}
|
||||
if let Some(remap) = ordinal_map {
|
||||
remap_workbook_external_ordinals(&mut wb, &remap, &mut report);
|
||||
}
|
||||
for warning in package.warnings() {
|
||||
report.warn(warning);
|
||||
}
|
||||
@@ -211,109 +215,241 @@ pub(crate) fn is_xlsb(bytes: &[u8]) -> bool {
|
||||
craft_xlsx::is_xlsb(bytes)
|
||||
}
|
||||
|
||||
fn preserve_external_links(links: &[(String, Option<craft_xlsx::ExternalLink>)]) -> Option<Preserved> {
|
||||
fn preserve_external_links(
|
||||
links: &[(String, Option<craft_xlsx::ExternalLink>)],
|
||||
report: &mut ReadReport,
|
||||
) -> (Option<Preserved>, Option<Vec<Option<usize>>>) {
|
||||
if links.is_empty() {
|
||||
return None;
|
||||
return (None, None);
|
||||
}
|
||||
const CT_EXT_LINK: &str = "application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml";
|
||||
let mut p = Preserved::default();
|
||||
let mut refs_xml = format!("<externalReferences xmlns:r=\"{NS_REL}\">");
|
||||
let mut has_any = false;
|
||||
let mut remap = vec![None; links.len() + 1];
|
||||
let mut next_ordinal = 0usize;
|
||||
let mut had_unpreserved = false;
|
||||
for (i, (_, link)) in links.iter().enumerate() {
|
||||
let Some(link) = link else {
|
||||
// Preserve the 1-based `[n]` ordinal for later links when an earlier slot is missing.
|
||||
refs_xml.push_str("<externalReference/>");
|
||||
let Some(craft_xlsx::ExternalLink::Book(book)) = link else {
|
||||
had_unpreserved = true;
|
||||
continue;
|
||||
};
|
||||
has_any = true;
|
||||
let rid = format!("rId{}", i + 1);
|
||||
let part_name = format!("xl/externalLinks/externalLink{}.xml", i + 1);
|
||||
let (xml, rels) = external_link_part_xml(link);
|
||||
if book.target.is_none() {
|
||||
had_unpreserved = true;
|
||||
continue;
|
||||
}
|
||||
next_ordinal += 1;
|
||||
let old_ordinal = i + 1;
|
||||
remap[old_ordinal] = Some(next_ordinal);
|
||||
let rid = format!("rId{next_ordinal}");
|
||||
let part_name = format!("xl/externalLinks/externalLink{next_ordinal}.xml");
|
||||
let (xml, rels) = external_link_part_xml(book);
|
||||
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 !has_any {
|
||||
return None;
|
||||
if had_unpreserved {
|
||||
report.warn("XLSB: unresolved or non-workbook external links kept their cached values; their targets could not be preserved");
|
||||
}
|
||||
refs_xml.push_str("</externalReferences>");
|
||||
p.elements.push(PreservedXml { slot: "externalReferences".into(), xml: refs_xml });
|
||||
Some(p)
|
||||
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))
|
||||
}
|
||||
|
||||
fn external_link_part_xml(link: &craft_xlsx::ExternalLink) -> (String, Vec<PreservedRel>) {
|
||||
fn remap_workbook_external_ordinals(wb: &mut Workbook, remap: &[Option<usize>], report: &mut ReadReport) {
|
||||
let mut dropped = false;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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,
|
||||
}
|
||||
}
|
||||
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>, ()> {
|
||||
let bytes = text.as_bytes();
|
||||
let mut out: Option<String> = None;
|
||||
let mut i = 0;
|
||||
let mut copied = 0;
|
||||
let mut in_string = false;
|
||||
while i < bytes.len() {
|
||||
if bytes[i] == b'"' {
|
||||
in_string = !in_string;
|
||||
i += 1;
|
||||
continue;
|
||||
}
|
||||
if !in_string && bytes[i] == b'[' {
|
||||
let mut j = i + 1;
|
||||
while j < bytes.len() && bytes[j].is_ascii_digit() {
|
||||
j += 1;
|
||||
}
|
||||
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) 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
i += 1;
|
||||
}
|
||||
if let Some(mut buf) = out {
|
||||
buf.push_str(&text[copied..]);
|
||||
Ok(Some(buf))
|
||||
} else {
|
||||
Ok(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>) {
|
||||
let mut xml = format!("{XML_DECL}<externalLink xmlns=\"{NS_MAIN}\" xmlns:r=\"{NS_REL}\">");
|
||||
let mut rels = Vec::new();
|
||||
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("<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));
|
||||
}
|
||||
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));
|
||||
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_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));
|
||||
}
|
||||
if let Some(sheet_id) = dn.sheet_id {
|
||||
let _ = write!(xml, " sheetId=\"{sheet_id}\"");
|
||||
}
|
||||
xml.push_str("/>");
|
||||
if let Some(sheet_id) = dn.sheet_id {
|
||||
let _ = write!(xml, " sheetId=\"{sheet_id}\"");
|
||||
}
|
||||
xml.push_str("</definedNames>");
|
||||
xml.push_str("/>");
|
||||
}
|
||||
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("</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("</sheetData>");
|
||||
xml.push_str("</row>");
|
||||
}
|
||||
xml.push_str("</sheetDataSet>");
|
||||
xml.push_str("</sheetData>");
|
||||
}
|
||||
xml.push_str("</externalBook>");
|
||||
xml.push_str("</sheetDataSet>");
|
||||
}
|
||||
xml.push_str("</externalLink>");
|
||||
xml.push_str("</externalBook></externalLink>");
|
||||
(xml, rels)
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Localization parity
|
||||
|
||||
> **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
|
||||
> **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
|
||||
|
||||
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,6 +146,7 @@ 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) |
|
||||
|
||||
Reference in New Issue
Block a user