Skip to content

VectorCraft: An open-source, vector art tool written by scratch in pure Rust

Variables: Import Data Sets reports why a cell was refused

dotCooCoo660102064f44
diff --git a/crates/engine/src/cmd/variablecmds/csv.rs b/crates/engine/src/cmd/variablecmds/csv.rs
index 65388fb16..ee61436fa 100644
--- a/crates/engine/src/cmd/variablecmds/csv.rs
+++ b/crates/engine/src/cmd/variablecmds/csv.rs
@@ -152,17 +152,19 @@ fn csv_escape(s: &str) -> String {
if s.is_empty() || s.contains([',', '"', '\n', '\r']) || s != s.trim() { format!("\"{}\"", s.replace('"', "\"\"")) } else { s.to_string() }
}
-/// A visibility cell: true/false, 1/0, yes/no (ASCII, case-insensitive).
-fn parse_visible_cell(s: &str, var: &str, cmd: &str) -> Result<bool> {
+/// A visibility cell: true/false, 1/0, yes/no (ASCII, case-insensitive). An error names the
+/// file line `line`.
+fn parse_visible_cell(s: &str, var: &str, line: usize, cmd: &str) -> Result<bool> {
match s.trim().to_ascii_lowercase().as_str() {
"true" | "1" | "yes" => Ok(true),
"false" | "0" | "no" => Ok(false),
- _ => Err(bad(cmd, format!("value for `{var}` must be true or false"))),
+ _ => Err(bad(cmd, format!("line {line}: value for `{var}` must be true or false"))),
}
}
-/// The value of a cell. A quoted empty text cell is an empty text value; any other empty cell is no value.
-fn cell_to_value(kind: VariableKind, cell: &str, quoted: bool, var: &str, cmd: &str) -> Result<Option<DataValue>> {
+/// The value of a cell on file line `line`. A quoted empty text cell is an empty text value; any
+/// other empty cell is no value. An error names the line and the reason.
+fn cell_to_value(kind: VariableKind, cell: &str, quoted: bool, var: &str, line: usize, cmd: &str) -> Result<Option<DataValue>> {
// A text cell is not trimmed here (the parser trims unquoted cells); image, graph and
// visibility cells are trimmed.
let t = if kind == VariableKind::Text { cell } else { cell.trim() };
@@ -173,8 +175,8 @@ fn cell_to_value(kind: VariableKind, cell: &str, quoted: bool, var: &str, cmd: &
VariableKind::Text => DataValue::Text(t.to_string()),
VariableKind::Image => DataValue::Image(t.to_string()),
VariableKind::Graph if t.len() <= MAX_GRAPH_CSV => DataValue::Graph(t.to_string()),
- VariableKind::Graph => return Err(bad(cmd, format!("value for `{var}` is longer than {MAX_GRAPH_CSV} bytes"))),
- VariableKind::Visibility => DataValue::Visible(parse_visible_cell(t, var, cmd)?),
+ VariableKind::Graph => return Err(bad(cmd, format!("line {line}: value for `{var}` is longer than {MAX_GRAPH_CSV} bytes"))),
+ VariableKind::Visibility => DataValue::Visible(parse_visible_cell(t, var, line, cmd)?),
}))
}
@@ -310,12 +312,8 @@ pub(super) fn dataset_import(s: &mut Session, p: &Value) -> Result<Value> {
for &(col, ref var, kind) in &columns {
let cell = row.get(col).map(String::as_str).unwrap_or("");
let was_quoted = quoted.get(col).copied().unwrap_or(false);
- match cell_to_value(kind, cell, was_quoted, var, C) {
- Ok(Some(v)) => {
- values.insert(var.clone(), v);
- }
- Ok(None) => {}
- Err(_) => return Err(bad(C, format!("line {line}: value for `{var}` must match its variable kind"))),
+ if let Some(v) = cell_to_value(kind, cell, was_quoted, var, line, C)? {
+ values.insert(var.clone(), v);
}
}
parsed.push(DataSet { name, values });
diff --git a/crates/engine/src/tests/variables.rs b/crates/engine/src/tests/variables.rs
index f57f8a597..7650df6a2 100644
--- a/crates/engine/src/tests/variables.rs
+++ b/crates/engine/src/tests/variables.rs
@@ -1416,6 +1416,23 @@ fn datasets_csv_row_errors_name_the_file_line() {
assert!(long.contains("line 3:") && long.contains("longer than 255"), "{long}");
}
+/// A refused cell's error gives its line and why the value was refused: a visibility value that
+/// isn't true or false, or a graph value longer than the graph data limit.
+#[test]
+fn datasets_csv_cell_errors_say_why() {
+ let mut s = session();
+ s.execute("variable.define", &json!({"name": "Show", "kind": "visibility"})).unwrap();
+ s.execute("variable.define", &json!({"name": "Sales", "kind": "graph"})).unwrap();
+ let error = |s: &mut Session, csv: &str| s.execute("dataset.import", &json!({"csv": csv})).unwrap_err();
+ let maybe = error(&mut s, "name,Show\nX,maybe");
+ let want = "line 2: value for `Show` must be true or false";
+ assert!(matches!(&maybe, EngineError::BadParams { msg, .. } if msg == want), "{maybe}");
+ let long = error(&mut s, &format!("name,Sales\nX,\"{}\"", "1,".repeat(140_000)));
+ let want = "line 2: value for `Sales` is longer than 262144 bytes";
+ assert!(matches!(&long, EngineError::BadParams { msg, .. } if msg == want), "{long}");
+ assert!(s.doc().unwrap().doc.variables.datasets.is_empty());
+}
+
/// A header cell that names no variable defines one, unbound, in the import's undo step: `#`
/// defines a visibility variable, `@` defines an image variable, and a cell without a prefix
/// defines a text variable. Importing the file again finds them; a prefix of the other kind, a
diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv
index 21b2ff53f..6564f158d 100644
--- a/crates/ui-egui/src/i18n/ca.tsv
+++ b/crates/ui-egui/src/i18n/ca.tsv
@@ -5086,6 +5086,8 @@ digits Malayalam Malaiàlam
@msg lang must be one of {_1} lang ha de ser un de {_1}
@msg larger than 256 MB més gran de 256 MB
@msg layers can't be wrap objects les capes no poden ser objectes d’embolcall
+@msg line {line}: value for `{var}` must be true or false línia {line}: el valor de `{var}` ha de ser true o false
+@msg line {line}: value for `{var}` is longer than {MAX_GRAPH_CSV} bytes línia {line}: el valor de `{var}` ocupa més de {MAX_GRAPH_CSV} bytes
@msg library panel `{given}` isn't missing its library al panell de biblioteca `{given}` no li falta la biblioteca
@msg library panel `{given}` isn't open el panell de biblioteca `{given}` no està obert
@msg linked pictures show the low-resolution preview saved in the file until their files are found: relink them in the Links panel les imatges enllaçades mostren la previsualització de baixa resolució desada al fitxer fins que es trobin els seus fitxers: torneu-les a enllaçar al panell Enllaços
diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv
index b1742b59b..eb9709c6f 100644
--- a/crates/ui-egui/src/i18n/cs.tsv
+++ b/crates/ui-egui/src/i18n/cs.tsv
@@ -4472,6 +4472,8 @@ imageTrace Outline Obrys
@msg join needs open paths spojení vyžaduje otevřené cesty
@msg lang must be one of {_1} lang musí být jedno z {_1}
@msg layers can't be wrap objects vrstvy nemohou být objekty obtékání
+@msg line {line}: value for `{var}` must be true or false řádek {line}: hodnota pro `{var}` musí být true nebo false
+@msg line {line}: value for `{var}` is longer than {MAX_GRAPH_CSV} bytes řádek {line}: hodnota pro `{var}` je delší než {MAX_GRAPH_CSV} bajtů
@msg missing `folder` chybí `folder`
@msg missing `id` (see plugin.list) chybí `id` (viz plugin.list)
@msg missing `name` chybí `name`
diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv
index d850991b1..789baa3dd 100644
--- a/crates/ui-egui/src/i18n/de.tsv
+++ b/crates/ui-egui/src/i18n/de.tsv
@@ -4079,6 +4079,8 @@ theme Appearance Erscheinungsbild
@msg join needs open paths zum Zusammenfügen sind offene Pfade nötig
@msg lang must be one of {_1} lang muss einer der folgenden Werte sein: {_1}
@msg layers can't be wrap objects Ebenen können keine Umflussobjekte sein
+@msg line {line}: value for `{var}` must be true or false Zeile {line}: der Wert für `{var}` muss true oder false sein
+@msg line {line}: value for `{var}` is longer than {MAX_GRAPH_CSV} bytes Zeile {line}: der Wert für `{var}` ist länger als {MAX_GRAPH_CSV} Byte
@msg missing `folder` `folder` fehlt
@msg missing `id` (see plugin.list) `id` fehlt (siehe plugin.list)
@msg missing `name` `name` fehlt
diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv
index ca944e5e9..521e8761a 100644
--- a/crates/ui-egui/src/i18n/el.tsv
+++ b/crates/ui-egui/src/i18n/el.tsv
@@ -4119,6 +4119,8 @@ digits Malayalam Μαλαγιάλαμ
@msg join needs open paths η ένωση απαιτεί ανοιχτές διαδρομές
@msg lang must be one of {_1} η γλώσσα πρέπει να είναι μία από τις {_1}
@msg layers can't be wrap objects τα επίπεδα δεν μπορούν να είναι αντικείμενα αναδίπλωσης
+@msg line {line}: value for `{var}` must be true or false γραμμή {line}: η τιμή για το `{var}` πρέπει να είναι true ή false
+@msg line {line}: value for `{var}` is longer than {MAX_GRAPH_CSV} bytes γραμμή {line}: η τιμή για το `{var}` είναι μεγαλύτερη από {MAX_GRAPH_CSV} byte
@msg missing `folder` λείπει το `folder`
@msg missing `id` (see plugin.list) λείπει το `id` (δείτε plugin.list)
@msg missing `name` λείπει το `name`
diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv
index bc2b918aa..a262f90b6 100644
--- a/crates/ui-egui/src/i18n/es.tsv
+++ b/crates/ui-egui/src/i18n/es.tsv
@@ -4165,6 +4165,8 @@ axis Both Ambos
@msg join needs open paths unir necesita trazados abiertos
@msg lang must be one of {_1} lang debe ser uno de estos: {_1}
@msg layers can't be wrap objects las capas no pueden ser objetos para ceñir
+@msg line {line}: value for `{var}` must be true or false línea {line}: el valor de `{var}` debe ser true o false
+@msg line {line}: value for `{var}` is longer than {MAX_GRAPH_CSV} bytes línea {line}: el valor de `{var}` ocupa más de {MAX_GRAPH_CSV} bytes
@msg missing `folder` falta `folder`
@msg missing `id` (see plugin.list) falta `id` (consulta plugin.list)
@msg missing `name` falta `name`
diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv
index 3d75fc5d7..764b84f2d 100644
--- a/crates/ui-egui/src/i18n/fi.tsv
+++ b/crates/ui-egui/src/i18n/fi.tsv
@@ -4380,6 +4380,8 @@ imageTrace Outline Ääriviiva
@msg join needs open paths liittäminen vaatii avoimia polkuja
@msg lang must be one of {_1} lang-arvon on oltava jokin seuraavista: {_1}
@msg layers can't be wrap objects tasot eivät voi olla rivitysobjekteja
+@msg line {line}: value for `{var}` must be true or false rivi {line}: muuttujan `{var}` arvon on oltava true tai false
+@msg line {line}: value for `{var}` is longer than {MAX_GRAPH_CSV} bytes rivi {line}: muuttujan `{var}` arvo on pidempi kuin {MAX_GRAPH_CSV} tavua
@msg missing `folder` `folder` puuttuu
@msg missing `id` (see plugin.list) `id` puuttuu (ks. plugin.list)
@msg missing `name` `name` puuttuu
diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv
index c5b62d657..c9625a873 100644
--- a/crates/ui-egui/src/i18n/fr.tsv
+++ b/crates/ui-egui/src/i18n/fr.tsv
@@ -4155,6 +4155,8 @@ axis Both Les deux
@msg join needs open paths la jonction nécessite des tracés ouverts
@msg lang must be one of {_1} lang doit valoir l’une de ces valeurs : {_1}
@msg layers can't be wrap objects les calques ne peuvent pas être des objets d’habillage
+@msg line {line}: value for `{var}` must be true or false ligne {line} : la valeur de `{var}` doit valoir true ou false
+@msg line {line}: value for `{var}` is longer than {MAX_GRAPH_CSV} bytes ligne {line} : la valeur de `{var}` dépasse {MAX_GRAPH_CSV} octets
@msg missing `folder` `folder` manquant
@msg missing `id` (see plugin.list) `id` manquant (voir plugin.list)
@msg missing `name` `name` manquant
diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv
index bdcbfa992..fc7937377 100644
--- a/crates/ui-egui/src/i18n/hu.tsv
+++ b/crates/ui-egui/src/i18n/hu.tsv
@@ -4810,6 +4810,8 @@ imageTrace Outline Körvonal
@msg lang must be one of {_1} a lang értéke ezek egyike lehet: {_1}
@msg larger than 256 MB nagyobb 256 MB-nál
@msg layers can't be wrap objects réteg nem lehet körbefuttató objektum
+@msg line {line}: value for `{var}` must be true or false {line}. sor: a(z) `{var}` értéke csak true vagy false lehet
+@msg line {line}: value for `{var}` is longer than {MAX_GRAPH_CSV} bytes {line}. sor: a(z) `{var}` értéke hosszabb {MAX_GRAPH_CSV} bájtnál
@msg Live Paint Merge: select a Live Paint group and the paths to add Élő festés egyesítése: jelölj ki egy élőfestés-csoportot és a hozzáadandó útvonalakat
@msg Live Paint takes paths and compound paths: convert type, images and other objects to paths first Az élő festés útvonalakat és összetett útvonalakat fogad: előbb alakítsd útvonallá a szöveget, a képeket és a többi objektumot
@msg Live Paint: select paths or compound paths Élő festés: jelölj ki útvonalakat vagy összetett útvonalakat
diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv
index b912c4e8f..0cc2f2d91 100644
--- a/crates/ui-egui/src/i18n/it.tsv
+++ b/crates/ui-egui/src/i18n/it.tsv
@@ -4206,6 +4206,8 @@ axis Both Entrambi
@msg join needs open paths per unire servono tracciati aperti
@msg lang must be one of {_1} lang deve essere uno dei seguenti: {_1}
@msg layers can't be wrap objects i livelli non possono essere oggetti di avvolgimento
+@msg line {line}: value for `{var}` must be true or false riga {line}: il valore di `{var}` deve essere true o false
+@msg line {line}: value for `{var}` is longer than {MAX_GRAPH_CSV} bytes riga {line}: il valore di `{var}` supera i {MAX_GRAPH_CSV} byte
@msg missing `folder` manca `folder`
@msg missing `id` (see plugin.list) manca `id` (vedi plugin.list)
@msg missing `name` manca `name`
diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv
index 0380bf497..eb24f7595 100644
--- a/crates/ui-egui/src/i18n/ja.tsv
+++ b/crates/ui-egui/src/i18n/ja.tsv
@@ -4285,6 +4285,8 @@ swatch Bright Violet ビビッドバイオレット
@msg node {_1} is not text ノード {_1} はテキストではありません
@msg Text Wrap: select a wrap object テキストの回り込み: 回り込みオブジェクトを選択してください
@msg layers can't be wrap objects レイヤーは回り込みオブジェクトにできません
+@msg line {line}: value for `{var}` must be true or false {line} 行目: `{var}` の値には true または false を指定してください
+@msg line {line}: value for `{var}` is longer than {MAX_GRAPH_CSV} bytes {line} 行目: `{var}` の値が {MAX_GRAPH_CSV} バイトを超えています
@msg no threaded text selected スレッドテキストが選択されていません
@msg Create Outlines: select text objects アウトラインを作成: テキストオブジェクトを選択してください
@msg paste unavailable 貼り付けを使用できません
diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv
index 296a233f8..883e00dca 100644
--- a/crates/ui-egui/src/i18n/ka.tsv
+++ b/crates/ui-egui/src/i18n/ka.tsv
@@ -3938,6 +3938,8 @@ font-technology Variable ცვლადი
@msg join needs open paths შეერთებას ღია ტრაექტორიები სჭირდება
@msg lang must be one of {_1} lang უნდა იყოს ერთ-ერთი: {_1}
@msg layers can't be wrap objects შრეები შემოსავლელი ობიექტები ვერ იქნება
+@msg line {line}: value for `{var}` must be true or false სტრიქონი {line}: `{var}`-ის მნიშვნელობა უნდა იყოს true ან false
+@msg line {line}: value for `{var}` is longer than {MAX_GRAPH_CSV} bytes სტრიქონი {line}: `{var}`-ის მნიშვნელობა {MAX_GRAPH_CSV} ბაიტზე გრძელია
@msg missing `folder` აკლია `folder`
@msg missing `id` (see plugin.list) აკლია `id` (იხ. plugin.list)
@msg missing `name` აკლია `name`
diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv
index 59baeea9f..0164762a5 100644
--- a/crates/ui-egui/src/i18n/ko.tsv
+++ b/crates/ui-egui/src/i18n/ko.tsv
@@ -4212,6 +4212,8 @@ theme Appearance 외관
@msg node {_1} is not text 노드 {_1}은(는) 텍스트가 아닙니다
@msg Text Wrap: select a wrap object 텍스트 감싸기: 감싸기 개체를 선택하세요
@msg layers can't be wrap objects 레이어는 감싸기 개체가 될 수 없습니다
+@msg line {line}: value for `{var}` must be true or false {line}행: `{var}`의 값은 true 또는 false여야 합니다
+@msg line {line}: value for `{var}` is longer than {MAX_GRAPH_CSV} bytes {line}행: `{var}`의 값이 {MAX_GRAPH_CSV}바이트보다 깁니다
@msg no threaded text selected 선택한 연결 텍스트가 없습니다
@msg Create Outlines: select text objects 윤곽선 만들기: 텍스트 개체를 선택하세요
@msg paste unavailable 붙여넣을 수 없습니다
diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv
index 8f292c0d9..5d57e77cf 100644
--- a/crates/ui-egui/src/i18n/pl.tsv
+++ b/crates/ui-egui/src/i18n/pl.tsv
@@ -4295,6 +4295,8 @@ imageTrace Outline Kontur
@msg join needs open paths łączenie wymaga otwartych ścieżek
@msg lang must be one of {_1} lang musi mieć jedną z wartości: {_1}
@msg layers can't be wrap objects warstwy nie mogą być obiektami oblewanymi
+@msg line {line}: value for `{var}` must be true or false wiersz {line}: wartość `{var}` musi być true lub false
+@msg line {line}: value for `{var}` is longer than {MAX_GRAPH_CSV} bytes wiersz {line}: wartość `{var}` jest dłuższa niż {MAX_GRAPH_CSV} bajtów
@msg missing `folder` brak `folder`
@msg missing `id` (see plugin.list) brak `id` (patrz plugin.list)
@msg missing `name` brak `name`
diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv
index f4c43bdb8..c725ba6c6 100644
--- a/crates/ui-egui/src/i18n/pt-br.tsv
+++ b/crates/ui-egui/src/i18n/pt-br.tsv
@@ -3739,6 +3739,8 @@ axis Both Ambos
@msg join needs open paths unir exige traçados abertos
@msg lang must be one of {_1} lang deve ser um de {_1}
@msg layers can't be wrap objects camadas não podem ser objetos de quebra
+@msg line {line}: value for `{var}` must be true or false linha {line}: o valor de `{var}` deve ser true ou false
+@msg line {line}: value for `{var}` is longer than {MAX_GRAPH_CSV} bytes linha {line}: o valor de `{var}` tem mais de {MAX_GRAPH_CSV} bytes
@msg missing `folder` falta `folder`
@msg missing `id` (see plugin.list) falta `id` (veja plugin.list)
@msg missing `name` falta `name`
diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv
index 9798ffe64..f28fa3fca 100644
--- a/crates/ui-egui/src/i18n/ru.tsv
+++ b/crates/ui-egui/src/i18n/ru.tsv
@@ -4201,6 +4201,8 @@ axis Both Оба
@msg join needs open paths соединение требует открытых контуров
@msg lang must be one of {_1} lang должен быть одним из: {_1}
@msg layers can't be wrap objects слои не могут быть объектами обтекания
+@msg line {line}: value for `{var}` must be true or false строка {line}: значение `{var}` должно быть true или false
+@msg line {line}: value for `{var}` is longer than {MAX_GRAPH_CSV} bytes строка {line}: значение `{var}` длиннее {MAX_GRAPH_CSV} байт
@msg missing `folder` отсутствует `folder`
@msg missing `id` (see plugin.list) отсутствует `id` (см. plugin.list)
@msg missing `name` отсутствует `name`
diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv
index 1b6429b62..6f30ec2e0 100644
--- a/crates/ui-egui/src/i18n/sv.tsv
+++ b/crates/ui-egui/src/i18n/sv.tsv
@@ -4070,6 +4070,8 @@ axis Both Båda
@msg join needs open paths foga samman kräver öppna banor
@msg lang must be one of {_1} lang måste vara något av {_1}
@msg layers can't be wrap objects lager kan inte vara radbrytningsobjekt
+@msg line {line}: value for `{var}` must be true or false rad {line}: värdet för `{var}` måste vara true eller false
+@msg line {line}: value for `{var}` is longer than {MAX_GRAPH_CSV} bytes rad {line}: värdet för `{var}` är längre än {MAX_GRAPH_CSV} byte
@msg missing `folder` `folder` saknas
@msg missing `id` (see plugin.list) `id` saknas (se plugin.list)
@msg missing `name` `name` saknas
diff --git a/crates/ui-egui/src/i18n/tests.rs b/crates/ui-egui/src/i18n/tests.rs
index b0da961f0..6bbfb107b 100644
--- a/crates/ui-egui/src/i18n/tests.rs
+++ b/crates/ui-egui/src/i18n/tests.rs
@@ -1796,6 +1796,34 @@ fn postscript_errors_keep_their_name_and_meaning() {
}
}
+/// Import Data Sets' errors for a refused cell are translated in every language that translates
+/// every message, with the line and the variable kept.
+#[test]
+fn dataset_import_cell_errors_are_translated() {
+ use serde_json::json;
+ use vectorcraft_engine::{EngineError, Session};
+ let mut s = Session::new();
+ s.execute("file.new", &json!({})).unwrap();
+ s.execute("variable.define", &json!({"name": "Show", "kind": "visibility"})).unwrap();
+ s.execute("variable.define", &json!({"name": "Sales", "kind": "graph"})).unwrap();
+ let mut errors = vec![];
+ for (csv, want) in [
+ ("name,Show\nX,maybe".to_string(), "line 2: value for `Show` must be true or false"),
+ (format!("name,Sales\nX,\"{}\"", "1,".repeat(140_000)), "line 2: value for `Sales` is longer than 262144 bytes"),
+ ] {
+ let e = s.execute("dataset.import", &json!({"csv": csv})).unwrap_err();
+ assert!(matches!(&e, EngineError::BadParams { msg, .. } if msg == want), "{e}");
+ errors.push((e.to_string(), want));
+ }
+ for code in COMPLETE_MESSAGES {
+ let lang = Lang::from_code(code).expect("registered");
+ for (e, want) in &errors {
+ let shown = message(lang, e);
+ assert!(!shown.contains(want) && shown.contains('2') && shown.contains('`'), "{code}: {shown}");
+ }
+ }
+}
+
/// The errors of the parameter checks that many commands share (a number given as text, a missing
/// number or index, a fraction for a whole number, `ids` that aren't a list of object ids, an
/// object id that is negative or names no object, a date that isn't Unix seconds) fill their
diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv
index 66e00165b..8f6e7c491 100644
--- a/crates/ui-egui/src/i18n/tr.tsv
+++ b/crates/ui-egui/src/i18n/tr.tsv
@@ -3932,6 +3932,8 @@ axis Both Her İkisi
@msg join needs open paths katılmak için açık yollara ihtiyaç var
@msg lang must be one of {_1} dil {_1}'den biri olmalıdır
@msg layers can't be wrap objects katmanlar sarma nesneleri olamaz
+@msg line {line}: value for `{var}` must be true or false satır {line}: `{var}` değeri true veya false olmalıdır
+@msg line {line}: value for `{var}` is longer than {MAX_GRAPH_CSV} bytes satır {line}: `{var}` değeri {MAX_GRAPH_CSV} bayttan uzun
@msg missing `folder` 'klasör' eksik
@msg missing `id` (see plugin.list) `kimlik` eksik (bkz. eklenti.liste)
@msg missing `name` "isim" eksik
diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv
index ce992f29a..86a10d0d4 100644
--- a/crates/ui-egui/src/i18n/uk.tsv
+++ b/crates/ui-egui/src/i18n/uk.tsv
@@ -4190,6 +4190,8 @@ axis Both Обидві
@msg join needs open paths з’єднання вимагає відкритих контурів
@msg lang must be one of {_1} lang має бути одним з: {_1}
@msg layers can't be wrap objects шари не можуть бути об’єктами обтікання
+@msg line {line}: value for `{var}` must be true or false рядок {line}: значення `{var}` має бути true або false
+@msg line {line}: value for `{var}` is longer than {MAX_GRAPH_CSV} bytes рядок {line}: значення `{var}` довше за {MAX_GRAPH_CSV} байтів
@msg missing `folder` відсутня `folder`
@msg missing `id` (see plugin.list) відсутня `id` (див. plugin.list)
@msg missing `name` відсутня `name`
diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv
index 9bb1c58a8..deb495561 100644
--- a/crates/ui-egui/src/i18n/vi.tsv
+++ b/crates/ui-egui/src/i18n/vi.tsv
@@ -4460,6 +4460,8 @@ theme Appearance Giao diện
@msg lang must be one of {_1} lang phải là một trong {_1}
@msg larger than 256 MB lớn hơn 256 MB
@msg layers can't be wrap objects lớp không thể là đối tượng bọc
+@msg line {line}: value for `{var}` must be true or false dòng {line}: giá trị của `{var}` phải là true hoặc false
+@msg line {line}: value for `{var}` is longer than {MAX_GRAPH_CSV} bytes dòng {line}: giá trị của `{var}` dài hơn {MAX_GRAPH_CSV} byte
@msg linked pictures show the low-resolution preview saved in the file until their files are found: relink them in the Links panel ảnh liên kết hiển thị bản xem trước độ phân giải thấp đã lưu trong tệp cho đến khi tìm thấy tệp gốc: liên kết lại trong bảng Liên kết
@msg Live Paint Merge: select a Live Paint group and the paths to add Hợp nhất tô trực tiếp: chọn nhóm tô trực tiếp và các đường dẫn để thêm
@msg Live Paint takes paths and compound paths: convert type, images and other objects to paths first Tô trực tiếp nhận đường dẫn và đường dẫn phức: hãy chuyển văn bản, hình ảnh và các đối tượng khác thành đường dẫn trước
diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv
index 027d9c29d..305c4c599 100644
--- a/crates/ui-egui/src/i18n/zh-hans.tsv
+++ b/crates/ui-egui/src/i18n/zh-hans.tsv
@@ -4010,6 +4010,8 @@ imageTrace Outline 轮廓
@msg node {_1} is not text 节点 {_1} 不是文字
@msg Text Wrap: select a wrap object 文本绕排:请选择一个绕排对象
@msg layers can't be wrap objects 图层不能作为绕排对象
+@msg line {line}: value for `{var}` must be true or false 第 {line} 行:`{var}` 的值必须是 true 或 false
+@msg line {line}: value for `{var}` is longer than {MAX_GRAPH_CSV} bytes 第 {line} 行:`{var}` 的值超过 {MAX_GRAPH_CSV} 字节
@msg no threaded text selected 未选择串接文本
@msg Create Outlines: select text objects 创建轮廓:请选择文本对象
@msg paste unavailable 无法粘贴
diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv
index ce25e4b0d..3ba21bee0 100644
--- a/crates/ui-egui/src/i18n/zh-hant.tsv
+++ b/crates/ui-egui/src/i18n/zh-hant.tsv
@@ -1931,6 +1931,8 @@ file-filter Templates 範本
@msg node {_1} is not text 節點 {_1} 不是文字
@msg Text Wrap: select a wrap object 文字繞圖:請選取繞圖物件
@msg layers can't be wrap objects 圖層不能作為繞圖物件
+@msg line {line}: value for `{var}` must be true or false 第 {line} 行:`{var}` 的值必須是 true 或 false
+@msg line {line}: value for `{var}` is longer than {MAX_GRAPH_CSV} bytes 第 {line} 行:`{var}` 的值超過 {MAX_GRAPH_CSV} 位元組
@msg no threaded text selected 未選取串連文字
@msg Create Outlines: select text objects 建立外框:請選取文字物件
@msg paste unavailable 無法貼上
diff --git a/docs/mcp.md b/docs/mcp.md
index 50f73e7b7..5a080ea97 100644
--- a/docs/mcp.md
+++ b/docs/mcp.md
@@ -1644,7 +1644,8 @@ already walks Image Trace. Short agent entry points:
`dataset.export {path?}` (CSV: `name`, then one column per variable). `dataset.import` also reads tab-separated
files, and files whose first header cell isn't `name`: every header cell is then a variable, and the rows take the
first free names `Data Set 1`, `Data Set 2` and so on. An import error about a row's values or name gives the file
- line the row starts on. A header cell that names no variable defines one, unbound, in the same undo step as the
+ line the row starts on, and an error about a value says why it was refused: a visibility value other than true,
+ false, 1, 0, yes or no, or a graph value longer than 262,144 bytes. A header cell that names no variable defines one, unbound, in the same undo step as the
rows. `#Shown` defines a visibility variable `Shown`, `@Photo` defines an image variable `Photo`, and a cell without
a prefix defines a text variable. A prefixed cell whose name is already a variable of the prefix's kind names it;
one whose name is a variable of another kind fails the import. A `%` cell that isn't a variable's exact name (graph