Spanish (es-ES): catch up with en.json (2026-11-04) (#10895)

* i18n: make engine errors translatable

Engine errors (`EngineError::BadParams` and the offset/path errors the kernel
returns) were shown in English regardless of the active locale.

- Add `tr_engine_error`, which maps the known messages to `sketch.error.*`
  keys and returns anything unknown unchanged.
- Normalise the `invalid parameters for `<command>`: ` prefix before matching,
  and interpolate the offset id into the translated message.
- Route `friendly_error` through `tr_engine_error`.
- Avoid redundant status writes in `run_points`/`run_entities`.
- Ship the es-ES pending strings for the sketch tool hints.

* Spanish (es-ES): catch up with en.json

Translate the 734 messages `es.json` was missing and fix `ui.project`
("Proyecto" → "Proyectar", the action behind the sketch project tool).

The catalogue now matches `en.json` key for key (5,591 entries), keeps every
placeholder intact and stays alphabetically sorted. That includes the 61
messages added upstream since the last catch-up (92a9a5e0).

Terminology: "Turntable" → «Plato giratorio», "hover" → «pasar el puntero»,
"card" → «tarjeta».

* i18n: attribute the sketch hints and keep the offset error neutral

The pending sketch hints file adds an asset, so it gets its own row under
attribution/pending rather than editing ATTRIBUTION.md.

The engine reuses the offset-ends error for trim, extend and break, so the
message no longer tells the user to trim: it asks them to edit the source
curves instead.

* i18n: translate shortcut-started tool hints and fix the break message

Shortcuts are handled in logic(), before ui() installs the language scope, so a
tool started by its key stored the English hint even with another language
selected. Install the scope for the whole frame.

The engine has nothing to break, so say so: "nothing to break here".

* i18n: scope a tool start so its hint uses the app language

A direct start can run outside the frame scope (and a shortcut runs in logic),
so the hint was built with the thread default. Open the scope where the tool
starts.

* Spanish (es-ES): translate the 30 new messages

The blur preferences, the dimension step settings and the fillet turn modes
arrived upstream after the last catch-up.

* i18n: scope command errors and use US spelling in the hints

The native menu runs Undo and Redo before the frame scope exists, so an error
from them was translated in the thread default language.

The pending hints mixed British spellings into the English source; the English
catalog is US-spelled, so the fallbacks say center and en-GB keeps centre.
This commit is contained in:
CaRLymx
2026-11-04 18:39:43 +00:00
committed by GitHub
parent 06def2231d
commit 35bc04847a
7 changed files with 1040 additions and 28 deletions
+765 -1
View File
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,204 @@
{
"ar": {
"sketch.error.closed_curve_two_crossings": "a closed curve needs two crossings to trim",
"sketch.error.nothing_to_break": "nothing to break here",
"sketch.error.offset_fillet_chamfer": "`{id}` is an offset, and its corners follow its source curves: round or cut the source corners before offsetting, or break the offset association first",
"sketch.error.offset_trim": "`{id}` is an offset, and its ends follow its source curves: edit the source curves instead, or break the offset association first",
"sketch.hint.arc.center_point": "Arc: click center and start, go round either way and click the end, or type a signed sweep",
"sketch.hint.arc.three_point": "Arc: click start, end, then a point on the arc",
"sketch.hint.arc3d": "3D Arc: click start, end, then a point on the arc (points may leave the sketch plane)",
"sketch.hint.break": "Break: click a curve where it should split",
"sketch.hint.circle.center": "Circle: click the center, then a point on the circle",
"sketch.hint.constraint.generic": "Constraint: pick the sketch entities",
"sketch.hint.constraint.horizontal_vertical": "Horizontal/Vertical: pick a line, two points, or a point and a line; hold Shift to pick a line midpoint",
"sketch.hint.constraint.midpoint": "MidPoint: pick a point and a line, or two lines to center the second on the first",
"sketch.hint.dimension": "Dimension: pick one or two entities and type the value (or click to place it first); click a dimension to edit it; Enter applies",
"sketch.hint.extend": "Extend: click a curve near the end to extend (Shift: click two curves to extend both to where they meet)",
"sketch.hint.fallback": "Click in the sketch",
"sketch.hint.line": "Line: click points; right-click or Esc to finish",
"sketch.hint.line3d": "3D Line: click world points; right-click or Esc to finish (points may leave the sketch plane)",
"sketch.hint.open_done": "Open done",
"sketch.hint.point3d": "3D Point: click where a 3D point goes",
"sketch.hint.rectangle.center": "Center rectangle: click the center, then a corner",
"sketch.hint.rectangle.rounded": "Rounded rectangle: click two opposite corners (Tab to the radius box to type the corner radius)",
"sketch.hint.rectangle.three_point": "3-point rectangle: click two points of one edge, then the width",
"sketch.hint.rectangle.two_point": "Rectangle: click two opposite corners",
"sketch.hint.slot": "Slot: click both ends, then the width",
"sketch.hint.spline3d": "3D Spline: click fit points in 3D; right-click or Esc to finish",
"sketch.hint.trim": "Trim: click the piece of a curve to remove, or drag across the pieces to remove"
},
"en": {
"sketch.error.closed_curve_two_crossings": "a closed curve needs two crossings to trim",
"sketch.error.nothing_to_break": "nothing to break here",
"sketch.error.offset_fillet_chamfer": "`{id}` is an offset, and its corners follow its source curves: round or cut the source corners before offsetting, or break the offset association first",
"sketch.error.offset_trim": "`{id}` is an offset, and its ends follow its source curves: edit the source curves instead, or break the offset association first",
"sketch.hint.arc.center_point": "Arc: click center and start, go round either way and click the end, or type a signed sweep",
"sketch.hint.arc.three_point": "Arc: click start, end, then a point on the arc",
"sketch.hint.arc3d": "3D Arc: click start, end, then a point on the arc (points may leave the sketch plane)",
"sketch.hint.break": "Break: click a curve where it should split",
"sketch.hint.circle.center": "Circle: click the center, then a point on the circle",
"sketch.hint.constraint.generic": "Constraint: pick the sketch entities",
"sketch.hint.constraint.horizontal_vertical": "Horizontal/Vertical: pick a line, two points, or a point and a line; hold Shift to pick a line midpoint",
"sketch.hint.constraint.midpoint": "MidPoint: pick a point and a line, or two lines to center the second on the first",
"sketch.hint.dimension": "Dimension: pick one or two entities and type the value (or click to place it first); click a dimension to edit it; Enter applies",
"sketch.hint.extend": "Extend: click a curve near the end to extend (Shift: click two curves to extend both to where they meet)",
"sketch.hint.fallback": "Click in the sketch",
"sketch.hint.line": "Line: click points; right-click or Esc to finish",
"sketch.hint.line3d": "3D Line: click world points; right-click or Esc to finish (points may leave the sketch plane)",
"sketch.hint.open_done": "Open done",
"sketch.hint.point3d": "3D Point: click where a 3D point goes",
"sketch.hint.rectangle.center": "Center rectangle: click the center, then a corner",
"sketch.hint.rectangle.rounded": "Rounded rectangle: click two opposite corners (Tab to the radius box to type the corner radius)",
"sketch.hint.rectangle.three_point": "3-point rectangle: click two points of one edge, then the width",
"sketch.hint.rectangle.two_point": "Rectangle: click two opposite corners",
"sketch.hint.slot": "Slot: click both ends, then the width",
"sketch.hint.spline3d": "3D Spline: click fit points in 3D; right-click or Esc to finish",
"sketch.hint.trim": "Trim: click the piece of a curve to remove, or drag across the pieces to remove"
},
"es": {
"sketch.error.closed_curve_two_crossings": "una curva cerrada necesita dos cruces para recortar",
"sketch.error.nothing_to_break": "no hay nada que romper ahí",
"sketch.error.offset_fillet_chamfer": "`{id}` es un desfase y sus esquinas siguen sus curvas de origen: redondea o corta las esquinas de origen antes de desfasar, o rompe antes la asociación de desfase",
"sketch.error.offset_trim": "`{id}` es un desfase y sus extremos siguen sus curvas de origen: edita las curvas de origen en su lugar, o rompe antes la asociación de desfase",
"sketch.hint.arc.center_point": "Arco: pulsa el centro y el inicio, rodea en cualquier sentido y pulsa el final, o escribe un barrido con signo",
"sketch.hint.arc.three_point": "Arco: pulsa el inicio, el fin y luego un punto del arco",
"sketch.hint.arc3d": "Arco 3D: pulsa el inicio, el fin y luego un punto del arco (los puntos pueden salir del plano del boceto)",
"sketch.hint.break": "Romper: pulsa una curva donde debe dividirse",
"sketch.hint.circle.center": "Círculo: pulsa el centro y luego un punto de la circunferencia",
"sketch.hint.constraint.generic": "Restricción: elige las entidades del boceto",
"sketch.hint.constraint.horizontal_vertical": "Horizontal/Vertical: elige una línea, dos puntos, o un punto y una línea; mantén Shift para elegir el punto medio de una línea",
"sketch.hint.constraint.midpoint": "Punto medio: elige un punto y una línea, o dos líneas para centrar la segunda en la primera",
"sketch.hint.dimension": "Cota: elige una o dos entidades y escribe el valor (o pulsa para colocarla primero); pulsa una cota para editarla; Intro aplica",
"sketch.hint.extend": "Extender: pulsa una curva cerca del final para extenderla (Shift: pulsa dos curvas para extender ambas hasta donde se encuentran)",
"sketch.hint.fallback": "Pulsa en el boceto",
"sketch.hint.line": "Línea: pulsa puntos; clic derecho o Esc para terminar",
"sketch.hint.line3d": "Línea 3D: pulsa puntos del mundo; clic derecho o Esc para terminar (los puntos pueden salir del plano del boceto)",
"sketch.hint.open_done": "Abierto",
"sketch.hint.point3d": "Punto 3D: pulsa dónde va un punto 3D",
"sketch.hint.rectangle.center": "Rectángulo centrado: pulsa el centro y luego una esquina",
"sketch.hint.rectangle.rounded": "Rectángulo redondeado: pulsa dos esquinas opuestas (Tab al cuadro de radio para escribir el radio de la esquina)",
"sketch.hint.rectangle.three_point": "Rectángulo de 3 puntos: pulsa dos puntos de un borde y luego el ancho",
"sketch.hint.rectangle.two_point": "Rectángulo: pulsa dos esquinas opuestas",
"sketch.hint.slot": "Ranura: pulsa ambos extremos y luego el ancho",
"sketch.hint.spline3d": "Spline 3D: pulsa puntos de ajuste en 3D; clic derecho o Esc para terminar",
"sketch.hint.trim": "Recortar: pulsa el trozo de curva que quieres quitar, o arrastra sobre los trozos que quieres quitar"
},
"he": {
"sketch.error.closed_curve_two_crossings": "a closed curve needs two crossings to trim",
"sketch.error.nothing_to_break": "nothing to break here",
"sketch.error.offset_fillet_chamfer": "`{id}` is an offset, and its corners follow its source curves: round or cut the source corners before offsetting, or break the offset association first",
"sketch.error.offset_trim": "`{id}` is an offset, and its ends follow its source curves: edit the source curves instead, or break the offset association first",
"sketch.hint.arc.center_point": "Arc: click center and start, go round either way and click the end, or type a signed sweep",
"sketch.hint.arc.three_point": "Arc: click start, end, then a point on the arc",
"sketch.hint.arc3d": "3D Arc: click start, end, then a point on the arc (points may leave the sketch plane)",
"sketch.hint.break": "Break: click a curve where it should split",
"sketch.hint.circle.center": "Circle: click the center, then a point on the circle",
"sketch.hint.constraint.generic": "Constraint: pick the sketch entities",
"sketch.hint.constraint.horizontal_vertical": "Horizontal/Vertical: pick a line, two points, or a point and a line; hold Shift to pick a line midpoint",
"sketch.hint.constraint.midpoint": "MidPoint: pick a point and a line, or two lines to center the second on the first",
"sketch.hint.dimension": "Dimension: pick one or two entities and type the value (or click to place it first); click a dimension to edit it; Enter applies",
"sketch.hint.extend": "Extend: click a curve near the end to extend (Shift: click two curves to extend both to where they meet)",
"sketch.hint.fallback": "Click in the sketch",
"sketch.hint.line": "Line: click points; right-click or Esc to finish",
"sketch.hint.line3d": "3D Line: click world points; right-click or Esc to finish (points may leave the sketch plane)",
"sketch.hint.open_done": "Open done",
"sketch.hint.point3d": "3D Point: click where a 3D point goes",
"sketch.hint.rectangle.center": "Center rectangle: click the center, then a corner",
"sketch.hint.rectangle.rounded": "Rounded rectangle: click two opposite corners (Tab to the radius box to type the corner radius)",
"sketch.hint.rectangle.three_point": "3-point rectangle: click two points of one edge, then the width",
"sketch.hint.rectangle.two_point": "Rectangle: click two opposite corners",
"sketch.hint.slot": "Slot: click both ends, then the width",
"sketch.hint.spline3d": "3D Spline: click fit points in 3D; right-click or Esc to finish",
"sketch.hint.trim": "Trim: click the piece of a curve to remove, or drag across the pieces to remove"
},
"ja": {
"sketch.error.closed_curve_two_crossings": "a closed curve needs two crossings to trim",
"sketch.error.nothing_to_break": "nothing to break here",
"sketch.error.offset_fillet_chamfer": "`{id}` is an offset, and its corners follow its source curves: round or cut the source corners before offsetting, or break the offset association first",
"sketch.error.offset_trim": "`{id}` is an offset, and its ends follow its source curves: edit the source curves instead, or break the offset association first",
"sketch.hint.arc.center_point": "Arc: click center and start, go round either way and click the end, or type a signed sweep",
"sketch.hint.arc.three_point": "Arc: click start, end, then a point on the arc",
"sketch.hint.arc3d": "3D Arc: click start, end, then a point on the arc (points may leave the sketch plane)",
"sketch.hint.break": "Break: click a curve where it should split",
"sketch.hint.circle.center": "Circle: click the center, then a point on the circle",
"sketch.hint.constraint.generic": "Constraint: pick the sketch entities",
"sketch.hint.constraint.horizontal_vertical": "Horizontal/Vertical: pick a line, two points, or a point and a line; hold Shift to pick a line midpoint",
"sketch.hint.constraint.midpoint": "MidPoint: pick a point and a line, or two lines to center the second on the first",
"sketch.hint.dimension": "Dimension: pick one or two entities and type the value (or click to place it first); click a dimension to edit it; Enter applies",
"sketch.hint.extend": "Extend: click a curve near the end to extend (Shift: click two curves to extend both to where they meet)",
"sketch.hint.fallback": "Click in the sketch",
"sketch.hint.line": "Line: click points; right-click or Esc to finish",
"sketch.hint.line3d": "3D Line: click world points; right-click or Esc to finish (points may leave the sketch plane)",
"sketch.hint.open_done": "Open done",
"sketch.hint.point3d": "3D Point: click where a 3D point goes",
"sketch.hint.rectangle.center": "Center rectangle: click the center, then a corner",
"sketch.hint.rectangle.rounded": "Rounded rectangle: click two opposite corners (Tab to the radius box to type the corner radius)",
"sketch.hint.rectangle.three_point": "3-point rectangle: click two points of one edge, then the width",
"sketch.hint.rectangle.two_point": "Rectangle: click two opposite corners",
"sketch.hint.slot": "Slot: click both ends, then the width",
"sketch.hint.spline3d": "3D Spline: click fit points in 3D; right-click or Esc to finish",
"sketch.hint.trim": "Trim: click the piece of a curve to remove, or drag across the pieces to remove"
},
"vi": {
"sketch.error.closed_curve_two_crossings": "a closed curve needs two crossings to trim",
"sketch.error.nothing_to_break": "nothing to break here",
"sketch.error.offset_fillet_chamfer": "`{id}` is an offset, and its corners follow its source curves: round or cut the source corners before offsetting, or break the offset association first",
"sketch.error.offset_trim": "`{id}` is an offset, and its ends follow its source curves: edit the source curves instead, or break the offset association first",
"sketch.hint.arc.center_point": "Arc: click center and start, go round either way and click the end, or type a signed sweep",
"sketch.hint.arc.three_point": "Arc: click start, end, then a point on the arc",
"sketch.hint.arc3d": "3D Arc: click start, end, then a point on the arc (points may leave the sketch plane)",
"sketch.hint.break": "Break: click a curve where it should split",
"sketch.hint.circle.center": "Circle: click the center, then a point on the circle",
"sketch.hint.constraint.generic": "Constraint: pick the sketch entities",
"sketch.hint.constraint.horizontal_vertical": "Horizontal/Vertical: pick a line, two points, or a point and a line; hold Shift to pick a line midpoint",
"sketch.hint.constraint.midpoint": "MidPoint: pick a point and a line, or two lines to center the second on the first",
"sketch.hint.dimension": "Dimension: pick one or two entities and type the value (or click to place it first); click a dimension to edit it; Enter applies",
"sketch.hint.extend": "Extend: click a curve near the end to extend (Shift: click two curves to extend both to where they meet)",
"sketch.hint.fallback": "Click in the sketch",
"sketch.hint.line": "Line: click points; right-click or Esc to finish",
"sketch.hint.line3d": "3D Line: click world points; right-click or Esc to finish (points may leave the sketch plane)",
"sketch.hint.open_done": "Open done",
"sketch.hint.point3d": "3D Point: click where a 3D point goes",
"sketch.hint.rectangle.center": "Center rectangle: click the center, then a corner",
"sketch.hint.rectangle.rounded": "Rounded rectangle: click two opposite corners (Tab to the radius box to type the corner radius)",
"sketch.hint.rectangle.three_point": "3-point rectangle: click two points of one edge, then the width",
"sketch.hint.rectangle.two_point": "Rectangle: click two opposite corners",
"sketch.hint.slot": "Slot: click both ends, then the width",
"sketch.hint.spline3d": "3D Spline: click fit points in 3D; right-click or Esc to finish",
"sketch.hint.trim": "Trim: click the piece of a curve to remove, or drag across the pieces to remove"
},
"zh": {
"sketch.error.closed_curve_two_crossings": "a closed curve needs two crossings to trim",
"sketch.error.nothing_to_break": "nothing to break here",
"sketch.error.offset_fillet_chamfer": "`{id}` is an offset, and its corners follow its source curves: round or cut the source corners before offsetting, or break the offset association first",
"sketch.error.offset_trim": "`{id}` is an offset, and its ends follow its source curves: edit the source curves instead, or break the offset association first",
"sketch.hint.arc.center_point": "Arc: click center and start, go round either way and click the end, or type a signed sweep",
"sketch.hint.arc.three_point": "Arc: click start, end, then a point on the arc",
"sketch.hint.arc3d": "3D Arc: click start, end, then a point on the arc (points may leave the sketch plane)",
"sketch.hint.break": "Break: click a curve where it should split",
"sketch.hint.circle.center": "Circle: click the center, then a point on the circle",
"sketch.hint.constraint.generic": "Constraint: pick the sketch entities",
"sketch.hint.constraint.horizontal_vertical": "Horizontal/Vertical: pick a line, two points, or a point and a line; hold Shift to pick a line midpoint",
"sketch.hint.constraint.midpoint": "MidPoint: pick a point and a line, or two lines to center the second on the first",
"sketch.hint.dimension": "Dimension: pick one or two entities and type the value (or click to place it first); click a dimension to edit it; Enter applies",
"sketch.hint.extend": "Extend: click a curve near the end to extend (Shift: click two curves to extend both to where they meet)",
"sketch.hint.fallback": "Click in the sketch",
"sketch.hint.line": "Line: click points; right-click or Esc to finish",
"sketch.hint.line3d": "3D Line: click world points; right-click or Esc to finish (points may leave the sketch plane)",
"sketch.hint.open_done": "Open done",
"sketch.hint.point3d": "3D Point: click where a 3D point goes",
"sketch.hint.rectangle.center": "Center rectangle: click the center, then a corner",
"sketch.hint.rectangle.rounded": "Rounded rectangle: click two opposite corners (Tab to the radius box to type the corner radius)",
"sketch.hint.rectangle.three_point": "3-point rectangle: click two points of one edge, then the width",
"sketch.hint.rectangle.two_point": "Rectangle: click two opposite corners",
"sketch.hint.slot": "Slot: click both ends, then the width",
"sketch.hint.spline3d": "3D Spline: click fit points in 3D; right-click or Esc to finish",
"sketch.hint.trim": "Trim: click the piece of a curve to remove, or drag across the pieces to remove"
},
"en-GB": {
"sketch.hint.arc.center_point": "Arc: click centre and start, go round either way and click the end, or type a signed sweep",
"sketch.hint.circle.center": "Circle: click the centre, then a point on the circle",
"sketch.hint.constraint.midpoint": "MidPoint: pick a point and a line, or two lines to centre the second on the first",
"sketch.hint.rectangle.center": "Centre rectangle: click the centre, then a corner"
}
}
+1
View File
@@ -0,0 +1 @@
| assets/locales/pending/sketch-tool-hints.json | carlymx | Original sketch tool hints and engine error translations | MIT OR Apache-2.0 |
+35
View File
@@ -427,6 +427,41 @@ pub fn tr_diagnostic(text: &str) -> String {
CURRENT.with(|current| current.get().diagnostic(text))
}
/// The id of an offset curve an engine error names at the start, `` `{id}` ``.
fn offset_error_id<'a>(text: &'a str, middle: &str, end: &str) -> Option<&'a str> {
let rest = text.strip_prefix('`')?;
let (id, rest) = rest.split_once('`')?;
(rest.contains(middle) && rest.ends_with(end)).then_some(id)
}
/// Translate known engine error messages using i18n keys.
/// If the error message is not recognized, returns it unchanged.
pub fn tr_engine_error(error: &str) -> String {
// `EngineError::BadParams` carries `invalid parameters for `<command>`: ` in front.
let text = error.strip_prefix("invalid parameters for `").and_then(|rest| rest.split_once("`: ")).map_or(error, |(_, text)| text);
if text == "nothing to break at there" {
return tr("sketch.error.nothing_to_break").to_string();
}
if let Some(id) = offset_error_id(
text,
" is an offset, and its ends follow its source curves: ",
" the source curves instead, or break the offset association first",
) {
return format("sketch.error.offset_trim", &[("id", id)]);
}
if let Some(id) = offset_error_id(
text,
" is an offset, and its corners follow its source curves: ",
" the source corners before offsetting, or break the offset association first",
) {
return format("sketch.error.offset_fillet_chamfer", &[("id", id)]);
}
if text == "a closed curve needs two crossings to trim" {
return tr("sketch.error.closed_curve_two_crossings").to_string();
}
error.to_string()
}
#[cfg(test)]
mod tests {
/// The system's locale tags pick a catalog: exact tag, then base language, then English (#10138).
+10
View File
@@ -1508,6 +1508,9 @@ impl SolveApp {
}
}
Err(e) => {
// The native menu runs Undo and Redo before `logic` installs the frame scope, so
// the error would be translated with the thread default.
let _language = i18n::scope(&self.preferences.language);
let msg = friendly_error(id, e);
self.session.echo(msg.clone());
self.set_status(msg, true);
@@ -1593,6 +1596,9 @@ impl SolveApp {
}
fn start_with_variant_memory(&mut self, id: &str, remember_variant: bool, opener: Option<egui::Rect>, section_edit: bool) {
// A tool can be started outside the frame's scope (a direct `start`, a shortcut in
// `logic`): build its hint in the user's language, not the thread default.
let _language = crate::i18n::scope(&self.preferences.language);
if solidcraft_engine::panels::commands::is_command(id) {
if let Err(why) = self.run(id, json!({})) {
self.set_status(why, true);
@@ -2887,6 +2893,9 @@ impl SolveApp {
/// Per-frame logic before layout.
pub fn logic(&mut self, ctx: &egui::Context) {
// Shortcuts run here, before `ui` installs the language scope: a tool started by its
// key must build its translated hint in the user's language, not in English.
let _language = crate::i18n::scope(&self.preferences.language);
panel_runtime::tick_app(self);
// Sleep/wake often skips frames without a device-lost signal; refresh egui GPU textures
// when the frame clock jumps so the chrome is not stuck blank (#8749).
@@ -3466,6 +3475,7 @@ pub fn command_label(id: &str) -> &str {
pub fn friendly_error(id: &str, e: &str) -> String {
let label = i18n::tr_label(command_label(id));
let msg = e.replace(&format!("invalid parameters for `{id}`: "), "").replace(&format!("{id}: "), "").replace(&format!("`{id}`"), label);
let msg = i18n::tr_engine_error(&msg);
let msg = i18n::tr_label(&msg);
if msg.starts_with(label) { msg.to_string() } else { format!("{label}: {msg}") }
}
+6 -5
View File
@@ -3,6 +3,7 @@
//! tools for free-form curves and slots, text placement, and constraint glyphs. Like `tools`,
//! these are UI state only: every action runs a command.
use crate::i18n::{tr, tr_engine_error};
use crate::icons::markers::glyph_icon;
use crate::icons::markers::glyph_letter;
use crate::ui_kit::BackingTooltipExt as _;
@@ -921,9 +922,9 @@ pub fn hint(id: &str) -> Option<String> {
"inspect.continuity" => "Continuity: click an edge for its numbers (the button again turns the colours off)",
"canvas.insert" => crate::i18n::tr("canvas.place_hint"),
"canvas.decal" => crate::i18n::tr("canvas.decal_place_hint"),
"sketch.trim" => "Trim: click the piece of a curve to remove, or drag across the pieces to remove",
"sketch.extend" => "Extend: click a curve near the end to extend (Shift: click two curves to extend both to where they meet)",
"sketch.break" => "Break: click a curve where it should split",
"sketch.trim" => tr("sketch.hint.trim"),
"sketch.extend" => tr("sketch.hint.extend"),
"sketch.break" => tr("sketch.hint.break"),
"sketch.line.midpoint" => "Midpoint line: click the middle, then an end",
"sketch.arc.tangent" => "Tangent arc: click the end of a line or arc, then the arc's end",
"sketch.ellipse" => "Ellipse: click the centre, the end of the major axis, then a point on it",
@@ -1350,7 +1351,7 @@ pub(crate) fn place_point(app: &mut SolveApp, tool: &mut Tool, p: (Vec2, Option<
}
if tool.cmd == "sketch.circle.two_tangent" && tool.picks.len() == 2 {
if let Err(error) = crate::sketch_dims::validate(app, tool) {
app.set_status(error, true);
app.set_status(tr_engine_error(&error), true);
return;
}
if run_entities(app, tool) {
@@ -1366,7 +1367,7 @@ pub(crate) fn place_point(app: &mut SolveApp, tool: &mut Tool, p: (Vec2, Option<
}
let Some(Mode::Points(n)) = mode(tool.cmd) else { return };
if let Err(error) = crate::sketch_dims::validate(app, tool) {
app.set_status(error, true);
app.set_status(tr_engine_error(&error), true);
return;
}
let p = crate::sketch_dims::placed(app, tool, &p);
+19 -22
View File
@@ -7,6 +7,7 @@ use solidcore_record::Vec2;
use solidcraft_engine::geom::prelude::*;
use crate::SolveApp;
use crate::i18n::tr;
use crate::tool_modifiers::{Audit, Scope, ToolModifiers};
use crate::viewport::{Hit, Proj, pick_for_tool as pick, sketch_point_at};
@@ -164,28 +165,24 @@ impl Tool {
pub fn hint(id: &str) -> String {
match id {
"sketch.line" => "Line: click points; right-click or Esc to finish".into(),
"sketch.rectangle.two_point" => "Rectangle: click two opposite corners".into(),
"sketch.rectangle.center" => "Center rectangle: click the centre, then a corner".into(),
"sketch.rectangle.rounded" => "Rounded rectangle: click two opposite corners (Tab to the radius box to type the corner radius)".into(),
"sketch.rectangle.three_point" => "3-point rectangle: click two points of one edge, then the width".into(),
"sketch.circle.center" => "Circle: click the centre, then a point on the circle".into(),
"sketch.arc.three_point" => "Arc: click start, end, then a point on the arc".into(),
"sketch.arc3d" => "3D Arc: click start, end, then a point on the arc (points may leave the sketch plane)".into(),
"sketch.line3d" => "3D Line: click world points; right-click or Esc to finish (points may leave the sketch plane)".into(),
"sketch.spline3d" => "3D Spline: click fit points in 3D; right-click or Esc to finish".into(),
"sketch.point3d" => "3D Point: click where a 3D point goes".into(),
"sketch.arc.center_point" => "Arc: click centre and start, go round either way and click the end, or type a signed sweep".into(),
"sketch.dimension" => {
"Dimension: pick one or two entities and type the value (or click to place it first); click a dimension to edit it; Enter applies".into()
}
"sketch.constraint.horizontal_vertical" => {
"Horizontal/Vertical: pick a line, two points, or a point and a line; hold Shift to pick a line midpoint".into()
}
"sketch.slot.center_to_center" | "sketch.slot.overall" => "Slot: click both ends, then the width".into(),
"sketch.constraint.midpoint" => "MidPoint: pick a point and a line, or two lines to centre the second on the first".into(),
_ if id.starts_with("sketch.constraint.") => "Constraint: pick the sketch entities".into(),
_ => crate::sketch_tools::hint(id).unwrap_or_else(|| "Click in the sketch".into()),
"sketch.line" => tr("sketch.hint.line").into(),
"sketch.rectangle.two_point" => tr("sketch.hint.rectangle.two_point").into(),
"sketch.rectangle.center" => tr("sketch.hint.rectangle.center").into(),
"sketch.rectangle.rounded" => tr("sketch.hint.rectangle.rounded").into(),
"sketch.rectangle.three_point" => tr("sketch.hint.rectangle.three_point").into(),
"sketch.circle.center" => tr("sketch.hint.circle.center").into(),
"sketch.arc.three_point" => tr("sketch.hint.arc.three_point").into(),
"sketch.arc3d" => tr("sketch.hint.arc3d").into(),
"sketch.line3d" => tr("sketch.hint.line3d").into(),
"sketch.spline3d" => tr("sketch.hint.spline3d").into(),
"sketch.point3d" => tr("sketch.hint.point3d").into(),
"sketch.arc.center_point" => tr("sketch.hint.arc.center_point").into(),
"sketch.dimension" => tr("sketch.hint.dimension").into(),
"sketch.constraint.horizontal_vertical" => tr("sketch.hint.constraint.horizontal_vertical").into(),
"sketch.slot.center_to_center" | "sketch.slot.overall" => tr("sketch.hint.slot").into(),
"sketch.constraint.midpoint" => tr("sketch.hint.constraint.midpoint").into(),
_ if id.starts_with("sketch.constraint.") => tr("sketch.hint.constraint.generic").into(),
_ => crate::sketch_tools::hint(id).unwrap_or_else(|| tr("sketch.hint.fallback").into()),
}
}