Skip to content

SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.

i18n: every UI label reaches the catalog, on the UI kit (#2483)

ralfkuh-lab198fbeb814a5
diff --git a/Cargo.lock b/Cargo.lock
index c6256bbcf4..df946b0713 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4373,6 +4373,7 @@ dependencies = [
"log",
"minisign-verify",
"pollster 0.4.0",
+ "proc-macro2",
"semver",
"serde",
"serde_json",
diff --git a/assets/locales/de.json b/assets/locales/de.json
index f50159cfa3..e479283bc1 100644
--- a/assets/locales/de.json
+++ b/assets/locales/de.json
@@ -14,11 +14,15 @@
"Active": "Aktiv",
"Active rule": "Aktive Regel",
"Add": "Hinzufügen",
+ "Add Column": "Spalte hinzufügen",
"Add Key": "Schlüssel hinzufügen",
"Add Mid Radius": "Mittleren Radius hinzufügen",
"Add Row": "Zeile hinzufügen",
+ "Add a tool": "Werkzeug hinzufügen",
"Add condition": "Bedingung hinzufügen",
"Add or edit rule": "Regel hinzufügen oder bearbeiten",
+ "Add to New Folder": "Zu neuem Ordner hinzufügen",
+ "Advanced": "Erweitert",
"Against": "Gegen",
"Alignment": "Ausrichtung",
"All Sketch Points": "Alle Skizzenpunkte",
@@ -31,6 +35,7 @@
"Appearance name": "Name des Erscheinungsbilds",
"Applied Radius": "Angewendeter Radius",
"Apply To": "Anwenden auf",
+ "Apply library appearance": "Erscheinungsbild aus der Bibliothek anwenden",
"Apply to selection": "Auf Auswahl anwenden",
"Apply your appearance first. Exports assigned appearances and materials created in this design.": "Wenden Sie zuerst Ihr Erscheinungsbild an. Exportiert zugewiesene Erscheinungsbilder und in diesem Design erstellte Materialien.",
"Arc length": "Bogenlänge",
@@ -41,13 +46,18 @@
"BLEND SURFACE": "ÜBERGANGSFLÄCHE",
"BOUNDARY SURFACE": "BERANDUNGSFLÄCHE",
"BROWSER": "BROWSER",
+ "Bend Edges": "Biegekanten",
"Bend Line Position": "Position der Biegelinie",
"Bend Position": "Biegeposition",
"Bend Radius": "Biegeradius",
"Bend Table": "Biegetabelle",
"Bends": "Biegungen",
"Bodies": "Körper",
+ "Bodies (optional)": "Körper (optional)",
"Body": "Körper",
+ "Body (last if none)": "Körper (letzter, wenn keiner)",
+ "Body to split": "Zu teilender Körper",
+ "Body, or faces to take out": "Körper oder zu entfernende Flächen",
"Boundary": "Begrenzung",
"Bounding box": "Hüllquader",
"CHECK": "PRÜFEN",
@@ -59,7 +69,9 @@
"CSV or JSON: updates existing parameters, adds new ones": "CSV or JSON: updates existing parameters, adds new ones",
"Capture All Positions": "Alle Positionen erfassen",
"Capture Pos.": "Pos. erfassen",
+ "Catch Depth": "Fangtiefe",
"Catch Direction": "Fangrichtung",
+ "Catch Length": "Fanglänge",
"Cells": "Zellen",
"Center X": "Mittelpunkt X",
"Center Y": "Mittelpunkt Y",
@@ -68,15 +80,21 @@
"Chamfer Type": "Abschrägungstyp",
"Check collisions": "Kollisionen prüfen",
"Checked": "Geprüft",
+ "Choose Variable radius or Spline in Type.": "Unter „Typ“ „Variable radius“ oder „Spline“ wählen.",
"Choose a new plane. Sketch geometry and dimensions stay unchanged in its two-dimensional coordinates.": "Wählen Sie eine neue Ebene. Skizzengeometrie und Bemaßungen bleiben in ihren zweidimensionalen Koordinaten unverändert.",
"Choose…": "Auswählen…",
"Circular": "Kreisförmig",
"Circumference": "Umfang",
"Close draft": "Entwurf schließen",
+ "Collapse": "Einklappen",
"Collisions": "Kollisionen",
"Colour": "Farbe",
+ "Command": "Befehl",
"Comment": "Kommentar",
+ "Component 1": "Komponente 1",
+ "Component 2": "Komponente 2",
"Component1": "Komponente1",
+ "Components": "Komponenten",
"Config Table": "Konfigurationstabelle",
"Configuration": "Konfiguration",
"Configuration rules": "Configuration rules",
@@ -84,6 +102,7 @@
"Contact Sets": "Kontaktsätze",
"Contact sets": "Kontaktsätze",
"Continuity": "Stetigkeit",
+ "Control Radius": "Kontrollradius",
"Copy Error Message": "Fehlermeldung kopieren",
"Copy Warning Message": "Warnmeldung kopieren",
"Copy all licences": "Alle Lizenzen kopieren",
@@ -93,8 +112,11 @@
"Corner Relief": "Eckenentlastung",
"Corner Relief Shape": "Form der Eckenentlastung",
"Counterbore depth": "Tiefe der Senkung",
+ "Counterbore Ø": "Tiefenbohrung Ø",
"Countersink angle": "Winkel der Kegelsenkung",
+ "Countersink Ø": "Senkung Ø",
"Create Issue — review draft": "Issue erstellen — Entwurf prüfen",
+ "Create Issue…": "Issue erstellen…",
"Cross curves": "Querkurven",
"Cube": "Würfel",
"Current orthographic view (1:1 mm)": "Aktuelle orthogonale Ansicht (1:1 mm)",
@@ -103,7 +125,11 @@
"Curvature (G2)": "Krümmung (G2)",
"Curvature change (G3)": "Krümmungsänderung (G3)",
"Customize Toolbar": "Symbolleiste anpassen",
+ "Customize…": "Anpassen…",
+ "Cylindrical face": "Zylindrische Fläche",
"Delete": "Löschen",
+ "Delete Selected Features…": "Ausgewählte Merkmale löschen…",
+ "Delete Selected Folders": "Ausgewählte Ordner löschen",
"Delete all": "Alle löschen",
"Delete rule": "Regel löschen",
"Delete the row": "Zeile löschen",
@@ -112,8 +138,11 @@
"Dependents": "Abhängige Elemente",
"Designs you open or save appear here.": "Designs, die Sie öffnen oder speichern, erscheinen hier.",
"Determined by To Object. Choose Angle to edit the angular extent.": "Bestimmt durch Bis Objekt. Wählen Sie Winkel, um den Winkelbereich zu bearbeiten.",
+ "Diameter": "Durchmesser",
"Direction": "Richtung",
"Discard": "Verwerfen",
+ "Distance": "Abstand",
+ "Distance 1": "Abstand 1",
"Do not export hidden edges": "Verdeckte Kanten nicht exportieren",
"Don't ask again": "Nicht mehr fragen",
"Double-click to rename": "Double-click to rename",
@@ -125,17 +154,21 @@
"Edit Profile Sketch": "Profile-Skizze bearbeiten",
"Enable rule": "Regel aktivieren",
"Enabled": "Aktiviert",
+ "End Radius": "Endradius",
"End bulge": "Endausbauchung",
"End continuity": "Endstetigkeit",
+ "Expand": "Ausklappen",
"Explode": "Explodieren",
"Explode Text": "Text auflösen",
"Export Animation…": "Animation exportieren…",
+ "Export Bend Table…": "Biegetabelle exportieren…",
"Export CSV…": "CSV exportieren…",
"Export Current View as DXF": "Aktuelle Ansicht als DXF exportieren",
"Export Current View as DXF…": "Aktuelle Ansicht als DXF exportieren…",
"Export DXF": "DXF exportieren",
"Export DXF…": "DXF exportieren…",
"Export JSON…": "JSON exportieren…",
+ "Export design library...": "Designbibliothek exportieren...",
"Export hidden edges as dashed lines": "Verdeckte Kanten gestrichelt exportieren",
"Expression": "Ausdruck",
"Extend to meet": "Verlängern, bis sie sich treffen",
@@ -143,31 +176,40 @@
"FILES": "DATEIEN",
"FLAT": "ABWICKLUNG",
"Face": "Fläche",
+ "Face Appearance": "Flächenerscheinungsbild",
"Face attachment lost": "Flächenanbindung verloren",
"Faces": "Flächen",
"Faces / edges / vertices": "Flächen / Kanten / Ecken",
+ "Faces to split": "Zu teilende Flächen",
"Fastener": "Verbindungselement",
"Favorites": "Favoriten",
"Favourite": "Favourite",
"Feature": "Funktion",
"Files from many CAD programs have Y up, so they open lying on their back here (Z up).": "Dateien aus vielen CAD-Programmen haben Y nach oben und öffnen sich hier daher auf dem Rücken liegend (Z nach oben).",
"Filter": "Filter",
+ "Filter…": "Filtern…",
"Find in Browser": "Im Browser suchen",
"Finish": "Oberfläche",
+ "First plane": "Erste Ebene",
+ "Fit and G2 corners require Constant radius.": "Passung und G2-Ecken erfordern Constant radius.",
+ "Fixed Face": "Feste Fläche",
"Flat Pattern": "Flachmuster",
"Flat size": "Abwicklungsgröße",
"Follow camera (Look At sketches)": "Kamera folgen (Skizzen ansehen)",
"Follow the camera (Look At sketches)": "Der Kamera folgen (Skizzen ansehen)",
"Font": "Schriftart",
+ "From": "Von",
"From Bodies": "Aus Körpern",
"From edges": "Ausgangskanten",
"Full Length": "Volle Länge",
+ "G2 corners require a constant radius and Exact fit. G2 corner construction is not supported yet.": "G2-Ecken erfordern einen konstanten Radius und Exact fit. Die Konstruktion von G2-Ecken wird noch nicht unterstützt.",
"Gap": "Spalt",
"Grid": "Raster",
"HISTORY": "VERLAUF",
"Height": "Höhe",
"Hidden edges": "Verdeckte Kanten",
"History layout": "Verlaufslayout",
+ "Hole (optional)": "Bohrung (optional)",
"Holes": "Löcher",
"Holes (edges on them)": "Löcher (ihre Kanten)",
"Home view": "Startansicht",
@@ -178,14 +220,20 @@
"In place (surfaces)": "An Ort und Stelle (Flächen)",
"In plane": "In der Ebene",
"Inside": "Innen",
+ "Instant": "Sofort",
+ "Interface font": "Schriftart der Oberfläche",
"Interferes": "Überschneidet sich",
+ "Invert": "Umkehren",
"Isocurve": "Isokurve",
"Issue title": "Issue-Titel",
+ "Items": "Elemente",
"JOINTS": "GELENKE",
"Joint Origin1": "Gelenkursprung1",
"Keep (points on it)": "Behalten (Punkte darauf)",
"Keep Tools": "Werkzeuge behalten",
"Keep of the other surface": "Vom anderen Flächenkörper behalten",
+ "Key a joint's value at this step": "Gelenkwert in diesem Schritt als Schlüsselbild setzen",
+ "Keys": "Schlüsselbilder",
"LIBRARY": "BIBLIOTHEK",
"LINKS": "VERKNÜPFUNGEN",
"Later": "Später",
@@ -196,9 +244,14 @@
"Letter Spacing": "Zeichenabstand",
"Library": "Bibliothek",
"Library file": "Bibliotheksdatei",
+ "Limits": "Grenzen",
"Line Spacing": "Zeilenabstand",
+ "Line Type": "Linientyp",
+ "Listing the installed fonts…": "Installierte Schriftarten werden aufgelistet…",
+ "Load library": "Bibliothek laden",
"Local library": "Lokale Bibliothek",
"Loop": "Schleife",
+ "M5 or M5x0.5": "M5 oder M5x0.5",
"MANAGE": "VERWALTEN",
"MATERIALS": "MATERIALIEN",
"MODEL": "MODELL",
@@ -209,14 +262,20 @@
"Matched restrictions check the final values.": "Zutreffende Einschränkungen prüfen die endgültigen Werte.",
"Material": "Material",
"Max": "Max",
+ "Maximum": "Maximum",
+ "Mesh body": "Netzkörper",
"Mid Radius": "Mittlerer Radius",
"Middle double-click": "Doppelklick mit mittlerer Taste",
"Min": "Min",
+ "Minimum": "Minimum",
+ "Mirror Plane": "Spiegelebene",
"Mitre": "Gehrung",
"Model Parameters": "Modellparameter",
"Modeled": "Modelliert",
"More toolbar panels": "Weitere Symbolleistenbereiche",
"Motion": "Bewegung",
+ "Mouse gestures": "Mausgesten",
+ "Mouse gestures only work with the SolidWorks mouse mode (the wheel orbits, Ctrl + wheel pans).": "Mausgesten funktionieren nur im SolidWorks-Mausmodus (das Rad dreht, Strg + Rad verschiebt).",
"Move / Copy": "Verschieben / Kopieren",
"Move Type": "Verschiebungstyp",
"Move down": "Nach unten",
@@ -238,8 +297,11 @@
"Not available yet": "Noch nicht verfügbar",
"Notch": "Ausklinkung",
"OUTPUT": "AUSGABE",
+ "Of": "Freiheitsgrad",
+ "On your computer": "Auf diesem Computer",
"Opacity": "Deckkraft",
"Open GitHub draft": "GitHub-Entwurf öffnen",
+ "Open library...": "Bibliothek öffnen...",
"Open local libraries in the desktop app. You can export this design's library here.": "Öffnen Sie lokale Bibliotheken in der Desktop-App. Die Bibliothek dieses Designs können Sie hier exportieren.",
"Open-source parametric 3D CAD in Rust. Licensed MIT OR Apache-2.0.": "Quelloffenes parametrisches 3D-CAD in Rust. Lizenziert unter MIT OR Apache-2.0.",
"Operator": "Operator",
@@ -258,8 +320,10 @@
"Pick the tool bodies": "Werkzeugkörper wählen",
"Picked": "Ausgewählte",
"Picked point": "Gewählter Punkt",
+ "Pivot": "Drehpunkt",
"Place at the origin instead": "Stattdessen im Ursprung platzieren",
"Plastic Rules": "Kunststoffregeln",
+ "Play the joint's motion in the view": "Die Bewegung des Gelenks in der Ansicht abspielen",
"Playback": "Wiedergabe",
"Plot": "Diagramm",
"Position": "Position",
@@ -267,14 +331,18 @@
"Position (G0)": "Position (G0)",
"Position along the edge, 0 at the start end, 1 at the other": "Position entlang der Kante, 0 am Anfang, 1 am anderen Ende",
"Preferences › Design turns the offer back on": "Unter Einstellungen › Design lässt sich das Angebot wieder einschalten",
+ "Preview": "Vorschau",
"Preview Row": "Vorschauzeile",
"Preview leaves the current design unchanged.": "Die Vorschau lässt das aktuelle Design unverändert.",
+ "Profile / Edges": "Profil / Kanten",
+ "Profiles or curves": "Profile oder Kurven",
"Profiles/Curves": "Profile/Kurven",
"Quantity": "Größe",
"RECENT": "ZULETZT",
"REFERENCE": "REFERENZ",
"RULED SURFACE": "REGELFLÄCHE",
"RULES": "REGELN",
+ "Radius": "Radius",
"Radius Fit": "Radiusanpassung",
"Ratio": "Verhältnis",
"Reattach selected face": "Ausgewählte Fläche neu anbinden",
@@ -283,6 +351,8 @@
"Rectangular": "Rechteckig",
"Reference face": "Referenzfläche",
"Remove Tools": "Werkzeuge entfernen",
+ "Remove condition": "Bedingung entfernen",
+ "Remove from Folder": "Aus Ordner entfernen",
"Remove from list": "Aus Liste entfernen",
"Remove override": "Überschreibung entfernen",
"Remove private design details or paths before sharing.": "Entfernen Sie vor dem Teilen private Designdetails oder Pfade.",
@@ -290,12 +360,16 @@
"Remove the column": "Spalte entfernen",
"Remove the track": "Spur entfernen",
"Remove this point": "Diesen Punkt entfernen",
+ "Rename Feature": "Merkmal umbenennen",
+ "Rename Folder": "Ordner umbenennen",
+ "Replace existing library file": "Vorhandene Bibliotheksdatei ersetzen",
"Report a bug — review a screenshot and open a GitHub draft": "Fehler melden — Screenshot prüfen und einen GitHub-Entwurf öffnen",
"Reset Toolbar": "Symbolleiste zurücksetzen",
"Resize Part": "Teil skalieren",
"Restore View": "Ansicht wiederherstellen",
"Restore outer boundary": "Äußere Begrenzung wiederherstellen",
"Restore the inherited component or physical material appearance": "Das geerbte Erscheinungsbild der Komponente oder des physikalischen Materials wiederherstellen",
+ "Restore this studio's tools": "Werkzeuge dieses Studios wiederherstellen",
"Result": "Ergebnis",
"Retake screenshot": "Screenshot erneut aufnehmen",
"Reverse": "Umkehren",
@@ -305,7 +379,13 @@
"Revert Pos.": "Pos. zurücksetzen",
"Revert Position": "Position zurücksetzen",
"Review the report and screenshot before opening GitHub.": "Prüfen Sie Bericht und Screenshot, bevor Sie GitHub öffnen.",
+ "Rib Length": "Rippenlänge",
+ "Rib Offset": "Rippenversatz",
+ "Rib Thickness": "Rippendicke",
+ "Ribs": "Rippen",
"Rim Edge": "Randkante",
+ "Ring of tools on the right button": "Werkzeugring auf der rechten Maustaste",
+ "Roll Back Here": "Hierher zurücksetzen",
"Roll History Marker Here": "Verlaufsmarkierung hierher verschieben",
"Round": "Rund",
"Rule": "Rule",
@@ -322,13 +402,18 @@
"Search": "Suchen",
"Search commands": "Befehle suchen",
"Search this library": "Diese Bibliothek durchsuchen",
+ "Second plane": "Zweite Ebene",
"Section": "Schnitt",
+ "Sections (one sketch each)": "Querschnitte (je eine Skizze)",
+ "Select Other": "Andere auswählen",
"Select Other: hold the left button still on the model (or right-click › Select Other…) to list everything under the cursor; click again on the same spot to select the next thing there. Double-click the middle button to go Home (Preferences › Navigation).": "Anderes auswählen: Halten Sie die linke Taste ruhig auf dem Modell gedrückt (oder Rechtsklick › Anderes auswählen…), um alles unter dem Cursor aufzulisten; klicken Sie erneut an dieselbe Stelle, um das nächste Element dort auszuwählen. Doppelklick mit der mittleren Taste wechselt zur Startansicht (Einstellungen › Navigation).",
"Select bodies (a face picks its body)": "Körper auswählen (eine Fläche wählt ihren Körper)",
"Select bodies or faces instead": "Stattdessen Körper oder Flächen auswählen",
+ "Select edges": "Kanten auswählen",
"Selection filter": "Auswahlfilter",
"Semantic faces share their appearance across instances.": "Semantische Flächen teilen ihr Erscheinungsbild über alle Instanzen hinweg.",
"Send your report on GitHub": "Bericht auf GitHub senden",
+ "Shaded": "Schattiert",
"Shape": "Form",
"Sheet Rules": "Blechregeln",
"Show Agent Cursor": "Agenten-Cursor anzeigen",
@@ -346,6 +431,7 @@
"SolidCraft closed before these designs were saved. Their last autosave can be opened.": "SolidCraft wurde beendet, bevor diese Designs gespeichert wurden. Ihr letzter Autosave kann geöffnet werden.",
"Specialise": "Spezialisieren",
"Speed": "Geschwindigkeit",
+ "Splitting tool": "Trennwerkzeug",
"Stand it up": "Aufrichten",
"Stand it up: a quarter turn about X, as one Move feature you can undo.": "Aufrichten: eine Vierteldrehung um X, als ein Verschieben-Merkmal, das sich rückgängig machen lässt.",
"Stand this part up?": "Dieses Teil aufrichten?",
@@ -355,14 +441,20 @@
"Steps": "Schritte",
"Stitch the kept pieces": "Behaltene Teile vernähen",
"Stitch to both bodies": "Mit beiden Körpern vernähen",
+ "Studio": "Studio",
"Study": "Untersuchung",
"Style": "Stil",
+ "Suppress": "Unterdrücken",
"Suppressed": "Unterdrückt",
"Surface": "Flächenkörper",
+ "Surface, or faces to turn over": "Fläche oder umzudrehende Flächen",
"Swap Ends": "Enden vertauschen",
"TRIM": "TRIMMEN",
"Tangent (G1)": "Tangente (G1)",
"Tangent Chain": "Tangentenkette",
+ "Tangent chain": "Tangentialkette",
+ "Target": "Ziel",
+ "Target Body": "Zielkörper",
"Tear": "Reißen",
"The dashed sketch is a saved plane guide. Select a new face to repair the attachment.": "Die gestrichelte Skizze ist eine gespeicherte Ebenenführung. Wählen Sie eine neue Fläche, um die Anbindung zu reparieren.",
"The saved author occurrence is missing. Select a valid author placement before rebinding.": "Das gespeicherte Autorvorkommen fehlt. Wählen Sie vor dem erneuten Anbinden eine gültige Autorplatzierung.",
@@ -375,24 +467,31 @@
"This child is shared. Deleting it removes it from every copy of its parent.": "Dieses untergeordnete Element ist geteilt. Löschen entfernt es aus jeder Kopie des übergeordneten Elements.",
"This child is shared. Position changes apply to every copy of its parent.": "Dieses untergeordnete Element ist geteilt. Positionsänderungen gelten für jede Kopie des übergeordneten Elements.",
"This face cannot provide a durable attachment. Choose another face or explicitly use a fixed plane.": "Diese Fläche kann keine dauerhafte Anbindung bieten. Wählen Sie eine andere Fläche oder verwenden Sie ausdrücklich eine feste Ebene.",
+ "To": "Bis",
"To Offset": "Bis Versatz",
"To edges": "Zielkanten",
"Tolerance": "Toleranz",
"Too close": "Zu nah",
+ "Tool Bodies": "Werkzeugkörper",
+ "Tools": "Werkzeuge",
+ "Tools, clockwise from the top": "Werkzeuge, im Uhrzeigersinn von oben",
"Trimming tool (plane, face or curves)": "Trimmwerkzeug (Ebene, Fläche oder Kurven)",
"Turn off section analysis before exporting the view.": "Deaktivieren Sie die Schnittanalyse, bevor Sie die Ansicht exportieren.",
"Type": "Typ",
"UNTRIM": "TRIMMEN AUFHEBEN",
"Unit": "Einheit",
+ "Unsuppress": "Unterdrückung aufheben",
"Updating the preview": "Vorschau wird aktualisiert",
"Use active author placement": "Aktive Autorplatzierung verwenden",
"Use fixed plane": "Feste Ebene verwenden",
"Use saved fixed plane": "Gespeicherte feste Ebene verwenden",
"Use selected face as fixed plane": "Ausgewählte Fläche als feste Ebene verwenden",
+ "Use the SolidWorks mouse mode": "SolidWorks-Mausmodus verwenden",
"User Parameters": "Benutzerparameter",
"VIEW": "ANSICHT",
"VIEWS": "ANSICHTEN",
"Value": "Value",
+ "Variable Radius": "Variabler Radius",
"Velocity": "Geschwindigkeit",
"Vertices": "Scheitelpunkte",
"View navigator": "Ansichtsnavigator",
@@ -403,10 +502,18 @@
"When": "When",
"Width": "Breite",
"Will fail": "Schlägt fehl",
+ "With gestures on, the right button no longer orbits the view: hold it and move to open the ring, then touch a tool's zone. A plain right-click still opens the menu.": "Mit eingeschalteten Mausgesten dreht die rechte Maustaste die Ansicht nicht mehr: Taste gedrückt halten und bewegen öffnet den Werkzeugring, dann die Zone eines Werkzeugs berühren. Ein einfacher Rechtsklick öffnet weiterhin das Menü.",
+ "X": "X",
+ "X Angle": "X-Winkel",
"X angle": "X-Winkel",
"X distance": "X-Abstand",
+ "Y": "Y",
+ "Y Angle": "Y-Winkel",
"Y angle": "Y-Winkel",
"Y distance": "Y-Abstand",
+ "Z": "Z",
+ "Z Angle": "Z-Winkel",
+ "Z Distance": "Z-Abstand",
"Z angle": "Z-Winkel",
"Z distance": "Z-Abstand",
"Zebra": "Zebra",
@@ -967,8 +1074,15 @@
"motion.to_end": "Zum Ende",
"motion.to_start": "Zum Anfang",
"motion.track_name": "Spur {number}",
+ "nav.alias.help": "Umschalt+Alt+Linksziehen dreht, Umschalt+Alt+Mitte verschiebt, Umschalt+Alt+Rechtsziehen zoomt; mittleres Ziehen verschiebt ebenfalls und rechtes Ziehen dreht",
+ "nav.blender.help": "Mittlere Maustaste dreht, Umschalt+Mitte verschiebt, Strg+Mitte zoomt; rechtes Ziehen lässt die Kamera unverändert",
"nav.free_orbit.help": "Maus und 3D-Maus drehen über beide Pole hinweg und behalten die Rollneigung bei. Das Einrasten mit Umschalt ist deaktiviert.",
"nav.free_orbit.label": "Freie Drehung",
+ "nav.fusion.help": "Mittlere Maustaste verschiebt, Umschalt+Mitte dreht, rechte Maustaste dreht",
+ "nav.inventor.help": "Mittlere Maustaste verschiebt, Umschalt+Mitte dreht, Strg+Mitte zoomt, rechte Maustaste dreht",
+ "nav.openscad.help": "Linksziehen auf leerem Hintergrund dreht, Umschalt+Linksziehen zieht ein Auswahlrechteck auf, Skizzengeometrie wird durch Ziehen bearbeitet; rechtes oder mittleres Ziehen verschiebt, Umschalt+rechtes oder Umschalt+mittleres Ziehen zoomt",
+ "nav.solidworks.help": "Mittlere Maustaste dreht, Strg+Mitte verschiebt, Umschalt+Mitte zoomt, rechte Maustaste dreht",
+ "nav.tinkercad.help": "Rechte Maustaste dreht, mittlere oder Umschalt+rechte Maustaste verschiebt",
"nav.touchpad.help": "Umschalt gedrückt halten und den Zeiger zum Verschieben bewegen; mit Alt/Option drehen. Keine Maustaste nötig. Vertikales Scrollen zoomt.",
"nav.touchpad.label": "Touchpad",
"nav.touchpad.orbit": "Drehen (Alt/Option halten und bewegen; ohne Maustaste)",
diff --git a/assets/locales/en.json b/assets/locales/en.json
index a2ae34bde1..e3184ea6f2 100644
--- a/assets/locales/en.json
+++ b/assets/locales/en.json
@@ -14,11 +14,15 @@
"Active": "Active",
"Active rule": "Active rule",
"Add": "Add",
+ "Add Column": "Add Column",
"Add Key": "Add Key",
"Add Mid Radius": "Add Mid Radius",
"Add Row": "Add Row",
+ "Add a tool": "Add a tool",
"Add condition": "Add condition",
"Add or edit rule": "Add or edit rule",
+ "Add to New Folder": "Add to New Folder",
+ "Advanced": "Advanced",
"Against": "Against",
"Alignment": "Alignment",
"All Sketch Points": "All Sketch Points",
@@ -32,6 +36,7 @@
"Appearance name": "Appearance name",
"Applied Radius": "Applied Radius",
"Apply To": "Apply To",
+ "Apply library appearance": "Apply library appearance",
"Apply to selection": "Apply to selection",
"Apply your appearance first. Exports assigned appearances and materials created in this design.": "Apply your appearance first. Exports assigned appearances and materials created in this design.",
"Arc length": "Arc length",
@@ -42,13 +47,18 @@
"BLEND SURFACE": "BLEND SURFACE",
"BOUNDARY SURFACE": "BOUNDARY SURFACE",
"BROWSER": "BROWSER",
+ "Bend Edges": "Bend Edges",
"Bend Line Position": "Bend Line Position",
"Bend Position": "Bend Position",
"Bend Radius": "Bend Radius",
"Bend Table": "Bend Table",
"Bends": "Bends",
"Bodies": "Bodies",
+ "Bodies (optional)": "Bodies (optional)",
"Body": "Body",
+ "Body (last if none)": "Body (last if none)",
+ "Body to split": "Body to split",
+ "Body, or faces to take out": "Body, or faces to take out",
"Boundary": "Boundary",
"Bounding box": "Bounding box",
"CHECK": "CHECK",
@@ -60,7 +70,9 @@
"CSV or JSON: updates existing parameters, adds new ones": "CSV or JSON: updates existing parameters, adds new ones",
"Capture All Positions": "Capture All Positions",
"Capture Pos.": "Capture Pos.",
+ "Catch Depth": "Catch Depth",
"Catch Direction": "Catch Direction",
+ "Catch Length": "Catch Length",
"Cells": "Cells",
"Center X": "Center X",
"Center Y": "Center Y",
@@ -69,15 +81,21 @@
"Chamfer Type": "Chamfer Type",
"Check collisions": "Check collisions",
"Checked": "Checked",
+ "Choose Variable radius or Spline in Type.": "Choose Variable radius or Spline in Type.",
"Choose a new plane. Sketch geometry and dimensions stay unchanged in its two-dimensional coordinates.": "Choose a new plane. Sketch geometry and dimensions stay unchanged in its two-dimensional coordinates.",
"Choose…": "Choose…",
"Circular": "Circular",
"Circumference": "Circumference",
"Close draft": "Close draft",
+ "Collapse": "Collapse",
"Collisions": "Collisions",
"Colour": "Colour",
+ "Command": "Command",
"Comment": "Comment",
+ "Component 1": "Component 1",
+ "Component 2": "Component 2",
"Component1": "Component1",
+ "Components": "Components",
"Config Table": "Config Table",
"Configuration": "Configuration",
"Configuration rules": "Configuration rules",
@@ -86,6 +104,7 @@
"Contact sets": "Contact sets",
"Continue on GitHub": "Continue on GitHub",
"Continuity": "Continuity",
+ "Control Radius": "Control Radius",
"Copy Error Message": "Copy Error Message",
"Copy Warning Message": "Copy Warning Message",
"Copy all licences": "Copy all licences",
@@ -95,8 +114,11 @@
"Corner Relief": "Corner Relief",
"Corner Relief Shape": "Corner Relief Shape",
"Counterbore depth": "Counterbore depth",
+ "Counterbore Ø": "Counterbore Ø",
"Countersink angle": "Countersink angle",
+ "Countersink Ø": "Countersink Ø",
"Create Issue — review draft": "Create Issue — review draft",
+ "Create Issue…": "Create Issue…",
"Cross curves": "Cross curves",
"Cube": "Cube",
"Current orthographic view (1:1 mm)": "Current orthographic view (1:1 mm)",
@@ -106,7 +128,11 @@
"Curvature change (G3)": "Curvature change (G3)",
"Custom": "Custom",
"Customize Toolbar": "Customize Toolbar",
+ "Customize…": "Customize…",
+ "Cylindrical face": "Cylindrical face",
"Delete": "Delete",
+ "Delete Selected Features…": "Delete Selected Features…",
+ "Delete Selected Folders": "Delete Selected Folders",
"Delete all": "Delete all",
"Delete rule": "Delete rule",
"Delete the row": "Delete the row",
@@ -117,8 +143,11 @@
"Describe what happened before continuing.": "Describe what happened before continuing.",
"Designs you open or save appear here.": "Designs you open or save appear here.",
"Determined by To Object. Choose Angle to edit the angular extent.": "Determined by To Object. Choose Angle to edit the angular extent.",
+ "Diameter": "Diameter",
"Direction": "Direction",
"Discard": "Discard",
+ "Distance": "Distance",
+ "Distance 1": "Distance 1",
"Do not export hidden edges": "Do not export hidden edges",
"Don't ask again": "Don't ask again",
"Double-click to rename": "Double-click to rename",
@@ -130,18 +159,22 @@
"Edit Profile Sketch": "Edit Profile Sketch",
"Enable rule": "Enable rule",
"Enabled": "Enabled",
+ "End Radius": "End Radius",
"End bulge": "End bulge",
"End continuity": "End continuity",
+ "Expand": "Expand",
"Expected result (optional)": "Expected result (optional)",
"Explode": "Explode",
"Explode Text": "Explode Text",
"Export Animation…": "Export Animation…",
+ "Export Bend Table…": "Export Bend Table…",
"Export CSV…": "Export CSV…",
"Export Current View as DXF": "Export Current View as DXF",
"Export Current View as DXF…": "Export Current View as DXF…",
"Export DXF": "Export DXF",
"Export DXF…": "Export DXF…",
"Export JSON…": "Export JSON…",
+ "Export design library...": "Export design library...",
"Export hidden edges as dashed lines": "Export hidden edges as dashed lines",
"Expression": "Expression",
"Extend to meet": "Extend to meet",
@@ -149,25 +182,33 @@
"FILES": "FILES",
"FLAT": "FLAT",
"Face": "Face",
+ "Face Appearance": "Face Appearance",
"Face attachment lost": "Face attachment lost",
"Faces": "Faces",
"Faces / edges / vertices": "Faces / edges / vertices",
+ "Faces to split": "Faces to split",
"Fastener": "Fastener",
"Favorites": "Favorites",
"Favourite": "Favourite",
"Feature": "Feature",
"Files from many CAD programs have Y up, so they open lying on their back here (Z up).": "Files from many CAD programs have Y up, so they open lying on their back here (Z up).",
"Filter": "Filter",
+ "Filter…": "Filter…",
"Find in Browser": "Find in Browser",
"Finish": "Finish",
+ "First plane": "First plane",
+ "Fit and G2 corners require Constant radius.": "Fit and G2 corners require Constant radius.",
+ "Fixed Face": "Fixed Face",
"Flat Pattern": "Flat Pattern",
"Flat size": "Flat size",
"Follow camera (Look At sketches)": "Follow camera (Look At sketches)",
"Follow the camera (Look At sketches)": "Follow the camera (Look At sketches)",
"Font": "Font",
+ "From": "From",
"From Bodies": "From Bodies",
"From edges": "From edges",
"Full Length": "Full Length",
+ "G2 corners require a constant radius and Exact fit. G2 corner construction is not supported yet.": "G2 corners require a constant radius and Exact fit. G2 corner construction is not supported yet.",
"Gap": "Gap",
"Grid": "Grid",
"HISTORY": "HISTORY",
@@ -175,6 +216,7 @@
"Hidden edges": "Hidden edges",
"History layout": "History layout",
"History names": "History names",
+ "Hole (optional)": "Hole (optional)",
"Holes": "Holes",
"Holes (edges on them)": "Holes (edges on them)",
"Home view": "Home view",
@@ -185,14 +227,20 @@
"In place (surfaces)": "In place (surfaces)",
"In plane": "In plane",
"Inside": "Inside",
+ "Instant": "Instant",
+ "Interface font": "Interface font",
"Interferes": "Interferes",
+ "Invert": "Invert",
"Isocurve": "Isocurve",
"Issue title": "Issue title",
+ "Items": "Items",
"JOINTS": "JOINTS",
"Joint Origin1": "Joint Origin1",
"Keep (points on it)": "Keep (points on it)",
"Keep Tools": "Keep Tools",
"Keep of the other surface": "Keep of the other surface",
+ "Key a joint's value at this step": "Key a joint's value at this step",
+ "Keys": "Keys",
"LIBRARY": "LIBRARY",
"LINKS": "LINKS",
"Later": "Later",
@@ -203,9 +251,14 @@
"Letter Spacing": "Letter Spacing",
"Library": "Library",
"Library file": "Library file",
+ "Limits": "Limits",
"Line Spacing": "Line Spacing",
+ "Line Type": "Line Type",
+ "Listing the installed fonts…": "Listing the installed fonts…",
+ "Load library": "Load library",
"Local library": "Local library",
"Loop": "Loop",
+ "M5 or M5x0.5": "M5 or M5x0.5",
"MANAGE": "MANAGE",
"MATERIALS": "MATERIALS",
"MODEL": "MODEL",
@@ -216,14 +269,20 @@
"Matched restrictions check the final values.": "Matched restrictions check the final values.",
"Material": "Material",
"Max": "Max",
+ "Maximum": "Maximum",
+ "Mesh body": "Mesh body",
"Mid Radius": "Mid Radius",
"Middle double-click": "Middle double-click",
"Min": "Min",
+ "Minimum": "Minimum",
+ "Mirror Plane": "Mirror Plane",
"Mitre": "Mitre",
"Model Parameters": "Model Parameters",
"Modeled": "Modeled",
"More toolbar panels": "More toolbar panels",
"Motion": "Motion",
+ "Mouse gestures": "Mouse gestures",
+ "Mouse gestures only work with the SolidWorks mouse mode (the wheel orbits, Ctrl + wheel pans).": "Mouse gestures only work with the SolidWorks mouse mode (the wheel orbits, Ctrl + wheel pans).",
"Move / Copy": "Move / Copy",
"Move Type": "Move Type",
"Move down": "Move down",
@@ -246,8 +305,11 @@
"Not available yet": "Not available yet",
"Notch": "Notch",
"OUTPUT": "OUTPUT",
+ "Of": "Of",
+ "On your computer": "On your computer",
"Opacity": "Opacity",
"Open GitHub draft": "Open GitHub draft",
+ "Open library...": "Open library...",
"Open local libraries in the desktop app. You can export this design's library here.": "Open local libraries in the desktop app. You can export this design's library here.",
"Open-source parametric 3D CAD in Rust. Licensed MIT OR Apache-2.0.": "Open-source parametric 3D CAD in Rust. Licensed MIT OR Apache-2.0.",
"Opens your browser and copies the report text for you to paste into GitHub.": "Opens your browser and copies the report text for you to paste into GitHub.",
@@ -269,8 +331,10 @@
"Picked": "Picked",
"Picked point": "Picked point",
"Pitch": "Pitch",
+ "Pivot": "Pivot",
"Place at the origin instead": "Place at the origin instead",
"Plastic Rules": "Plastic Rules",
+ "Play the joint's motion in the view": "Play the joint's motion in the view",
"Playback": "Playback",
"Plot": "Plot",
"Position": "Position",
@@ -278,14 +342,18 @@
"Position (G0)": "Position (G0)",
"Position along the edge, 0 at the start end, 1 at the other": "Position along the edge, 0 at the start end, 1 at the other",
"Preferences › Design turns the offer back on": "Preferences › Design turns the offer back on",
+ "Preview": "Preview",
"Preview Row": "Preview Row",
"Preview leaves the current design unchanged.": "Preview leaves the current design unchanged.",
+ "Profile / Edges": "Profile / Edges",
+ "Profiles or curves": "Profiles or curves",
"Profiles/Curves": "Profiles/Curves",
"Quantity": "Quantity",
"RECENT": "RECENT",
"REFERENCE": "REFERENCE",
"RULED SURFACE": "RULED SURFACE",
"RULES": "RULES",
+ "Radius": "Radius",
"Radius Fit": "Radius Fit",
"Ratio": "Ratio",
"Reattach selected face": "Reattach selected face",
@@ -294,6 +362,8 @@
"Rectangular": "Rectangular",
"Reference face": "Reference face",
"Remove Tools": "Remove Tools",
+ "Remove condition": "Remove condition",
+ "Remove from Folder": "Remove from Folder",
"Remove from list": "Remove from list",
"Remove override": "Remove override",
"Remove private design details or paths before sharing.": "Remove private design details or paths before sharing.",
@@ -301,6 +371,9 @@
"Remove the column": "Remove the column",
"Remove the track": "Remove the track",
"Remove this point": "Remove this point",
+ "Rename Feature": "Rename Feature",
+ "Rename Folder": "Rename Folder",
+ "Replace existing library file": "Replace existing library file",
"Report a bug — review a screenshot and open a GitHub draft": "Report a bug — review a screenshot and open a GitHub draft",
"Report text copied. Paste it into GitHub and submit your report there.": "Report text copied. Paste it into GitHub and submit your report there.",
"Reports are public. A GitHub account is required.": "Reports are public. A GitHub account is required.",
@@ -309,6 +382,7 @@
"Restore View": "Restore View",
"Restore outer boundary": "Restore outer boundary",
"Restore the inherited component or physical material appearance": "Restore the inherited component or physical material appearance",
+ "Restore this studio's tools": "Restore this studio's tools",
"Result": "Result",
"Retake screenshot": "Retake screenshot",
"Reverse": "Reverse",
@@ -319,7 +393,13 @@
"Revert Position": "Revert Position",
"Review the report and screenshot before opening GitHub.": "Review the report and screenshot before opening GitHub.",
"Review your report on GitHub and click Submit new issue to publish it.": "Review your report on GitHub and click Submit new issue to publish it.",
+ "Rib Length": "Rib Length",
+ "Rib Offset": "Rib Offset",
+ "Rib Thickness": "Rib Thickness",
+ "Ribs": "Ribs",
"Rim Edge": "Rim Edge",
+ "Ring of tools on the right button": "Ring of tools on the right button",
+ "Roll Back Here": "Roll Back Here",
"Roll History Marker Here": "Roll History Marker Here",
"Round": "Round",
"Rule": "Rule",
@@ -338,13 +418,18 @@
"Search": "Search",
"Search commands": "Search commands",
"Search this library": "Search this library",
+ "Second plane": "Second plane",
"Section": "Section",
+ "Sections (one sketch each)": "Sections (one sketch each)",
+ "Select Other": "Select Other",
"Select Other: hold the left button still on the model (or right-click › Select Other…) to list everything under the cursor; click again on the same spot to select the next thing there. Double-click the middle button to go Home (Preferences › Navigation).": "Select Other: hold the left button still on the model (or right-click › Select Other…) to list everything under the cursor; click again on the same spot to select the next thing there. Double-click the middle button to go Home (Preferences › Navigation).",
"Select bodies (a face picks its body)": "Select bodies (a face picks its body)",
"Select bodies or faces instead": "Select bodies or faces instead",
+ "Select edges": "Select edges",
"Selection filter": "Selection filter",
"Semantic faces share their appearance across instances.": "Semantic faces share their appearance across instances.",
"Send your report on GitHub": "Send your report on GitHub",
+ "Shaded": "Shaded",
"Shape": "Shape",
"Sheet Rules": "Sheet Rules",
"Show Agent Cursor": "Show Agent Cursor",
@@ -362,6 +447,7 @@
"SolidCraft closed before these designs were saved. Their last autosave can be opened.": "SolidCraft closed before these designs were saved. Their last autosave can be opened.",
"Specialise": "Specialise",
"Speed": "Speed",
+ "Splitting tool": "Splitting tool",
"Stand it up": "Stand it up",
"Stand it up: a quarter turn about X, as one Move feature you can undo.": "Stand it up: a quarter turn about X, as one Move feature you can undo.",
"Stand this part up?": "Stand this part up?",
@@ -372,16 +458,22 @@
"Steps to reproduce (optional)": "Steps to reproduce (optional)",
"Stitch the kept pieces": "Stitch the kept pieces",
"Stitch to both bodies": "Stitch to both bodies",
+ "Studio": "Studio",
"Study": "Study",
"Style": "Style",
"Summary": "Summary",
+ "Suppress": "Suppress",
"Suppressed": "Suppressed",
"Surface": "Surface",
+ "Surface, or faces to turn over": "Surface, or faces to turn over",
"Swap Ends": "Swap Ends",
"TRIM": "TRIM",
"Tangent (G1)": "Tangent (G1)",
"Tangent Chain": "Tangent Chain",
+ "Tangent chain": "Tangent chain",
"Tap drill diameter": "Tap drill diameter",
+ "Target": "Target",
+ "Target Body": "Target Body",
"Tear": "Tear",
"Technical details": "Technical details",
"The dashed sketch is a saved plane guide. Select a new face to repair the attachment.": "The dashed sketch is a saved plane guide. Select a new face to repair the attachment.",
@@ -396,24 +488,31 @@
"This child is shared. Position changes apply to every copy of its parent.": "This child is shared. Position changes apply to every copy of its parent.",
"This face cannot provide a durable attachment. Choose another face or explicitly use a fixed plane.": "This face cannot provide a durable attachment. Choose another face or explicitly use a fixed plane.",
"This image is not attached to GitHub yet. Copy or save it, then attach it on GitHub.": "This image is not attached to GitHub yet. Copy or save it, then attach it on GitHub.",
+ "To": "To",
"To Offset": "To Offset",
"To edges": "To edges",
"Tolerance": "Tolerance",
"Too close": "Too close",
+ "Tool Bodies": "Tool Bodies",
+ "Tools": "Tools",
+ "Tools, clockwise from the top": "Tools, clockwise from the top",
"Trimming tool (plane, face or curves)": "Trimming tool (plane, face or curves)",
"Turn off section analysis before exporting the view.": "Turn off section analysis before exporting the view.",
"Type": "Type",
"UNTRIM": "UNTRIM",
"Unit": "Unit",
+ "Unsuppress": "Unsuppress",
"Updating the preview": "Updating the preview",
"Use active author placement": "Use active author placement",
"Use fixed plane": "Use fixed plane",
"Use saved fixed plane": "Use saved fixed plane",
"Use selected face as fixed plane": "Use selected face as fixed plane",
+ "Use the SolidWorks mouse mode": "Use the SolidWorks mouse mode",
"User Parameters": "User Parameters",
"VIEW": "VIEW",
"VIEWS": "VIEWS",
"Value": "Value",
+ "Variable Radius": "Variable Radius",
"Velocity": "Velocity",
"Vertices": "Vertices",
"View navigator": "View navigator",
@@ -427,10 +526,18 @@
"When": "When",
"Width": "Width",
"Will fail": "Will fail",
+ "With gestures on, the right button no longer orbits the view: hold it and move to open the ring, then touch a tool's zone. A plain right-click still opens the menu.": "With gestures on, the right button no longer orbits the view: hold it and move to open the ring, then touch a tool's zone. A plain right-click still opens the menu.",
+ "X": "X",
+ "X Angle": "X Angle",
"X angle": "X angle",
"X distance": "X distance",
+ "Y": "Y",
+ "Y Angle": "Y Angle",
"Y angle": "Y angle",
"Y distance": "Y distance",
+ "Z": "Z",
+ "Z Angle": "Z Angle",
+ "Z Distance": "Z Distance",
"Z angle": "Z angle",
"Z distance": "Z distance",
"Zebra": "Zebra",
@@ -1020,8 +1127,15 @@
"motion.to_end": "To the end",
"motion.to_start": "To the start",
"motion.track_name": "Track {number}",
+ "nav.alias.help": "Shift+Alt+left drag orbits, Shift+Alt+middle pans, Shift+Alt+right zooms; middle drag also pans and right drag orbits",
+ "nav.blender.help": "Middle drag orbits, Shift+middle pans, Ctrl+middle zooms; right drag leaves the camera alone",
"nav.free_orbit.help": "Mouse and 3D mouse rotate through both poles and preserve roll. Shift axis snapping is disabled.",
"nav.free_orbit.label": "Free orbit",
+ "nav.fusion.help": "Middle drag pans, Shift+middle orbits, right drag orbits",
+ "nav.inventor.help": "Middle drag pans, Shift+middle orbits, Ctrl+middle zooms, right drag orbits",
+ "nav.openscad.help": "Left drag on empty space orbits, Shift+left drag box-selects, sketch geometry drags edit; right or middle drag pans, Shift+right or Shift+middle drag zooms",
+ "nav.solidworks.help": "Middle drag orbits, Ctrl+middle pans, Shift+middle zooms, right drag orbits",
+ "nav.tinkercad.help": "Right drag orbits, middle or Shift+right drag pans",
"nav.touchpad.help": "Hold Shift and move the pointer to pan; hold Alt/Option and move it to orbit. No mouse button is needed. Vertical scroll zooms.",
"nav.touchpad.label": "Touchpad",
"nav.touchpad.orbit": "Orbit (hold Alt/Option and move; no mouse button)",
diff --git a/assets/locales/ja.json b/assets/locales/ja.json
index b7978f8597..8626df3330 100644
--- a/assets/locales/ja.json
+++ b/assets/locales/ja.json
@@ -14,11 +14,15 @@
"Active": "アクティブ",
"Active rule": "有効なルール",
"Add": "追加",
+ "Add Column": "列を追加",
"Add Key": "キーを追加",
"Add Mid Radius": "中間半径を追加",
"Add Row": "行を追加",
+ "Add a tool": "ツールを追加",
"Add condition": "条件を追加",
"Add or edit rule": "ルールを追加または編集",
+ "Add to New Folder": "新しいフォルダーに追加",
+ "Advanced": "詳細",
"Against": "相手",
"Alignment": "配置",
"All Sketch Points": "すべてのスケッチ点",
@@ -32,6 +36,7 @@
"Appearance name": "外観名",
"Applied Radius": "適用半径",
"Apply To": "適用先",
+ "Apply library appearance": "ライブラリの外観を適用",
"Apply to selection": "選択項目に適用",
"Apply your appearance first. Exports assigned appearances and materials created in this design.": "先に外観を適用してください。割り当てた外観と、このデザインで作成したマテリアルを書き出します。",
"Arc length": "円弧の長さ",
@@ -42,13 +47,18 @@
"BLEND SURFACE": "ブレンドサーフェス",
"BOUNDARY SURFACE": "境界サーフェス",
"BROWSER": "ブラウザ",
+ "Bend Edges": "曲げエッジ",
"Bend Line Position": "曲げ線位置",
"Bend Position": "曲げ位置",
"Bend Radius": "曲げ半径",
"Bend Table": "曲げテーブル",
"Bends": "曲げ",
"Bodies": "ボディ",
+ "Bodies (optional)": "ボディ (オプション)",
"Body": "ボディ",
+ "Body (last if none)": "ボディ (未指定時は最後)",
+ "Body to split": "分割するボディ",
+ "Body, or faces to take out": "ボディ、または取り除く面",
"Boundary": "境界",
"Bounding box": "境界ボックス",
"CHECK": "チェック",
@@ -60,7 +70,9 @@
"CSV or JSON: updates existing parameters, adds new ones": "CSVまたはJSON:既存のパラメータを更新し、新しいパラメータを追加します",
"Capture All Positions": "すべての位置をキャプチャ",
"Capture Pos.": "位置を記録",
+ "Catch Depth": "キャッチ深さ",
"Catch Direction": "キャッチ方向",
+ "Catch Length": "キャッチ長さ",
"Cells": "セル",
"Center X": "中心 X",
"Center Y": "中心 Y",
@@ -69,15 +81,21 @@
"Chamfer Type": "面取りタイプ",
"Check collisions": "衝突チェック",
"Checked": "チェック済み",
+ "Choose Variable radius or Spline in Type.": "タイプで Variable radius またはスプラインを選択してください。",
"Choose a new plane. Sketch geometry and dimensions stay unchanged in its two-dimensional coordinates.": "新しい平面を選択してください。スケッチジオメトリと寸法は2次元座標系のまま維持されます。",
"Choose…": "選択…",
"Circular": "円形",
"Circumference": "円周",
"Close draft": "下書きを閉じる",
+ "Collapse": "折りたたむ",
"Collisions": "衝突",
"Colour": "色",
+ "Command": "コマンド",
"Comment": "コメント",
+ "Component 1": "コンポーネント 1",
+ "Component 2": "コンポーネント 2",
"Component1": "コンポーネント1",
+ "Components": "コンポーネント",
"Config Table": "構成テーブル",
"Configuration": "構成",
"Configuration rules": "構成ルール",
@@ -86,6 +104,7 @@
"Contact sets": "接触セット",
"Continue on GitHub": "GitHubで続ける",
"Continuity": "連続性",
+ "Control Radius": "制御半径",
"Copy Error Message": "エラーメッセージをコピー",
"Copy Warning Message": "警告メッセージをコピー",
"Copy all licences": "すべてのライセンスをコピー",
@@ -95,8 +114,11 @@
"Corner Relief": "コーナーリリーフ",
"Corner Relief Shape": "コーナーリリーフ形状",
"Counterbore depth": "座ぐり深さ",
+ "Counterbore Ø": "座ぐり Ø",
"Countersink angle": "皿穴角度",
+ "Countersink Ø": "皿穴 Ø",
"Create Issue — review draft": "Issueを作成 — 下書きの確認",
+ "Create Issue…": "Issueを作成…",
"Cross curves": "交差する曲線",
"Cube": "キューブ",
"Current orthographic view (1:1 mm)": "現在の平行投影(実寸・mm)",
@@ -106,7 +128,11 @@
"Curvature change (G3)": "曲率変化 (G3)",
"Custom": "カスタム",
"Customize Toolbar": "ツールバーのカスタマイズ",
+ "Customize…": "カスタマイズ…",
+ "Cylindrical face": "円筒面",
"Delete": "削除",
+ "Delete Selected Features…": "選択したフィーチャーを削除…",
+ "Delete Selected Folders": "選択したフォルダーを削除",
"Delete all": "すべて削除",
"Delete rule": "ルールを削除",
"Delete the row": "行を削除",
@@ -117,8 +143,11 @@
"Describe what happened before continuing.": "続ける前に、何が起きたか記入してください。",
"Designs you open or save appear here.": "開いたデザインや保存したデザインがここに表示されます。",
"Determined by To Object. Choose Angle to edit the angular extent.": "「対象オブジェクトまで」により決定されます。角度範囲を編集するには「角度」を選択してください。",
+ "Diameter": "直径",
"Direction": "方向",
"Discard": "破棄",
+ "Distance": "距離",
+ "Distance 1": "距離 1",
"Do not export hidden edges": "出力しない",
"Don't ask again": "今後確認しない",
"Double-click to rename": "ダブルクリックで名前変更",
@@ -130,18 +159,22 @@
"Edit Profile Sketch": "プロファイルスケッチを編集",
"Enable rule": "ルールを有効化",
"Enabled": "有効",
+ "End Radius": "終了半径",
"End bulge": "終了側の膨らみ",
"End continuity": "終了側の連続性",
+ "Expand": "展開",
"Expected result (optional)": "期待した結果(任意)",
"Explode": "分解",
"Explode Text": "テキストを分解",
"Export Animation…": "アニメーションをエクスポート…",
+ "Export Bend Table…": "曲げテーブルを書き出す…",
"Export CSV…": "CSVを書き出し…",
"Export Current View as DXF": "現在の表示をDXFでエクスポート",
"Export Current View as DXF…": "現在の表示をDXFでエクスポート…",
"Export DXF": "DXF出力",
"Export DXF…": "DXFをエクスポート…",
"Export JSON…": "JSONを書き出し…",
+ "Export design library...": "デザインライブラリを書き出す...",
"Export hidden edges as dashed lines": "点線で出力",
"Expression": "式",
"Extend to meet": "交わるまで延長",
@@ -149,25 +182,33 @@
"FILES": "ファイル",
"FLAT": "展開",
"Face": "面",
+ "Face Appearance": "面の外観",
"Face attachment lost": "面アタッチメントが失われました",
"Faces": "面",
"Faces / edges / vertices": "面 / エッジ / 頂点",
+ "Faces to split": "分割する面",
"Fastener": "締結部品",
"Favorites": "お気に入り",
"Favourite": "お気に入り",
"Feature": "フィーチャー",
"Files from many CAD programs have Y up, so they open lying on their back here (Z up).": "多くのCADではY軸を上向きとしているため、Z軸を上向きとするSolidCraftでは、読み込んだモデルが横倒しの向きで表示されることがあります。",
"Filter": "フィルター",
+ "Filter…": "フィルター…",
"Find in Browser": "ブラウザで検索",
"Finish": "終了",
+ "First plane": "第1平面",
+ "Fit and G2 corners require Constant radius.": "フィットと G2 コーナーには Constant radius が必要です。",
+ "Fixed Face": "固定面",
"Flat Pattern": "フラットパターン",
"Flat size": "展開サイズ",
"Follow camera (Look At sketches)": "カメラ追従(スケッチを正面視)",
"Follow the camera (Look At sketches)": "カメラ追従(スケッチを正面視)",
"Font": "フォント",
+ "From": "開始",
"From Bodies": "ボディから",
"From edges": "開始側エッジ",
"Full Length": "全長",
+ "G2 corners require a constant radius and Exact fit. G2 corner construction is not supported yet.": "G2 コーナーには一定半径と Exact fit が必要です。G2 コーナーの構築はまだサポートされていません。",
"Gap": "間隔",
"Grid": "グリッド",
"HISTORY": "履歴",
@@ -175,6 +216,7 @@
"Hidden edges": "隠線",
"History layout": "履歴のレイアウト",
"History names": "履歴名",
+ "Hole (optional)": "穴 (オプション)",
"Holes": "穴",
"Holes (edges on them)": "穴(そのエッジ)",
"Home view": "ホームビュー",
@@ -185,14 +227,20 @@
"In place (surfaces)": "その場で(サーフェス)",
"In plane": "平面内",
"Inside": "内側",
+ "Instant": "即時",
+ "Interface font": "インターフェースフォント",
"Interferes": "干渉あり",
+ "Invert": "反転",
"Isocurve": "等パラメータ線",
"Issue title": "Issueタイトル",
+ "Items": "項目",
"JOINTS": "ジョイント",
"Joint Origin1": "ジョイント原点1",
"Keep (points on it)": "残す部分(その上の点)",
"Keep Tools": "ツールボディを保持",
"Keep of the other surface": "相手のサーフェスで残す部分",
+ "Key a joint's value at this step": "このステップでジョイントの値をキー設定",
+ "Keys": "キー",
"LIBRARY": "ライブラリ",
"LINKS": "リンク",
"Later": "後で",
@@ -203,9 +251,14 @@
"Letter Spacing": "文字間隔",
"Library": "ライブラリ",
"Library file": "ライブラリファイル",
+ "Limits": "制限",
"Line Spacing": "行間",
+ "Line Type": "線種",
+ "Listing the installed fonts…": "インストール済みフォントを一覧表示中…",
+ "Load library": "ライブラリを読み込む",
"Local library": "ローカルライブラリ",
"Loop": "ループ",
+ "M5 or M5x0.5": "M5 または M5x0.5",
"MANAGE": "管理",
"MATERIALS": "材料",
"MODEL": "モデル",
@@ -216,14 +269,20 @@
"Matched restrictions check the final values.": "条件に一致する制限ルールが最終値を確認します。",
"Material": "材料",
"Max": "最大",
+ "Maximum": "最大",
+ "Mesh body": "メッシュボディ",
"Mid Radius": "中間半径",
"Middle double-click": "中ボタンのダブルクリック",
"Min": "最小",
+ "Minimum": "最小",
+ "Mirror Plane": "ミラー平面",
"Mitre": "留め継ぎ",
"Model Parameters": "モデルパラメータ",
"Modeled": "モデル化済み",
"More toolbar panels": "その他のツールバーパネル",
"Motion": "モーション",
+ "Mouse gestures": "マウス ジェスチャ",
+ "Mouse gestures only work with the SolidWorks mouse mode (the wheel orbits, Ctrl + wheel pans).": "マウス ジェスチャは SolidWorks マウス モードでのみ機能します(ホイールで回転、Ctrl + ホイールでパン)。",
"Move / Copy": "移動 / コピー",
"Move Type": "移動タイプ",
"Move down": "下へ移動",
@@ -246,8 +305,11 @@
"Not available yet": "まだ利用できません",
"Notch": "ノッチ",
"OUTPUT": "出力",
+ "Of": "の値",
+ "On your computer": "このコンピューター上",
"Opacity": "不透明度",
"Open GitHub draft": "GitHubの下書きを開く",
+ "Open library...": "ライブラリを開く...",
"Open local libraries in the desktop app. You can export this design's library here.": "ローカルライブラリはデスクトップアプリで開いてください。このデザインのライブラリはここで書き出せます。",
"Open-source parametric 3D CAD in Rust. Licensed MIT OR Apache-2.0.": "Rust製オープンソース・パラメトリック3D CAD。ライセンス: MIT または Apache-2.0。",
"Opens your browser and copies the report text for you to paste into GitHub.": "ブラウザーを開き、GitHubに貼り付ける報告本文をコピーします。",
@@ -269,8 +331,10 @@
"Picked": "選択したもの",
"Picked point": "選択した点",
"Pitch": "ピッチ",
+ "Pivot": "ピボット",
"Place at the origin instead": "代わりに原点に配置",
"Plastic Rules": "樹脂ルール",
+ "Play the joint's motion in the view": "ビューでジョイントの動きを再生",
"Playback": "再生",
"Plot": "グラフ",
"Position": "位置",
@@ -278,14 +342,18 @@
"Position (G0)": "位置 (G0)",
"Position along the edge, 0 at the start end, 1 at the other": "エッジ上の位置(始点が0、終点が1)",
"Preferences › Design turns the offer back on": "環境設定 › デザイン で再びオンにできます",
+ "Preview": "プレビュー",
"Preview Row": "行をプレビュー",
"Preview leaves the current design unchanged.": "プレビューは現在のデザインを変更しません。",
+ "Profile / Edges": "プロファイル / エッジ",
+ "Profiles or curves": "プロファイルまたは曲線",
"Profiles/Curves": "プロファイル/曲線",
"Quantity": "量",
"RECENT": "最近使用した項目",
"REFERENCE": "参照",
"RULED SURFACE": "ルールドサーフェス",
"RULES": "ルール",
+ "Radius": "半径",
"Radius Fit": "半径フィット",
"Ratio": "比率",
"Reattach selected face": "選択した面を再アタッチ",
@@ -294,6 +362,8 @@
"Rectangular": "長方形",
"Reference face": "参照面",
"Remove Tools": "ツールボディを削除",
+ "Remove condition": "条件を削除",
+ "Remove from Folder": "フォルダーから削除",
"Remove from list": "リストから削除",
"Remove override": "オーバーライドを削除",
"Remove private design details or paths before sharing.": "共有前に、非公開の設計情報やファイルパスを削除してください。",
@@ -301,6 +371,9 @@
"Remove the column": "列を削除",
"Remove the track": "トラックを削除",
"Remove this point": "この点を削除",
+ "Rename Feature": "フィーチャーの名前を変更",
+ "Rename Folder": "フォルダーの名前を変更",
+ "Replace existing library file": "既存のライブラリファイルを置き換える",
"Report a bug — review a screenshot and open a GitHub draft": "バグを報告 — スクリーンショットを確認してGitHub下書きを作成",
"Report text copied. Paste it into GitHub and submit your report there.": "報告本文をコピーしました。GitHubに貼り付けて投稿してください。",
"Reports are public. A GitHub account is required.": "報告は公開されます。GitHubアカウントが必要です。",
@@ -309,6 +382,7 @@
"Restore View": "ビューを復元",
"Restore outer boundary": "外側の境界を復元",
"Restore the inherited component or physical material appearance": "コンポーネントまたは物理マテリアルから継承した外観に戻す",
+ "Restore this studio's tools": "このスタジオのツールを復元",
"Result": "結果",
"Retake screenshot": "スクリーンショットを再取得",
"Reverse": "反転",
@@ -319,7 +393,13 @@
"Revert Position": "位置を元に戻す",
"Review the report and screenshot before opening GitHub.": "GitHubを開く前にレポートとスクリーンショットを確認してください。",
"Review your report on GitHub and click Submit new issue to publish it.": "GitHubで内容を確認し、Submit new issueをクリックすると公開されます。",
+ "Rib Length": "リブの長さ",
+ "Rib Offset": "リブのオフセット",
+ "Rib Thickness": "リブの厚さ",
+ "Ribs": "リブ",
"Rim Edge": "リムエッジ",
+ "Ring of tools on the right button": "右ボタンのツールリング",
+ "Roll Back Here": "ここまでロールバック",
"Roll History Marker Here": "履歴マーカーをここに移動",
"Round": "丸め",
"Rule": "ルール",
@@ -338,13 +418,18 @@
"Search": "検索",
"Search commands": "コマンドを検索",
"Search this library": "このライブラリを検索",
+ "Second plane": "第2平面",
"Section": "断面",
+ "Sections (one sketch each)": "セクション (各1スケッチ)",
+ "Select Other": "その他を選択",
"Select Other: hold the left button still on the model (or right-click › Select Other…) to list everything under the cursor; click again on the same spot to select the next thing there. Double-click the middle button to go Home (Preferences › Navigation).": "その他を選択: モデル上で左ボタンを長押し(または右クリック › その他を選択…)するとカーソル下の要素が一覧表示されます。同じ場所を再度クリックすると次の要素が選択されます。中ボタンをダブルクリックするとホームビューに戻ります(環境設定 › ナビゲーション)。",
"Select bodies (a face picks its body)": "ボディを選択(面をクリックするとそのボディが選択されます)",
"Select bodies or faces instead": "代わりにボディまたは面を選択",
+ "Select edges": "エッジを選択",
"Selection filter": "選択フィルター",
"Semantic faces share their appearance across instances.": "セマンティック面はインスタンス間で外観を共有します。",
"Send your report on GitHub": "GitHubでレポートを送信",
+ "Shaded": "シェーディング",
"Shape": "形状",
"Sheet Rules": "板金ルール",
"Show Agent Cursor": "エージェントカーソルを表示",
@@ -362,6 +447,7 @@
"SolidCraft closed before these designs were saved. Their last autosave can be opened.": "これらのデザインが保存される前にSolidCraftが終了しました。最後の自動保存ファイルを開くことができます。",
"Specialise": "特殊操作",
"Speed": "速度",
+ "Splitting tool": "分割ツール",
"Stand it up": "正立させる",
"Stand it up: a quarter turn about X, as one Move feature you can undo.": "正立させる: 取り消し可能な1つの移動フィーチャーとして、X軸周りに90度回転します。",
"Stand this part up?": "このパーツを正立させますか?",
@@ -372,16 +458,22 @@
"Steps to reproduce (optional)": "再現手順(任意)",
"Stitch the kept pieces": "残した部分をステッチ",
"Stitch to both bodies": "両方のボディにステッチ",
+ "Studio": "スタジオ",
"Study": "スタディ",
"Style": "スタイル",
"Summary": "概要",
+ "Suppress": "抑制",
"Suppressed": "抑制",
"Surface": "サーフェス",
+ "Surface, or faces to turn over": "サーフェス、または裏返す面",
"Swap Ends": "端点を入れ替え",
"TRIM": "トリム",
"Tangent (G1)": "接線 (G1)",
"Tangent Chain": "正接チェーン",
+ "Tangent chain": "接線チェーン",
"Tap drill diameter": "タップ下穴径",
+ "Target": "ターゲット",
+ "Target Body": "ターゲットボディ",
"Tear": "引き裂き",
"Technical details": "技術情報",
"The dashed sketch is a saved plane guide. Select a new face to repair the attachment.": "破線のスケッチは保存された平面ガイドです。新しい面を選択してアタッチメントを修復してください。",
@@ -396,24 +488,31 @@
"This child is shared. Position changes apply to every copy of its parent.": "この子要素は共有されています。位置の変更は親のすべてのコピーに適用されます。",
"This face cannot provide a durable attachment. Choose another face or explicitly use a fixed plane.": "この面は安定したアタッチメントを提供できません。別の面を選択するか、固定平面を明示的に使用してください。",
"This image is not attached to GitHub yet. Copy or save it, then attach it on GitHub.": "この画像はまだGitHubに添付されていません。コピーまたは保存し、GitHubで添付してください。",
+ "To": "終了",
"To Offset": "オフセットまで",
"To edges": "終了側エッジ",
"Tolerance": "公差",
"Too close": "近すぎる",
+ "Tool Bodies": "ツールボディ",
+ "Tools": "ツール",
+ "Tools, clockwise from the top": "上から時計回りにツール",
"Trimming tool (plane, face or curves)": "トリムツール(平面、面、または曲線)",
"Turn off section analysis before exporting the view.": "断面解析をオフにしてからエクスポートしてください。",
"Type": "タイプ",
"UNTRIM": "トリム解除",
"Unit": "単位",
+ "Unsuppress": "抑制を解除",
"Updating the preview": "プレビューを更新中",
"Use active author placement": "アクティブな作成元配置を使用",
"Use fixed plane": "固定平面を使用",
"Use saved fixed plane": "保存された固定平面を使用",
"Use selected face as fixed plane": "選択した面を固定平面として使用",
+ "Use the SolidWorks mouse mode": "SolidWorks マウス モードを使用",
"User Parameters": "ユーザーパラメータ",
"VIEW": "表示",
"VIEWS": "ビュー",
"Value": "値",
+ "Variable Radius": "可変半径",
"Velocity": "速度",
"Vertices": "頂点",
"View navigator": "ビューナビゲーター",
@@ -427,10 +526,18 @@
"When": "条件 (When)",
"Width": "幅",
"Will fail": "失敗します",
+ "With gestures on, the right button no longer orbits the view: hold it and move to open the ring, then touch a tool's zone. A plain right-click still opens the menu.": "マウス ジェスチャがオンのとき、右ボタンではビューを回転しません。押したまま動かすとツールリングが開くので、ツールのゾーンに触れてください。通常の右クリックでは引き続きメニューが開きます。",
+ "X": "X",
+ "X Angle": "X 角度",
"X angle": "X角度",
"X distance": "X距離",
+ "Y": "Y",
+ "Y Angle": "Y 角度",
"Y angle": "Y角度",
"Y distance": "Y距離",
+ "Z": "Z",
+ "Z Angle": "Z 角度",
+ "Z Distance": "Z 距離",
"Z angle": "Z角度",
"Z distance": "Z距離",
"Zebra": "ゼブラ",
@@ -1020,8 +1127,15 @@
"motion.to_end": "最後へ",
"motion.to_start": "最初へ",
"motion.track_name": "トラック {number}",
+ "nav.alias.help": "Shift+Alt+左ドラッグで回転、Shift+Alt+中ドラッグでパン、Shift+Alt+右ドラッグでズーム。中ドラッグでもパン、右ドラッグで回転。",
+ "nav.blender.help": "中ドラッグで回転、Shift+中ドラッグでパン、Ctrl+中ドラッグでズーム。右ドラッグではカメラは動きません。",
"nav.free_orbit.help": "マウスと3Dマウスで、極点を越えて回転し、ロールを保ちます。\nShiftによる軸スナップは無効になります。",
"nav.free_orbit.label": "自由回転",
+ "nav.fusion.help": "中ドラッグでパン、Shift+中ドラッグで回転、右ドラッグで回転。",
+ "nav.inventor.help": "中ドラッグでパン、Shift+中ドラッグで回転、Ctrl+中ドラッグでズーム、右ドラッグで回転。",
+ "nav.openscad.help": "空きスペースで左ドラッグすると回転、Shift+左ドラッグで矩形選択、スケッチ ジオメトリはドラッグで編集。右または中ドラッグでパン、Shift+右または Shift+中ドラッグでズーム。",
+ "nav.solidworks.help": "中ドラッグで回転、Ctrl+中ドラッグでパン、Shift+中ドラッグでズーム、右ドラッグで回転。",
+ "nav.tinkercad.help": "右ドラッグで回転、中ドラッグまたは Shift+右ドラッグでパン。",
"nav.touchpad.help": "Shift を押しながらポインターを動かすとパン、Alt/Option を押しながら動かすと回転します。マウスボタンは不要です。縦スクロールでズームします。",
"nav.touchpad.label": "タッチパッド",
"nav.touchpad.orbit": "回転(Alt/Option を押しながら移動、マウスボタン不要)",
diff --git a/assets/locales/zh.json b/assets/locales/zh.json
index 993a86cc6e..485e6e2517 100644
--- a/assets/locales/zh.json
+++ b/assets/locales/zh.json
@@ -14,11 +14,15 @@
"Active": "活动",
"Active rule": "活动规则",
"Add": "添加",
+ "Add Column": "添加列",
"Add Key": "添加按键",
"Add Mid Radius": "添加中间半径",
"Add Row": "添加行",
+ "Add a tool": "添加工具",
"Add condition": "添加条件",
"Add or edit rule": "添加或编辑规则",
+ "Add to New Folder": "添加到新文件夹",
+ "Advanced": "高级",
"Against": "对照",
"Alignment": "对齐",
"All Sketch Points": "所有草图点",
@@ -32,6 +36,7 @@
"Appearance name": "外观名称",
"Applied Radius": "应用半径",
"Apply To": "应用于",
+ "Apply library appearance": "应用库外观",
"Apply to selection": "应用到选择",
"Apply your appearance first. Exports assigned appearances and materials created in this design.": "请先应用外观。导出已指定的外观和在此设计中创建的材质。",
"Arc length": "弧长",
@@ -42,13 +47,18 @@
"BLEND SURFACE": "混合曲面",
"BOUNDARY SURFACE": "边界曲面",
"BROWSER": "浏览器",
+ "Bend Edges": "折弯边",
"Bend Line Position": "弯折线位置",
"Bend Position": "折弯位置",
"Bend Radius": "折弯半径",
"Bend Table": "折弯表",
"Bends": "折弯",
"Bodies": "实体",
+ "Bodies (optional)": "实体(可选)",
"Body": "实体",
+ "Body (last if none)": "实体(未指定时为最后一个)",
+ "Body to split": "要分割的实体",
+ "Body, or faces to take out": "实体,或要移除的面",
"Boundary": "边界",
"Bounding box": "边界框",
"CHECK": "检查",
@@ -60,7 +70,9 @@
"CSV or JSON: updates existing parameters, adds new ones": "CSV 或 JSON:更新现有参数、添加新参数",
"Capture All Positions": "捕获所有位置",
"Capture Pos.": "捕获位置",
+ "Catch Depth": "卡扣深度",
"Catch Direction": "卡扣方向",
+ "Catch Length": "卡扣长度",
"Cells": "区域",
"Center X": "中心 X",
"Center Y": "中心 Y",
@@ -69,15 +81,21 @@
"Chamfer Type": "倒角类型",
"Check collisions": "检查碰撞",
"Checked": "已检查",
+ "Choose Variable radius or Spline in Type.": "请在“类型”中选择 Variable radius 或样条曲线。",
"Choose a new plane. Sketch geometry and dimensions stay unchanged in its two-dimensional coordinates.": "选择一个新平面。草图几何和尺寸在其二维坐标中保持不变。",
"Choose…": "选择…",
"Circular": "圆周",
"Circumference": "周长",
"Close draft": "关闭草稿",
+ "Collapse": "折叠",
"Collisions": "碰撞",
"Colour": "颜色",
+ "Command": "命令",
"Comment": "注释",
+ "Component 1": "组件 1",
+ "Component 2": "组件 2",
"Component1": "组件1",
+ "Components": "组件",
"Config Table": "配置表",
"Configuration": "配置",
"Configuration rules": "配置规则",
@@ -86,6 +104,7 @@
"Contact sets": "接触集",
"Continue on GitHub": "在GitHub中继续",
"Continuity": "连续性",
+ "Control Radius": "控制半径",
"Copy Error Message": "复制错误消息",
"Copy Warning Message": "复制警告消息",
"Copy all licences": "复制所有许可证",
@@ -95,8 +114,11 @@
"Corner Relief": "拐角释放",
"Corner Relief Shape": "拐角释放形状",
"Counterbore depth": "沉孔深度",
+ "Counterbore Ø": "柱形沉孔 Ø",
"Countersink angle": "沉头角度",
+ "Countersink Ø": "锥形沉孔 Ø",
"Create Issue — review draft": "创建 Issue——审阅草稿",
+ "Create Issue…": "创建 Issue…",
"Cross curves": "交叉曲线",
"Cube": "立方体",
"Current orthographic view (1:1 mm)": "当前正交视图(1:1毫米)",
@@ -106,7 +128,11 @@
"Curvature change (G3)": "曲率变化 (G3)",
"Custom": "自定义",
"Customize Toolbar": "自定义工具栏",
+ "Customize…": "自定义…",
+ "Cylindrical face": "圆柱面",
"Delete": "删除",
+ "Delete Selected Features…": "删除所选特征…",
+ "Delete Selected Folders": "删除所选文件夹",
"Delete all": "全部删除",
"Delete rule": "删除规则",
"Delete the row": "删除此行",
@@ -117,8 +143,11 @@
"Describe what happened before continuing.": "继续之前,请描述发生了什么。",
"Designs you open or save appear here.": "你打开或保存的设计会显示在此处。",
"Determined by To Object. Choose Angle to edit the angular extent.": "由“到对象”确定。选择“角度”可编辑角度范围。",
+ "Diameter": "直径",
"Direction": "方向",
"Discard": "放弃",
+ "Distance": "距离",
+ "Distance 1": "距离 1",
"Do not export hidden edges": "不导出隐藏线",
"Don't ask again": "不再询问",
"Double-click to rename": "双击重命名",
@@ -130,18 +159,22 @@
"Edit Profile Sketch": "编辑轮廓草图",
"Enable rule": "启用规则",
"Enabled": "已启用",
+ "End Radius": "结束半径",
"End bulge": "终止鼓度",
"End continuity": "终止连续性",
+ "Expand": "展开",
"Expected result (optional)": "预期结果(可选)",
"Explode": "爆炸",
"Explode Text": "分解文字",
"Export Animation…": "导出动画…",
+ "Export Bend Table…": "导出折弯表…",
"Export CSV…": "导出 CSV…",
"Export Current View as DXF": "将当前视图导出为DXF",
"Export Current View as DXF…": "将当前视图导出为DXF…",
"Export DXF": "导出DXF",
"Export DXF…": "导出DXF…",
"Export JSON…": "导出 JSON…",
+ "Export design library...": "导出设计库...",
"Export hidden edges as dashed lines": "以虚线导出隐藏线",
"Expression": "表达式",
"Extend to meet": "延伸至相交",
@@ -149,25 +182,33 @@
"FILES": "文件",
"FLAT": "展开",
"Face": "面",
+ "Face Appearance": "面外观",
"Face attachment lost": "面附着丢失",
"Faces": "面",
"Faces / edges / vertices": "面 / 边 / 顶点",
+ "Faces to split": "要分割的面",
"Fastener": "紧固件",
"Favorites": "收藏",
"Favourite": "收藏",
"Feature": "特征",
"Files from many CAD programs have Y up, so they open lying on their back here (Z up).": "许多 CAD 程序的文件以 Y 为上轴,因此在此处打开时会平躺(Z 朝上)。",
"Filter": "筛选",
+ "Filter…": "筛选…",
"Find in Browser": "在浏览器中查找",
"Finish": "完成",
+ "First plane": "第一个平面",
+ "Fit and G2 corners require Constant radius.": "拟合和 G2 拐角需要 Constant radius。",
+ "Fixed Face": "固定面",
"Flat Pattern": "展开图",
"Flat size": "平板尺寸",
"Follow camera (Look At sketches)": "跟随相机(注视草图)",
"Follow the camera (Look At sketches)": "跟随相机(注视草图)",
"Font": "字体",
+ "From": "起点",
"From Bodies": "从实体创建",
"From edges": "起始边",
"Full Length": "全长",
+ "G2 corners require a constant radius and Exact fit. G2 corner construction is not supported yet.": "G2 拐角需要恒定半径和 Exact fit。尚不支持构建 G2 拐角。",
"Gap": "间隙",
"Grid": "网格",
"HISTORY": "历史",
@@ -175,6 +216,7 @@
"Hidden edges": "隐藏线",
"History layout": "历史布局",
"History names": "历史名称",
+ "Hole (optional)": "孔(可选)",
"Holes": "孔",
"Holes (edges on them)": "孔(孔上的边)",
"Home view": "主视图",
@@ -185,14 +227,20 @@
"In place (surfaces)": "原位(曲面)",
"In plane": "在平面内",
"Inside": "内侧",
+ "Instant": "即时",
+ "Interface font": "界面字体",
"Interferes": "发生干涉",
+ "Invert": "反转",
"Isocurve": "等参线",
"Issue title": "Issue 标题",
+ "Items": "项目",
"JOINTS": "关节",
"Joint Origin1": "接头原点1",
"Keep (points on it)": "保留(其上的点)",
"Keep Tools": "保留工具",
"Keep of the other surface": "另一曲面保留的部分",
+ "Key a joint's value at this step": "在此步骤为接头值设置关键帧",
+ "Keys": "关键帧",
"LIBRARY": "库",
"LINKS": "链接",
"Later": "稍后",
@@ -203,9 +251,14 @@
"Letter Spacing": "字间距",
"Library": "零件库",
"Library file": "库文件",
+ "Limits": "限制",
"Line Spacing": "行间距",
+ "Line Type": "线型",
+ "Listing the installed fonts…": "正在列出已安装字体…",
+ "Load library": "加载库",
"Local library": "本地库",
"Loop": "循环",
+ "M5 or M5x0.5": "M5 或 M5x0.5",
"MANAGE": "管理",
"MATERIALS": "材料",
"MODEL": "模型",
@@ -216,14 +269,20 @@
"Matched restrictions check the final values.": "满足条件的限制规则检查最终值。",
"Material": "材质",
"Max": "最大",
+ "Maximum": "最大",
+ "Mesh body": "网格实体",
"Mid Radius": "中间半径",
"Middle double-click": "中键双击",
"Min": "最小",
+ "Minimum": "最小",
+ "Mirror Plane": "镜像平面",
"Mitre": "斜接",
"Model Parameters": "模型参数",
"Modeled": "已建模",
"More toolbar panels": "更多工具栏面板",
"Motion": "运动",
+ "Mouse gestures": "鼠标手势",
+ "Mouse gestures only work with the SolidWorks mouse mode (the wheel orbits, Ctrl + wheel pans).": "鼠标手势仅在 SolidWorks 鼠标模式下有效(滚轮旋转,Ctrl + 滚轮平移)。",
"Move / Copy": "移动 / 复制",
"Move Type": "移动类型",
"Move down": "下移",
@@ -246,8 +305,11 @@
"Not available yet": "暂不可用",
"Notch": "缺口",
"OUTPUT": "输出",
+ "Of": "的值",
+ "On your computer": "在此计算机上",
"Opacity": "不透明度",
"Open GitHub draft": "打开 GitHub 草稿",
+ "Open library...": "打开库...",
"Open local libraries in the desktop app. You can export this design's library here.": "请在桌面应用中打开本地库。您可以在此导出当前设计的库。",
"Open-source parametric 3D CAD in Rust. Licensed MIT OR Apache-2.0.": "使用 Rust 编写的开源参数化 3D CAD。基于 MIT OR Apache-2.0 许可。",
"Opens your browser and copies the report text for you to paste into GitHub.": "打开浏览器,并复制报告文本以便粘贴到GitHub。",
@@ -269,8 +331,10 @@
"Picked": "所选",
"Picked point": "选取的点",
"Pitch": "螺距",
+ "Pivot": "枢轴",
"Place at the origin instead": "改为放置在原点",
"Plastic Rules": "塑料规则",
+ "Play the joint's motion in the view": "在视图中播放接头运动",
"Playback": "播放",
"Plot": "图表",
"Position": "位置",
@@ -278,14 +342,18 @@
"Position (G0)": "位置 (G0)",
"Position along the edge, 0 at the start end, 1 at the other": "沿边的位置,起点端为 0,另一端为 1",
"Preferences › Design turns the offer back on": "可在 首选项 › 设计 中重新开启此提示",
+ "Preview": "预览",
"Preview Row": "预览行",
"Preview leaves the current design unchanged.": "预览不会更改当前设计。",
+ "Profile / Edges": "轮廓 / 边",
+ "Profiles or curves": "轮廓或曲线",
"Profiles/Curves": "轮廓/曲线",
"Quantity": "物理量",
"RECENT": "最近使用",
"REFERENCE": "参考",
"RULED SURFACE": "直纹曲面",
"RULES": "规则",
+ "Radius": "半径",
"Radius Fit": "半径拟合",
"Ratio": "比率",
"Reattach selected face": "重新附着所选面",
@@ -294,6 +362,8 @@
"Rectangular": "矩形",
"Reference face": "参考面",
"Remove Tools": "移除工具",
+ "Remove condition": "删除条件",
+ "Remove from Folder": "从文件夹中移除",
"Remove from list": "从列表移除",
"Remove override": "移除覆盖",
"Remove private design details or paths before sharing.": "共享前请移除私密设计细节或路径。",
@@ -301,6 +371,9 @@
"Remove the column": "移除此列",
"Remove the track": "移除轨迹",
"Remove this point": "移除此点",
+ "Rename Feature": "重命名特征",
+ "Rename Folder": "重命名文件夹",
+ "Replace existing library file": "替换现有库文件",
"Report a bug — review a screenshot and open a GitHub draft": "报告缺陷 — 复核截图并开启 GitHub 草稿",
"Report text copied. Paste it into GitHub and submit your report there.": "报告文本已复制。请在GitHub中粘贴并提交。",
"Reports are public. A GitHub account is required.": "报告将公开发布。您需要GitHub账户。",
@@ -309,6 +382,7 @@
"Restore View": "恢复视图",
"Restore outer boundary": "恢复外边界",
"Restore the inherited component or physical material appearance": "还原继承的组件或物理材质外观",
+ "Restore this studio's tools": "恢复此工作室的工具",
"Result": "结果",
"Retake screenshot": "重新截图",
"Reverse": "反向",
@@ -319,7 +393,13 @@
"Revert Position": "恢复位置",
"Review the report and screenshot before opening GitHub.": "打开 GitHub 前请审阅报告和截图。",
"Review your report on GitHub and click Submit new issue to publish it.": "请在GitHub中检查报告,然后点击Submit new issue发布。",
+ "Rib Length": "筋板长度",
+ "Rib Offset": "筋板偏移",
+ "Rib Thickness": "筋板厚度",
+ "Ribs": "筋板",
"Rim Edge": "轮缘边",
+ "Ring of tools on the right button": "右键工具环",
+ "Roll Back Here": "回滚到此处",
"Roll History Marker Here": "将历史标记滚动到此处",
"Round": "圆角",
"Rule": "规则",
@@ -338,13 +418,18 @@
"Search": "搜索",
"Search commands": "搜索命令",
"Search this library": "搜索此库",
+ "Second plane": "第二个平面",
"Section": "剖面",
+ "Sections (one sketch each)": "截面(每个一个草图)",
+ "Select Other": "选择其他",
"Select Other: hold the left button still on the model (or right-click › Select Other…) to list everything under the cursor; click again on the same spot to select the next thing there. Double-click the middle button to go Home (Preferences › Navigation).": "“选择其他”:在模型上按住左键(或右键单击 › 选择其他…)列出光标下的所有对象;在同一位置再次单击可选择该处的下一个对象。双击中键转到主视图(首选项 › 导航)。",
"Select bodies (a face picks its body)": "选择实体(单击面即选择其所属实体)",
"Select bodies or faces instead": "改为选择实体或面",
+ "Select edges": "选择边",
"Selection filter": "选择筛选",
"Semantic faces share their appearance across instances.": "语义面在各实例间共享外观。",
"Send your report on GitHub": "在 GitHub 上发送报告",
+ "Shaded": "着色",
"Shape": "形状",
"Sheet Rules": "钣金规则",
"Show Agent Cursor": "显示代理光标",
@@ -362,6 +447,7 @@
"SolidCraft closed before these designs were saved. Their last autosave can be opened.": "SolidCraft 在这些设计保存前已关闭。可以打开它们的上次自动保存。",
"Specialise": "专用操作",
"Speed": "速度",
+ "Splitting tool": "分割工具",
"Stand it up": "将其立起",
"Stand it up: a quarter turn about X, as one Move feature you can undo.": "将其立起:绕 X 轴旋转四分之一周,作为一个可撤销的移动特征。",
"Stand this part up?": "立起此零件?",
@@ -372,16 +458,22 @@
"Steps to reproduce (optional)": "重现步骤(可选)",
"Stitch the kept pieces": "缝合保留的部分",
"Stitch to both bodies": "缝合到两个实体",
+ "Studio": "工作室",
"Study": "研究",
"Style": "样式",
"Summary": "摘要",
+ "Suppress": "抑制",
"Suppressed": "已抑制",
"Surface": "曲面",
+ "Surface, or faces to turn over": "曲面,或要翻转的面",
"Swap Ends": "交换端点",
"TRIM": "修剪",
"Tangent (G1)": "相切 (G1)",
"Tangent Chain": "相切链",
+ "Tangent chain": "相切链",
"Tap drill diameter": "攻丝底孔直径",
+ "Target": "目标",
+ "Target Body": "目标实体",
"Tear": "撕裂",
"Technical details": "技术详情",
"The dashed sketch is a saved plane guide. Select a new face to repair the attachment.": "虚线草图是已保存的平面引导。选择一个新面以修复附着。",
@@ -396,24 +488,31 @@
"This child is shared. Position changes apply to every copy of its parent.": "此子项是共享的。位置更改会应用到其父项的每个副本。",
"This face cannot provide a durable attachment. Choose another face or explicitly use a fixed plane.": "此面无法提供持久附着。请选择其他面或显式使用固定平面。",
"This image is not attached to GitHub yet. Copy or save it, then attach it on GitHub.": "此图片尚未附加到GitHub。请复制或保存图片,然后在GitHub中附加。",
+ "To": "终点",
"To Offset": "偏移",
"To edges": "终止边",
"Tolerance": "公差",
"Too close": "过近",
+ "Tool Bodies": "工具实体",
+ "Tools": "工具",
+ "Tools, clockwise from the top": "工具,从顶部顺时针排列",
"Trimming tool (plane, face or curves)": "修剪工具(平面、面或曲线)",
"Turn off section analysis before exporting the view.": "请关闭截面分析后再导出视图。",
"Type": "类型",
"UNTRIM": "取消修剪",
"Unit": "单位",
+ "Unsuppress": "取消抑制",
"Updating the preview": "正在更新预览",
"Use active author placement": "使用活动作者放置",
"Use fixed plane": "使用固定平面",
"Use saved fixed plane": "使用已保存的固定平面",
"Use selected face as fixed plane": "使用所选面作为固定平面",
+ "Use the SolidWorks mouse mode": "使用 SolidWorks 鼠标模式",
"User Parameters": "用户参数",
"VIEW": "视图",
"VIEWS": "视图",
"Value": "值",
+ "Variable Radius": "可变半径",
"Velocity": "速度",
"Vertices": "顶点",
"View navigator": "视图导航器",
@@ -427,10 +526,18 @@
"When": "条件",
"Width": "宽度",
"Will fail": "将失败",
+ "With gestures on, the right button no longer orbits the view: hold it and move to open the ring, then touch a tool's zone. A plain right-click still opens the menu.": "开启鼠标手势后,右键不再旋转视图:按住右键并移动以打开工具环,然后触碰某个工具的区域。普通右键单击仍会打开菜单。",
+ "X": "X",
+ "X Angle": "X 角度",
"X angle": "X 角度",
"X distance": "X 距离",
+ "Y": "Y",
+ "Y Angle": "Y 角度",
"Y angle": "Y 角度",
"Y distance": "Y 距离",
+ "Z": "Z",
+ "Z Angle": "Z 角度",
+ "Z Distance": "Z 距离",
"Z angle": "Z 角度",
"Z distance": "Z 距离",
"Zebra": "斑马纹",
@@ -1020,8 +1127,15 @@
"motion.to_end": "到结尾",
"motion.to_start": "到开头",
"motion.track_name": "轨道 {number}",
+ "nav.alias.help": "Shift+Alt+左键拖动旋转,Shift+Alt+中键拖动平移,Shift+Alt+右键拖动缩放;中键拖动也可平移,右键拖动旋转",
+ "nav.blender.help": "中键拖动旋转,Shift+中键拖动平移,Ctrl+中键拖动缩放;右键拖动不会移动相机",
"nav.free_orbit.help": "鼠标和3D鼠标可保持滚转并越过两个极点旋转。Shift轴吸附将被禁用。",
"nav.free_orbit.label": "自由旋转",
+ "nav.fusion.help": "中键拖动平移,Shift+中键拖动旋转,右键拖动旋转",
+ "nav.inventor.help": "中键拖动平移,Shift+中键拖动旋转,Ctrl+中键拖动缩放,右键拖动旋转",
+ "nav.openscad.help": "在空白处左键拖动旋转,Shift+左键拖动框选,拖动草图几何可编辑;右键或中键拖动平移,Shift+右键或 Shift+中键拖动缩放",
+ "nav.solidworks.help": "中键拖动旋转,Ctrl+中键拖动平移,Shift+中键拖动缩放,右键拖动旋转",
+ "nav.tinkercad.help": "右键拖动旋转,中键或 Shift+右键拖动平移",
"nav.touchpad.help": "按住 Shift 并移动指针可平移;按住 Alt/Option 并移动可旋转。无需按鼠标按钮。垂直滚动可缩放。",
"nav.touchpad.label": "触控板",
"nav.touchpad.orbit": "旋转(按住 Alt/Option 并移动,无需鼠标按钮)",
diff --git a/crates/ui-egui/Cargo.toml b/crates/ui-egui/Cargo.toml
index 0f25e308ec..ef706b1041 100644
--- a/crates/ui-egui/Cargo.toml
+++ b/crates/ui-egui/Cargo.toml
@@ -39,6 +39,9 @@ winreg = "0.56"
[dev-dependencies]
# Parse the source guard structurally, including code after inline test modules.
syn = { workspace = true, features = ["visit"] }
+# The catalog guard reads every UI source file as Rust tokens; already in the tree through
+# crates/derive and the workspace lockfile.
+proc-macro2 = { workspace = true }
# Pictures pasted into the agent chat; already in the tree, with the same features, through
# egui-winit's clipboard.
diff --git a/crates/ui-egui/src/dialogs_thread.rs b/crates/ui-egui/src/dialogs_thread.rs
index a680fa6fb3..3edf1ac09a 100644
--- a/crates/ui-egui/src/dialogs_thread.rs
+++ b/crates/ui-egui/src/dialogs_thread.rs
@@ -61,7 +61,7 @@ impl HoleThreadDraft {
pub(crate) fn hole_rows(ui: &mut egui::Ui, doc: &Document, designation: &mut String, custom: &mut Option<HoleThreadDraft>) -> bool {
let designation_id = ui.make_persistent_id("hole_thread_designation");
form_row(ui, "Profile", |ui| {
- ui.label(tr("ISO metric"));
+ ui.label(tr("thread.iso_metric"));
});
let sizes = metric_thread_sizes();
@@ -107,7 +107,7 @@ pub(crate) fn hole_rows(ui: &mut egui::Ui, doc: &Document, designation: &mut Str
ui.label(format!("{:.3} mm", d - p));
}
None => {
- ui.label(tr("Select size"));
+ ui.label(tr("thread.select_size"));
}
}
});
@@ -117,7 +117,7 @@ pub(crate) fn hole_rows(ui: &mut egui::Ui, doc: &Document, designation: &mut Str
/// Returns (Enter pressed, automatic sizing requested).
pub(crate) fn rows(ui: &mut egui::Ui, designation: &mut String, suggested: &mut Option<String>, modeled: &mut bool, full: &mut bool) -> (bool, bool) {
form_row(ui, "Profile", |ui| {
- ui.label(tr("ISO metric"));
+ ui.label(tr("thread.iso_metric"));
});
let before = designation.trim().is_empty() || suggested.as_deref() == Some(designation.as_str());
diff --git a/crates/ui-egui/src/i18n.rs b/crates/ui-egui/src/i18n.rs
index 79f6db83de..33c18873bc 100644
--- a/crates/ui-egui/src/i18n.rs
+++ b/crates/ui-egui/src/i18n.rs
@@ -280,6 +280,7 @@ mod tests {
assert_eq!(ja.given_name("Untitled bracket"), "Untitled bracket");
assert_eq!(ja.given_name("Boss"), "Boss");
}
+ use proc_macro2::{Delimiter, TokenStream, TokenTree};
use std::collections::BTreeSet;
fn placeholders(text: &str) -> BTreeSet<&str> {
@@ -439,6 +440,66 @@ mod tests {
}
}
+ /// `label()` resolves a literal by its English text (or, failing that, an id); `text()` only
+ /// by id. A literal neither reaches is shown verbatim in every locale and nothing fails, so
+ /// every label and id literal the UI passes is read from the source and checked against the
+ /// English catalog. The source is tokenised with `proc-macro2`, so comments, raw strings,
+ /// escapes and test modules are handled, and calls inside macros count too. UI-kit calls that
+ /// translate their label themselves (`row`, imported as `form_row`, and the rest of
+ /// `KIT_CALLS`) are read at the same argument positions the kit translates.
+ #[test]
+ fn every_ui_label_literal_reaches_an_english_catalog_entry() {
+ let english: Messages = serde_json::from_str(ENGLISH.source).unwrap();
+ let ids: BTreeSet<&str> = english.keys().map(String::as_str).collect();
+ let texts: BTreeSet<&str> = english.values().filter(|text| !text.contains('{')).map(String::as_str).collect();
+ let root = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("src");
+ let mut files = Vec::new();
+ source_files(&root, &mut files);
+ files.sort();
+ let sources: Vec<(std::path::PathBuf, String)> =
+ files.into_iter().map(|path| (path.clone(), std::fs::read_to_string(&path).unwrap())).collect();
+ let context = Context::new(&sources);
+ // Test code like `*_tests.rs`, and the files a source declares as external test modules
+ // (`#[cfg(test)] mod gallery;`). An inline `#[cfg(test)] mod tests { … }` includes no file
+ // and is skipped in place by the scanner.
+ let test_only: BTreeSet<std::path::PathBuf> = sources.iter().flat_map(|(path, source)| test_module_files(path, source)).collect();
+ let mut missing: Vec<String> = Vec::new();
+ for (path, source) in &sources {
+ if test_only.contains(path) {
+ continue;
+ }
+ let shown = path.strip_prefix(&root).unwrap_or(path).display().to_string();
+ for (literal, id_only) in literals_in(&context, path, source) {
+ // A literal with no letters (`×`, `↑`) has no language: there is nothing to
+ // translate, and no entry to want. An empty literal is a blank spacer cell.
+ if !literal.chars().any(char::is_alphabetic) {
+ continue;
+ }
+ if !ids.contains(literal.as_str()) && (id_only || !texts.contains(literal.as_str())) {
+ missing.push(format!("{shown}: `{literal}`"));
+ }
+ }
+ }
+ assert!(
+ missing.is_empty(),
+ "{} literal(s) would stay English in every locale because no English catalog entry reaches them:\n {}",
+ missing.len(),
+ missing.join("\n ")
+ );
+ }
+
+ /// The mouse mapping picker shows its preset's help through `tr_label`, which the guard above
+ /// can't see: the text sits in a struct field, not in a call. Each one must be the English text
+ /// of its preset's catalog message, or it stays English in every locale.
+ #[test]
+ fn navigation_preset_help_reaches_the_catalog() {
+ let english = Locale::for_language("en");
+ for preset in &crate::prefs::NAV_PRESETS {
+ let id = format!("nav.{}.help", preset.id);
+ assert_eq!(english.text(&id), preset.help, "{id}");
+ }
+ }
+
#[test]
fn keys_and_engine_labels_translate_with_english_fallback() {
let ja = Locale::for_language("ja");
@@ -781,4 +842,1065 @@ mod tests {
}
assert_eq!(tr("ui.preferences"), "Preferences");
}
+
+ /// Every `.rs` file under `dir` except test modules (`*_tests.rs`, `tests.rs`).
+ fn source_files(dir: &std::path::Path, out: &mut Vec<std::path::PathBuf>) {
+ let Ok(entries) = std::fs::read_dir(dir) else { return };
+ for entry in entries.flatten() {
+ let path = entry.path();
+ if path.is_dir() {
+ source_files(&path, out);
+ } else if path.extension().and_then(|e| e.to_str()) == Some("rs") {
+ let name = path.file_name().and_then(|n| n.to_str()).unwrap_or_default();
+ if name != "tests.rs" && !name.ends_with("_tests.rs") {
+ out.push(path);
+ }
+ }
+ }
+ }
+
+ /// A UI-kit call whose label or text argument reaches `tr_label` (shown text) or `tr` (id).
+ /// `args` are zero-based positions without the receiver; `trim` names the positions the kit
+ /// normalises at run time (the row label, whose leading indent it keeps). Only those may be
+ /// matched with their indentation removed.
+ struct KitCall {
+ name: &'static str,
+ args: &'static [usize],
+ id: bool,
+ trim: &'static [usize],
+ }
+
+ /// The kit functions that translate a label or text for display or announcement, read off
+ /// `crates/ui-egui/src/ui_kit/`. Not here: the painters that expect an already translated
+ /// string (`caption`, `summary_row`, `list_row`, `panel::header`, `empty_box`, `checkbox`,
+ /// `tool_choices`), `segmented` (it measures its options with `tr_label` but paints the raw
+ /// option, so a catalog entry could not translate it — a wiring gap of its own) and the
+ /// measurement helpers (`metrics::label_width`, `ContentWidth::*`). The `hint` arguments of
+ /// `hint_field`/`text_field`/`password_field`/`message_field` go raw into
+ /// `TextEdit::hint_text`, so they are not translated labels either.
+ const KIT_CALLS: &[KitCall] = &[
+ // layout.rs: `sized_row` draws `tr_label(text)`, and every row builder reaches it.
+ KitCall { name: "row", args: &[1], id: false, trim: &[1] },
+ KitCall { name: "expr_row", args: &[1], id: false, trim: &[1] },
+ KitCall { name: "hint_row", args: &[1], id: false, trim: &[1] },
+ KitCall { name: "text_row", args: &[1], id: false, trim: &[1] },
+ KitCall { name: "choice_row", args: &[1, 4], id: false, trim: &[1] },
+ KitCall { name: "section", args: &[2], id: false, trim: &[] },
+ KitCall { name: "section_count", args: &[2], id: false, trim: &[] },
+ // fields.rs
+ KitCall { name: "multiline_text_field", args: &[1], id: false, trim: &[1] },
+ KitCall { name: "dropdown", args: &[3], id: false, trim: &[] },
+ KitCall { name: "cell_editor", args: &[3], id: false, trim: &[] },
+ KitCall { name: "bounded_cell_editor", args: &[3], id: false, trim: &[] },
+ KitCall { name: "search_field", args: &[3], id: false, trim: &[] },
+ KitCall { name: "placement_field", args: &[3], id: false, trim: &[] },
+ KitCall { name: "library_cell", args: &[3], id: false, trim: &[] },
+ // actions.rs
+ KitCall { name: "icon_button_at", args: &[3], id: false, trim: &[] },
+ KitCall { name: "icon_button_colored", args: &[3], id: false, trim: &[] },
+ KitCall { name: "footer", args: &[1, 2], id: false, trim: &[] },
+ KitCall { name: "button", args: &[1], id: false, trim: &[] },
+ KitCall { name: "primary_button", args: &[1], id: false, trim: &[] },
+ KitCall { name: "wide_primary_button", args: &[1], id: false, trim: &[] },
+ KitCall { name: "action_menu", args: &[1], id: false, trim: &[] },
+ KitCall { name: "compact_button", args: &[2], id: false, trim: &[] },
+ KitCall { name: "icon_label_button", args: &[1], id: false, trim: &[] },
+ KitCall { name: "command_menu_button", args: &[2], id: false, trim: &[] },
+ // choice.rs
+ KitCall { name: "checkbox_grid", args: &[1], id: false, trim: &[] },
+ KitCall { name: "options", args: &[2], id: false, trim: &[] },
+ KitCall { name: "checkbox_row", args: &[2], id: false, trim: &[] },
+ KitCall { name: "toggle_icon", args: &[2], id: false, trim: &[] },
+ // table.rs
+ KitCall { name: "Column::new", args: &[0], id: false, trim: &[] },
+ KitCall { name: ".add_prompt", args: &[1, 2], id: false, trim: &[] },
+ // every `Window`, `Confirm` and `Panel` action row ends in the kit footer
+ KitCall { name: ".actions", args: &[0, 1, 2], id: false, trim: &[] },
+ KitCall { name: "removable_header", args: &[1], id: false, trim: &[] },
+ KitCall { name: "bin_button", args: &[1], id: false, trim: &[] },
+ // menu.rs and search.rs; `CommandSearch::heading` passes its label to `tr`, an id.
+ KitCall { name: "Menu::heading", args: &[1], id: false, trim: &[] },
+ KitCall { name: "MenuItem::new", args: &[1], id: false, trim: &[] },
+ KitCall { name: "CommandSearch::heading", args: &[1], id: true, trim: &[] },
+ ];
+
+ /// A struct field the kit translates when it draws the value: `Footer { apply }`
+ /// (actions.rs:116), `PairButton { label }` (actions.rs:217), `PopupOption { kind }`
+ /// (choice.rs:379) and `WindowPage { label }` (panel.rs:561, an id).
+ struct KitField {
+ owner: &'static str,
+ field: &'static str,
+ id: bool,
+ }
+
+ const KIT_FIELDS: &[KitField] = &[
+ KitField { owner: "Footer", field: "apply", id: false },
+ KitField { owner: "PairButton", field: "label", id: false },
+ KitField { owner: "PopupOption", field: "kind", id: false },
+ KitField { owner: "WindowPage", field: "label", id: true },
+ ];
+
+ /// A text carrier outside `ui_kit/` that hands its label to the kit: `context_menu::button`
+ /// and `button_enabled` build a `MenuItem`, which draws `tr_label(label)` (menu.rs:210).
+ /// Resolved by the same origin rules as the kit: a `context_menu::…`/`crate::context_menu::…`
+ /// path, a `use` import, or a call inside `context_menu.rs` itself.
+ struct ModuleCall {
+ module: &'static str,
+ name: &'static str,
+ args: &'static [usize],
+ }
+
+ const MODULE_CALLS: &[ModuleCall] = &[
+ ModuleCall { module: "context_menu", name: "button", args: &[1] },
+ ModuleCall { module: "context_menu", name: "button_enabled", args: &[1] },
+ ];
+
+ /// The kit's modules: only these may sit between `ui_kit` and a translated function in a path.
+ const KIT_MODULES: &[&str] =
+ &["layout", "fields", "actions", "choice", "table", "menu", "metrics", "text", "panel", "reports", "search", "status", "radial"];
+
+ /// One leaf or glob of a `use` tree: the path it names (already made absolute against the
+ /// file's module) and, for a leaf, the local name it binds.
+ enum Import {
+ Leaf { path: Vec<String>, local: String, public: bool },
+ Glob { path: Vec<String> },
+ }
+
+ /// How one file's imports name the kit: function bindings, module bindings (`kit::row`,
+ /// `l::row`) and glob imports (`use crate::ui_kit::*`).
+ #[derive(Default)]
+ struct Names {
+ functions: BTreeMap<String, Target>,
+ modules: BTreeMap<String, Vec<String>>,
+ globs: Vec<Vec<String>>,
+ }
+
+ /// What a name or path resolves to: a kit function, or a text carrier in another module.
+ #[derive(Clone, Copy)]
+ enum Target {
+ Kit(&'static str),
+ Module(&'static ModuleCall),
+ }
+
+ /// What the crate's files say about the kit: the names each file imports from it, and the
+ /// public re-exports a module offers another (`dialogs::form_row` → `ui_kit::row`).
+ struct Context {
+ reexports: BTreeMap<Vec<String>, BTreeMap<String, Vec<String>>>,
+ imports: BTreeMap<std::path::PathBuf, Vec<Import>>,
+ }
+
+ impl Context {
+ fn new(files: &[(std::path::PathBuf, String)]) -> Self {
+ let mut imports = BTreeMap::new();
+ let mut reexports: BTreeMap<Vec<String>, BTreeMap<String, Vec<String>>> = BTreeMap::new();
+ for (path, source) in files {
+ let module = module_path(path);
+ let file_imports = parsed_imports(source, &module);
+ for import in &file_imports {
+ if let Import::Leaf { path: target, local, public: true } = import {
+ reexports.entry(module.clone()).or_default().insert(local.clone(), target.clone());
+ }
+ }
+ imports.insert(path.clone(), file_imports);
+ }
+ Self { reexports, imports }
+ }
+
+ /// How this file names the kit: bound functions, bound modules and glob imports.
+ fn names(&self, path: &std::path::Path) -> Names {
+ let mut names = Names::default();
+ for import in self.imports.get(path).into_iter().flatten() {
+ match import {
+ Import::Leaf { path: target, local, .. } => {
+ if let Some(found) = resolve_target(target, &self.reexports) {
+ names.functions.insert(local.clone(), found);
+ } else {
+ // Not a function target: the leaf may bind a module (`ui_kit as kit`).
+ names.modules.insert(local.clone(), target.clone());
+ }
+ }
+ Import::Glob { path } => names.globs.push(path.clone()),
+ }
+ }
+ names
+ }
+
+ fn inside_kit(&self, path: &std::path::Path) -> bool {
+ module_path(path).get(1).is_some_and(|module| module == "ui_kit")
+ }
+ }
+
+ /// The crate module path of a source file (`…/src/ui_kit/mod.rs` → `crate::ui_kit`).
+ fn module_path(path: &std::path::Path) -> Vec<String> {
+ let mut parts: Vec<String> = path.components().filter_map(|part| part.as_os_str().to_str().map(str::to_string)).collect();
+ let start = parts.iter().rposition(|part| part == "src").map_or(0, |at| at + 1);
+ let mut relative: Vec<String> = parts.split_off(start);
+ let file = relative.pop().unwrap_or_default();
+ let stem = file.strip_suffix(".rs").unwrap_or(&file).to_string();
+ let mut out = vec!["crate".to_string()];
+ out.extend(relative);
+ if !matches!(stem.as_str(), "lib" | "main" | "mod") {
+ out.push(stem);
+ }
+ out
+ }
+
+ /// The kit function or module text carrier a path names, following a module's public
+ /// re-exports (`crate::dialogs::form_row` → `crate::ui_kit::row`). Only a path through
+ /// `ui_kit` (or through a listed module) counts, so a same-named function elsewhere
+ /// (`ContentWidth::button`, `other::button`) stays out.
+ fn resolve_target(path: &[String], reexports: &BTreeMap<Vec<String>, BTreeMap<String, Vec<String>>>) -> Option<Target> {
+ let mut path = path.to_vec();
+ for _ in 0..4 {
+ let (name, module) = path.split_last()?;
+ if let Some(at) = module.iter().position(|segment| segment == "ui_kit")
+ && (module.len() == at + 1 || KIT_MODULES.contains(&module[at + 1].as_str()))
+ && let Some(kit) = free_kit(name)
+ {
+ return Some(Target::Kit(kit));
+ }
+ if let Some(call) = module_call(name, module) {
+ return Some(Target::Module(call));
+ }
+ path = reexports.get(module)?.get(name)?.clone();
+ }
+ None
+ }
+
+ /// The module text carrier `name` names, when the last segment of `module` is its module.
+ fn module_call(name: &str, module: &[String]) -> Option<&'static ModuleCall> {
+ MODULE_CALLS.iter().find(|call| call.name == name && module.last().is_some_and(|segment| segment == call.module))
+ }
+
+ /// Make a `use`/call path absolute against the module of the file it appears in:
+ /// `super::row` in `ui_kit/choice.rs` → `crate::ui_kit::row`, `self::x` → the file's own
+ /// module, `crate::…` unchanged.
+ fn normalize(module: &[String], path: &[String]) -> Vec<String> {
+ match path.first().map(String::as_str) {
+ Some("crate") => path.to_vec(),
+ Some("self") => {
+ let mut out = module.to_vec();
+ out.extend_from_slice(&path[1..]);
+ out
+ }
+ Some("super") => {
+ let supers = path.iter().take_while(|segment| segment.as_str() == "super").count();
+ let mut out = module.to_vec();
+ for _ in 0..supers {
+ out.pop();
+ }
+ out.extend_from_slice(&path[supers..]);
+ out
+ }
+ _ => path.to_vec(),
+ }
+ }
+
+ /// The target a qualified call names: through a module binding (`kit::row`, `l::row`) or a
+ /// path relative to the file's module (`super::row`, `super::actions::…`).
+ fn resolve_qualified(context: &Context, names: &Names, module: &[String], qualifier: &[String], name: &str) -> Option<Target> {
+ if let Some(bound) = qualifier.first().and_then(|first| names.modules.get(first)) {
+ let mut path = bound.clone();
+ path.extend_from_slice(&qualifier[1..]);
+ path.push(name.to_string());
+ if let Some(target) = resolve_target(&path, &context.reexports) {
+ return Some(target);
+ }
+ }
+ let mut path = normalize(module, qualifier);
+ path.push(name.to_string());
+ resolve_target(&path, &context.reexports)
+ }
+
+ /// A module text carrier called inside its own module (`button` in `context_menu.rs`).
+ fn module_inside(path: &std::path::Path, name: &str) -> Option<&'static ModuleCall> {
+ let module = module_path(path);
+ MODULE_CALLS.iter().find(|call| call.name == name && module.last().is_some_and(|segment| segment == call.module))
+ }
+
+ fn free_kit(name: &str) -> Option<&'static str> {
+ KIT_CALLS.iter().find(|call| call.name == name).map(|call| call.name)
+ }
+
+ /// A standalone snippet, as if it were the file `src/live.rs`, for the scanner tests.
+ fn literals(source: &str) -> Vec<(String, bool)> {
+ literals_with(source, &[])
+ }
+
+ /// [`literals`] with extra files beside the snippet (a module whose re-exports it imports).
+ fn literals_with(source: &str, extra: &[(&str, &str)]) -> Vec<(String, bool)> {
+ let snippet = std::path::PathBuf::from("src/live.rs");
+ let mut files = vec![(snippet.clone(), source.to_string())];
+ files.extend(extra.iter().map(|(path, source)| (std::path::PathBuf::from(path), (*source).to_string())));
+ literals_in(&Context::new(&files), &snippet, source)
+ }
+
+ /// [`literals`] for a snippet at a given crate path (for a file inside `ui_kit/`).
+ fn literals_at(path: &str, source: &str) -> Vec<(String, bool)> {
+ let path = std::path::PathBuf::from(path);
+ literals_in(&Context::new(&[(path.clone(), source.to_string())]), &path, source)
+ }
+
+ /// Every label and id literal in `source` as `(text, id-only)`.
+ fn literals_in(context: &Context, path: &std::path::Path, source: &str) -> Vec<(String, bool)> {
+ // A file the tokenizer refuses would otherwise pass unchecked.
+ let tokens = source.parse::<TokenStream>().expect("a UI source file tokenizes");
+ // Which `tr` the file means, read from its tokens (no comments) with the spacing removed.
+ let code: String = tokens.to_string().split_whitespace().collect();
+ let label_file = code.contains("fntr(text:&str)->&str") || code.contains("lettr=crate::i18n::tr_label;");
+ let id_file = code.contains("usecrate::i18n::tr;") || code.contains("lettr=crate::i18n::tr;") || imports_i18n_tr(&code);
+ let names = context.names(path);
+ let mut out = Vec::new();
+ scan(tokens.into_iter().collect(), label_file, id_file, &names, context, path, &mut out);
+ out
+ }
+
+ /// Walk `tokens`, recording each call's literal; recurse into groups and skip `#[cfg(test)]`.
+ fn scan(
+ tokens: Vec<TokenTree>,
+ label_file: bool,
+ id_file: bool,
+ names: &Names,
+ context: &Context,
+ path: &std::path::Path,
+ out: &mut Vec<(String, bool)>,
+ ) {
+ let inside_kit = context.inside_kit(path);
+ let module = module_path(path);
+ let mut i = 0;
+ while i < tokens.len() {
+ if cfg_test(&tokens, i) {
+ i = skip_item(&tokens, i + 2);
+ continue;
+ }
+ if let TokenTree::Ident(ident) = &tokens[i] {
+ let written = ident.to_string();
+ let previous = tokens.get(i.wrapping_sub(1));
+ let method = matches!(previous, Some(TokenTree::Punct(p)) if p.as_char() == '.');
+ let qualified = matches!(previous, Some(TokenTree::Punct(p)) if p.as_char() == ':');
+ let definition = matches!(previous, Some(TokenTree::Ident(id)) if id == "fn");
+ if !definition {
+ if method {
+ // A receiver's type is unknown here, so a method is read by its name
+ // alone: a known limit (a foreign `.actions(…)` would be read as well).
+ kit_method(&written, &tokens, i, out);
+ } else {
+ match written.as_str() {
+ // The dialogs' own `tr` wraps `tr_label`; an imported `i18n::tr` keeps its id semantics.
+ "tr" if !qualified => push(&tokens, i + 1, &[0], id_file && !label_file, &[], out),
+ "tr_label" => push(&tokens, i + 1, &[0], false, &[], out),
+ "SelInput" if is_path(&tokens, i, "new") => push(&tokens, i + 4, &[0], false, &[], out),
+ "i18n" if is_path(&tokens, i, "tr") => push(&tokens, i + 4, &[0], true, &[], out),
+ _ => {
+ // `Column::new`, `Menu::heading`, …: a type path, read by name (the
+ // same known limit as the methods).
+ kit_path(&written, &tokens, i, out);
+ // A free kit function counts from its origin only: called through
+ // `ui_kit::`, imported from `ui_kit` (or a module re-exporting it),
+ // or called inside `ui_kit/` itself.
+ let qualifier = qualifier(&tokens, i);
+ let resolved = if qualifier.is_empty() {
+ names
+ .functions
+ .get(&written)
+ .copied()
+ .or_else(|| {
+ // `use crate::ui_kit::*;` (or `use super::*;` in the kit)
+ // makes the kit's functions callable unqualified.
+ names.globs.iter().find_map(|glob| {
+ let mut path = glob.clone();
+ path.push(written.clone());
+ resolve_target(&path, &context.reexports)
+ })
+ })
+ .or_else(|| inside_kit.then(|| free_kit(&written)).flatten().map(Target::Kit))
+ .or_else(|| module_inside(path, &written).map(Target::Module))
+ } else {
+ resolve_qualified(context, names, &module, &qualifier, &written)
+ };
+ match resolved {
+ Some(Target::Kit(kit)) => kit_free(kit, &tokens, i, out),
+ Some(Target::Module(call)) => push(&tokens, i + 1, call.args, false, &[], out),
+ None => {}
+ }
+ }
+ }
+ }
+ kit_fields(&written, &tokens, i, out);
+ }
+ }
+ if let TokenTree::Group(group) = &tokens[i] {
+ scan(group.stream().into_iter().collect(), label_file, id_file, names, context, path, out);
+ }
+ i += 1;
+ }
+ }
+
+ /// Record the label literals of a method call (`.actions`, `.add_prompt`), read by name.
+ fn kit_method(written: &str, tokens: &[TokenTree], i: usize, out: &mut Vec<(String, bool)>) {
+ for call in KIT_CALLS {
+ if let Some(name) = call.name.strip_prefix('.')
+ && written == name
+ {
+ push(tokens, i + 1, call.args, call.id, call.trim, out);
+ }
+ }
+ }
+
+ /// Record the label literals of a type-path call (`Column::new`, `Menu::heading`), read by the
+ /// type's name — the same known limit as the methods.
+ fn kit_path(written: &str, tokens: &[TokenTree], i: usize, out: &mut Vec<(String, bool)>) {
+ for call in KIT_CALLS {
+ if let Some((ty, name)) = call.name.split_once("::")
+ && written == ty
+ && is_path(tokens, i, name)
+ {
+ push(tokens, i + 4, call.args, call.id, call.trim, out);
+ }
+ }
+ }
+
+ /// Record the label literals of a free kit call that `resolve_kit` resolved to `kit`.
+ fn kit_free(kit: &'static str, tokens: &[TokenTree], i: usize, out: &mut Vec<(String, bool)>) {
+ for call in KIT_CALLS.iter().filter(|call| call.name == kit) {
+ push(tokens, i + 1, call.args, call.id, call.trim, out);
+ }
+ }
+
+ /// The translated field of a struct literal the kit draws (`Footer { apply: Some("Apply") }`).
+ fn kit_fields(written: &str, tokens: &[TokenTree], i: usize, out: &mut Vec<(String, bool)>) {
+ let Some(TokenTree::Group(braces)) = tokens.get(i + 1) else { return };
+ if braces.delimiter() != Delimiter::Brace {
+ return;
+ }
+ for spec in KIT_FIELDS.iter().filter(|spec| spec.owner == written) {
+ for member in arguments(braces.stream().into_iter().collect()) {
+ if !matches!(member.first(), Some(TokenTree::Ident(name)) if *name == spec.field)
+ || !matches!(member.get(1), Some(TokenTree::Punct(p)) if p.as_char() == ':')
+ {
+ continue;
+ }
+ for literal in argument_literals(&member[2..]) {
+ out.push((literal, spec.id));
+ }
+ }
+ }
+ }
+
+ /// The module path before a call's name (`crate::ui_kit::row` → `["crate", "ui_kit"]`).
+ fn qualifier(tokens: &[TokenTree], i: usize) -> Vec<String> {
+ let mut out = Vec::new();
+ let mut k = i;
+ while k >= 3
+ && matches!(&tokens[k - 1], TokenTree::Punct(p) if p.as_char() == ':')
+ && matches!(&tokens[k - 2], TokenTree::Punct(p) if p.as_char() == ':')
+ {
+ match &tokens[k - 3] {
+ TokenTree::Ident(segment) => out.push(segment.to_string()),
+ _ => break,
+ }
+ k -= 3;
+ }
+ out.reverse();
+ out
+ }
+
+ /// Record the string literals that are argument `args` of the parenthesised group at `group`;
+ /// `trim` drops the leading indent of the positions the kit normalises at run time.
+ fn push(tokens: &[TokenTree], group: usize, args: &[usize], id_only: bool, trim: &[usize], out: &mut Vec<(String, bool)>) {
+ let Some(TokenTree::Group(g)) = tokens.get(group) else { return };
+ if g.delimiter() != Delimiter::Parenthesis {
+ return;
+ }
+ let arguments = arguments(g.stream().into_iter().collect());
+ for &arg in args {
+ for value in arguments.get(arg).map_or_else(Vec::new, |tokens| argument_literals(tokens)) {
+ out.push((if trim.contains(&arg) { value.trim_start().to_string() } else { value }, id_only));
+ }
+ }
+ }
+
+ /// Split a call's or a struct literal's tokens at its top-level commas. Nested calls, closures,
+ /// blocks and lists are single groups, so their commas stay inside the member they belong to.
+ fn arguments(tokens: Vec<TokenTree>) -> Vec<Vec<TokenTree>> {
+ let mut out = vec![Vec::new()];
+ for token in tokens {
+ if matches!(&token, TokenTree::Punct(p) if p.as_char() == ',') {
+ out.push(Vec::new());
+ } else if let Some(argument) = out.last_mut() {
+ argument.push(token);
+ }
+ }
+ out
+ }
+
+ /// The label literal of one argument: `"A"`, `&"A"`, `&r#"A"#`, `Some("A")`, or every entry
+ /// of a list (`&["A", "B"]`, `&mut [("A", a), ("B", b)]`). Anything else (a `match`, a
+ /// `format!`, a variable) has no single label to read and contributes nothing.
+ fn argument_literals(tokens: &[TokenTree]) -> Vec<String> {
+ let tokens: Vec<&TokenTree> = tokens
+ .iter()
+ .filter(|token| !matches!(token, TokenTree::Punct(p) if p.as_char() == '&') && !matches!(token, TokenTree::Ident(id) if id == "mut"))
+ .collect();
+ match tokens.as_slice() {
+ [TokenTree::Literal(lit)] => string_literal(lit).into_iter().collect(),
+ [TokenTree::Ident(some), TokenTree::Group(group)] if *some == "Some" && group.delimiter() == Delimiter::Parenthesis => {
+ argument_literals(&group.stream().into_iter().collect::<Vec<_>>())
+ }
+ [TokenTree::Group(group)] if group.delimiter() == Delimiter::Bracket => {
+ arguments(group.stream().into_iter().collect()).iter().filter_map(|entry| list_entry_literal(entry)).collect()
+ }
+ _ => Vec::new(),
+ }
+ }
+
+ /// One entry of a label list: `"A"` or the first literal of a tuple (`("A", &mut a)`).
+ fn list_entry_literal(tokens: &[TokenTree]) -> Option<String> {
+ match tokens {
+ [TokenTree::Literal(lit)] => string_literal(lit),
+ [TokenTree::Group(group)] if group.delimiter() == Delimiter::Parenthesis => match group.stream().into_iter().next() {
+ Some(TokenTree::Literal(lit)) => string_literal(&lit),
+ _ => None,
+ },
+ _ => None,
+ }
+ }
+
+ fn string_literal(lit: &proc_macro2::Literal) -> Option<String> {
+ syn::parse_str::<syn::LitStr>(&lit.to_string()).ok().map(|text| text.value())
+ }
+
+ /// Every `use` declaration in `source` as its leaves and globs, with paths made absolute
+ /// against the module `module` of the file.
+ fn parsed_imports(source: &str, module: &[String]) -> Vec<Import> {
+ let mut out = Vec::new();
+ if let Ok(tokens) = source.parse::<TokenStream>() {
+ collect_imports(tokens.into_iter().collect(), module, &mut out);
+ }
+ out
+ }
+
+ fn collect_imports(tokens: Vec<TokenTree>, module: &[String], out: &mut Vec<Import>) {
+ let mut i = 0;
+ while i < tokens.len() {
+ if cfg_test(&tokens, i) {
+ i = skip_item(&tokens, i + 2);
+ continue;
+ }
+ if matches!(&tokens[i], TokenTree::Ident(id) if id == "use") {
+ let public = matches!(tokens.get(i.wrapping_sub(1)), Some(TokenTree::Ident(id)) if id == "pub")
+ || matches!(tokens.get(i.wrapping_sub(1)), Some(TokenTree::Group(g)) if g.delimiter() == Delimiter::Parenthesis)
+ && matches!(tokens.get(i.wrapping_sub(2)), Some(TokenTree::Ident(id)) if id == "pub");
+ let mut j = i + 1;
+ let mut tree = Vec::new();
+ while j < tokens.len() && !matches!(&tokens[j], TokenTree::Punct(p) if p.as_char() == ';') {
+ tree.push(tokens[j].clone());
+ j += 1;
+ }
+ use_tree(&tree, &[], module, public, out);
+ i = j;
+ }
+ if let TokenTree::Group(group) = &tokens[i] {
+ collect_imports(group.stream().into_iter().collect(), module, out);
+ }
+ i += 1;
+ }
+ }
+
+ /// Solve one `use` tree: a path with nested `{…}` groups, `as` aliases and `*` globs.
+ fn use_tree(tokens: &[TokenTree], prefix: &[String], module: &[String], public: bool, out: &mut Vec<Import>) {
+ let mut path = prefix.to_vec();
+ let mut local = None;
+ let mut i = 0;
+ while i < tokens.len() {
+ match &tokens[i] {
+ TokenTree::Ident(id) if id == "as" => {
+ if let Some(TokenTree::Ident(alias)) = tokens.get(i + 1) {
+ local = Some(alias.to_string());
+ }
+ i += 2;
+ continue;
+ }
+ TokenTree::Ident(id) => path.push(id.to_string()),
+ TokenTree::Punct(p) if p.as_char() == '*' => {
+ out.push(Import::Glob { path: normalize(module, &path) });
+ return;
+ }
+ TokenTree::Group(group) if group.delimiter() == Delimiter::Brace => {
+ for part in arguments(group.stream().into_iter().collect()) {
+ use_tree(&part, &path, module, public, out);
+ }
+ return;
+ }
+ _ => {}
+ }
+ i += 1;
+ }
+ if path.is_empty() {
+ return;
+ }
+ let last = path.last().cloned().unwrap_or_default();
+ if last == "self" {
+ // `use crate::ui_kit::{self, …}` binds the module itself.
+ let target = normalize(module, &path[..path.len() - 1]);
+ let local = local.unwrap_or_else(|| target.last().cloned().unwrap_or_default());
+ out.push(Import::Leaf { path: target, local, public });
+ } else {
+ let target = normalize(module, &path);
+ out.push(Import::Leaf { path: target, local: local.unwrap_or(last), public });
+ }
+ }
+
+ /// The files a source file includes as *external* test modules (`#[cfg(test)] mod gallery;`),
+ /// resolved like rustc: `name.rs` or `name/mod.rs` in the module directory, or a `#[path]` file
+ /// relative to the declaring file. An inline `#[cfg(test)] mod tests { … }` includes no file.
+ fn test_module_files(declaring: &std::path::Path, source: &str) -> Vec<std::path::PathBuf> {
+ let mut out = Vec::new();
+ if let Ok(tokens) = source.parse::<TokenStream>() {
+ collect_test_files(declaring, tokens.into_iter().collect(), &mut out);
+ }
+ out
+ }
+
+ fn collect_test_files(declaring: &std::path::Path, tokens: Vec<TokenTree>, out: &mut Vec<std::path::PathBuf>) {
+ let mut i = 0;
+ while i < tokens.len() {
+ if cfg_test(&tokens, i) {
+ // Only the annotated item counts. Further attributes and a `pub` may sit between
+ // `#[cfg(test)]` and an external `mod name;`; a `fn`, a `struct` or an inline
+ // `mod name { … }` includes no file (and a following `mod panel;` is production).
+ let mut k = i + 2;
+ let mut attribute = None;
+ loop {
+ if let (Some(TokenTree::Punct(hash)), Some(TokenTree::Group(group))) = (tokens.get(k), tokens.get(k + 1))
+ && hash.as_char() == '#'
+ && group.delimiter() == Delimiter::Bracket
+ {
+ let inner: Vec<TokenTree> = group.stream().into_iter().collect();
+ if let [TokenTree::Ident(id), TokenTree::Punct(p), TokenTree::Literal(lit)] = inner.as_slice()
+ && id == "path"
+ && p.as_char() == '='
+ && let Some(text) = string_literal(lit)
+ {
+ attribute = Some(text);
+ }
+ k += 2;
+ continue;
+ }
+ if let Some(TokenTree::Ident(vis)) = tokens.get(k)
+ && vis == "pub"
+ {
+ k += if matches!(tokens.get(k + 1), Some(TokenTree::Group(group)) if group.delimiter() == Delimiter::Parenthesis) {
+ 2
+ } else {
+ 1
+ };
+ continue;
+ }
+ break;
+ }
+ if matches!(tokens.get(k), Some(TokenTree::Ident(id)) if id == "mod")
+ && let Some(TokenTree::Ident(name)) = tokens.get(k + 1)
+ && matches!(tokens.get(k + 2), Some(TokenTree::Punct(p)) if p.as_char() == ';')
+ {
+ out.extend(module_file(declaring, &name.to_string(), attribute.as_deref()));
+ }
+ i = skip_item(&tokens, i + 2);
+ continue;
+ }
+ if let TokenTree::Group(group) = &tokens[i] {
+ collect_test_files(declaring, group.stream().into_iter().collect(), out);
+ }
+ i += 1;
+ }
+ }
+
+ /// The files a `mod name;` declaration may name, from the declaring file.
+ fn module_file(declaring: &std::path::Path, name: &str, attribute: Option<&str>) -> Vec<std::path::PathBuf> {
+ let dir = declaring.parent().unwrap_or(std::path::Path::new("."));
+ if let Some(path) = attribute {
+ // A `#[path]` on a non-inline module is relative to the declaring file's directory.
+ let mut candidates = vec![dir.join(path)];
+ if !path.ends_with(".rs") {
+ candidates.push(dir.join(path).join("mod.rs"));
+ }
+ return candidates;
+ }
+ let file = declaring.file_name().and_then(|name| name.to_str()).unwrap_or_default();
+ let module_dir =
+ if matches!(file, "mod.rs" | "lib.rs" | "main.rs") { dir.to_path_buf() } else { dir.join(declaring.file_stem().unwrap_or_default()) };
+ vec![module_dir.join(format!("{name}.rs")), module_dir.join(name).join("mod.rs")]
+ }
+
+ fn is_path(tokens: &[TokenTree], i: usize, name: &str) -> bool {
+ let colon = |k: usize| matches!(tokens.get(k), Some(TokenTree::Punct(p)) if p.as_char() == ':');
+ colon(i + 1) && colon(i + 2) && matches!(tokens.get(i + 3), Some(TokenTree::Ident(id)) if *id == name)
+ }
+
+ /// Whether `tokens[i]` starts the attribute `#[cfg(test)]`.
+ fn cfg_test(tokens: &[TokenTree], i: usize) -> bool {
+ matches!(tokens.get(i), Some(TokenTree::Punct(p)) if p.as_char() == '#')
+ && matches!(tokens.get(i + 1), Some(TokenTree::Group(g)) if g.delimiter() == Delimiter::Bracket
+ && g.stream().to_string().split_whitespace().collect::<String>() == "cfg(test)")
+ }
+
+ /// Past the item starting at `i`: its first `{…}` body or `;`. `#[cfg(test)]` on a single field,
+ /// array element or expression is not modelled (the UI sources have none).
+ fn skip_item(tokens: &[TokenTree], mut i: usize) -> usize {
+ while i < tokens.len()
+ && !matches!(&tokens[i], TokenTree::Group(g) if g.delimiter() == Delimiter::Brace)
+ && !matches!(&tokens[i], TokenTree::Punct(p) if p.as_char() == ';')
+ {
+ i += 1;
+ }
+ (i + 1).min(tokens.len())
+ }
+
+ /// Whether the file imports `tr` from `crate::i18n` inside a use list, from the use list in
+ /// `code` (spacing removed) under its own name.
+ fn imports_i18n_tr(code: &str) -> bool {
+ code.split_once("usecrate::i18n::{")
+ .is_some_and(|(_, rest)| rest.split_once('}').is_some_and(|(list, _)| list.split(',').any(|name| name == "tr")))
+ }
+
+ /// The names the hand-written kit probes import, exactly as a UI file would.
+ const KIT_IMPORTS: &str = concat!(
+ "use crate::ui_kit::{row, expr_row, hint_row, text_row, choice_row, section, section_count, ",
+ "multiline_text_field, dropdown, cell_editor, bounded_cell_editor, search_field, placement_field, ",
+ "library_cell, icon_button_at, icon_button_colored, footer, button, primary_button, ",
+ "wide_primary_button, action_menu, compact_button, icon_label_button, command_menu_button, ",
+ "checkbox_grid, options, checkbox_row, toggle_icon, removable_header, bin_button, ",
+ "Column, Menu, MenuItem, CommandSearch};"
+ );
+
+ /// A snippet as a UI file: the kit imports, then the call under test.
+ fn kit(source: &str) -> Vec<(String, bool)> {
+ literals(&format!("{KIT_IMPORTS}\nfn live() {{ {source} }}"))
+ }
+
+ fn texts(found: &[(String, bool)]) -> Vec<&str> {
+ found.iter().map(|(text, _)| text.as_str()).collect()
+ }
+
+ /// One call per kit function, written with the signature it really has. The guard must read
+ /// the label where the kit translates it — including the six `(ui, label, …)` actions whose
+ /// label is the second argument and `choice_row`'s options.
+ #[test]
+ fn every_kit_call_is_read_at_its_real_signature() {
+ let cases: &[(&str, &[&str])] = &[
+ ("row(ui, \"row\", |ui| {})", &["row"]),
+ ("expr_row(ui, \"expr_row\", value)", &["expr_row"]),
+ ("hint_row(ui, \"hint_row\", value, hint)", &["hint_row"]),
+ ("text_row(ui, \"text_row\", value, hint)", &["text_row"]),
+ (
+ "choice_row(ui, \"choice_row\", id, selected, &[\"First option\", \"Second option\"])",
+ &["choice_row", "First option", "Second option"],
+ ),
+ ("section(ui, id, \"section\", true, |ui| {})", &["section"]),
+ ("section_count(ui, id, \"section_count\", true, Some(2), |ui| {})", &["section_count"]),
+ ("multiline_text_field(ui, \"multiline_text_field\", id, value)", &["multiline_text_field"]),
+ ("dropdown(ui, id, selected, &[\"dropdown option\"])", &["dropdown option"]),
+ ("cell_editor(ui, id, value, \"cell_editor\", invalid)", &["cell_editor"]),
+ ("bounded_cell_editor(ui, id, value, \"bounded_cell_editor\", invalid, limit)", &["bounded_cell_editor"]),
+ ("search_field(ui, id, value, \"search_field\")", &["search_field"]),
+ ("placement_field(ui, id, value, \"placement_field\")", &["placement_field"]),
+ ("library_cell(ui, id, value, \"library_cell\", |ui| {})", &["library_cell"]),
+ ("icon_button_at(ui, rect, icon, \"icon_button_at\")", &["icon_button_at"]),
+ ("icon_button_colored(ui, rect, icon, \"icon_button_colored\", None)", &["icon_button_colored"]),
+ ("footer(ui, \"footer ok\", \"footer cancel\", true, Footer::default())", &["footer ok", "footer cancel"]),
+ ("button(ui, \"button\", Button::Normal)", &["button"]),
+ ("primary_button(ui, \"primary_button\")", &["primary_button"]),
+ ("wide_primary_button(ui, \"wide_primary_button\")", &["wide_primary_button"]),
+ ("action_menu(ui, \"action_menu\", |ui| {})", &["action_menu"]),
+ ("compact_button(ui, glyph, \"compact_button\", true, false)", &["compact_button"]),
+ ("icon_label_button(ui, \"icon_label_button\", icon, true, false)", &["icon_label_button"]),
+ ("command_menu_button(ui, id, \"command_menu_button\", icon, shortcut, true)", &["command_menu_button"]),
+ ("checkbox_grid(ui, &mut [(\"checkbox_grid\", value)], 1)", &["checkbox_grid"]),
+ ("options(ui, id, &mut [(\"options\", value)])", &["options"]),
+ ("checkbox_row(ui, key, \"checkbox_row\", true)", &["checkbox_row"]),
+ ("toggle_icon(ui, row, \"toggle_icon\", selected, icon)", &["toggle_icon"]),
+ ("Column::new(\"Column::new\", 1.0)", &["Column::new"]),
+ ("table.add_prompt(ui, \"add_prompt\", \"add_prompt tooltip\")", &["add_prompt", "add_prompt tooltip"]),
+ ("window.actions(\"actions ok\", \"actions cancel\", Some(\"actions apply\"))", &["actions ok", "actions cancel", "actions apply"]),
+ ("removable_header(ui, \"removable_header\")", &["removable_header"]),
+ ("bin_button(ui, \"bin_button\")", &["bin_button"]),
+ ("Menu::heading(ui, \"Menu::heading\")", &["Menu::heading"]),
+ ("MenuItem::new(id, \"MenuItem::new\", icon)", &["MenuItem::new"]),
+ ];
+ for (call, expected) in cases {
+ assert_eq!(texts(&kit(call)), *expected, "{call}");
+ }
+ assert_eq!(kit("CommandSearch::heading(ui, \"search.commands\", 3)"), [("search.commands".to_string(), true)]);
+ }
+
+ /// `Footer { apply }` is drawn (and translated) by the kit footer (actions.rs:108–116).
+ #[test]
+ fn a_footer_apply_label_is_found() {
+ let source = "footer(ui, \"OK\", \"Cancel\", true, Footer { apply: Some(\"Review apply\"), ..Default::default() })";
+ assert_eq!(texts(&kit(source)), ["OK", "Cancel", "Review apply"]);
+ }
+
+ /// `PairButton { label }` is drawn translated by `button_pair` (actions.rs:217).
+ #[test]
+ fn a_pair_button_label_is_found() {
+ let source = "button_pair(ui, key, [false, false], [PairButton { key: \"a\", label: \"Look At\", icon: None }, \
+ PairButton { key: \"b\", label: \"Slice\", icon: None }])";
+ assert_eq!(texts(&kit(source)), ["Look At", "Slice"]);
+ }
+
+ /// `PopupOption { kind }` is drawn translated in the completion popup (choice.rs:379).
+ #[test]
+ fn a_popup_option_kind_is_found() {
+ let source = "popup_list(ctx, id, anchor, 0, &[PopupOption { text: \"t\", detail: \"d\", kind: \"Parameter\", color }], hint)";
+ assert_eq!(kit(source), [("Parameter".to_string(), false)]);
+ }
+
+ /// A preferences page's `label` reaches `tr`, an id (panel.rs:561).
+ #[test]
+ fn a_window_page_label_is_an_id() {
+ let source = "const PAGES: [WindowPage<App>; 1] = [WindowPage { icon: \"settings\", label: \"ui.general\", scroll: true }];";
+ assert_eq!(literals(source), [("ui.general".to_string(), true)]);
+ }
+
+ /// An inline `#[cfg(test)] mod … { … }` is skipped where it stands and excludes no file.
+ #[test]
+ fn an_inline_test_module_does_not_exclude_a_file() {
+ let declaring = std::path::Path::new("/crate/src/ui_kit/mod.rs");
+ assert!(test_module_files(declaring, "#[cfg(test)] mod panel { fn helper() {} }").is_empty());
+ assert_eq!(
+ test_module_files(declaring, "#[cfg(test)] mod gallery;"),
+ [std::path::PathBuf::from("/crate/src/ui_kit/gallery.rs"), std::path::PathBuf::from("/crate/src/ui_kit/gallery/mod.rs")]
+ );
+ }
+
+ /// Only the item `#[cfg(test)]` annotates counts: a following production `mod panel;` is not
+ /// a test file (the old search ran past the test function).
+ #[test]
+ fn a_test_function_does_not_exclude_a_following_module() {
+ let declaring = std::path::Path::new("/crate/src/ui_kit/mod.rs");
+ assert!(test_module_files(declaring, "#[cfg(test)] fn helper() {}\nmod panel;").is_empty());
+ }
+
+ /// A test module with a `#[path]` attribute is still resolved (and excluded).
+ #[test]
+ fn a_test_module_with_a_path_attribute_is_still_excluded() {
+ let files = test_module_files(std::path::Path::new("/crate/src/ui_kit/mod.rs"), "#[cfg(test)] #[path = \"x_tests.rs\"] mod x_tests;");
+ assert_eq!(files, [std::path::PathBuf::from("/crate/src/ui_kit/x_tests.rs")]);
+ }
+
+ /// A `#[path]` attribute resolves relative to the declaring file's directory.
+ #[test]
+ fn a_path_attribute_resolves_beside_the_declaring_file() {
+ let files = test_module_files(std::path::Path::new("/crate/src/ui_kit/layout.rs"), "#[cfg(test)] #[path = \"layout_tests.rs\"] mod tests;");
+ assert_eq!(files, [std::path::PathBuf::from("/crate/src/ui_kit/layout_tests.rs")]);
+ }
+
+ /// `row` reaches the dialogs as `form_row`; the alias must not hide a label.
+ #[test]
+ fn a_kit_function_imported_under_an_alias_is_found() {
+ let source = "use crate::ui_kit::{field, row as form_row}; fn live() { form_row(ui, \"missing\", |ui| {}); }";
+ assert_eq!(literals(source), [("missing".to_string(), false)]);
+ }
+
+ /// A plain `use … as …` binds the kit function too.
+ #[test]
+ fn a_plain_import_alias_is_found() {
+ let source = "use crate::ui_kit::row as custom_row; fn live() { custom_row(ui, \"missing\", |ui| {}); }";
+ assert_eq!(literals(source), [("missing".to_string(), false)]);
+ }
+
+ /// A nested `use` group binds `layout::row` under its alias.
+ #[test]
+ fn a_nested_import_alias_is_found() {
+ let source = "use crate::ui_kit::{layout::{row as r}, field}; fn live() { r(ui, \"missing\", |ui| {}); }";
+ assert_eq!(literals(source), [("missing".to_string(), false)]);
+ }
+
+ /// An alias belongs to its file: the same name in another file is no kit call.
+ #[test]
+ fn an_alias_in_another_file_does_not_apply() {
+ assert_eq!(
+ literals("use crate::ui_kit::row as custom_row; fn live() { custom_row(ui, \"in file\", |ui| {}); }"),
+ [("in file".to_string(), false)]
+ );
+ assert!(literals("fn live() { custom_row(ui, \"other file\", |ui| {}); }").is_empty());
+ }
+
+ /// `dialogs` re-exports `row` as `form_row`; importing that name still names the kit.
+ #[test]
+ fn a_reexported_kit_name_is_followed() {
+ let source = "use crate::dialogs::form_row; fn live() { form_row(ui, \"missing\", |ui| {}); }";
+ assert_eq!(
+ literals_with(source, &[("src/dialogs.rs", "pub(crate) use crate::ui_kit::{field, row as form_row};")]),
+ [("missing".to_string(), false)]
+ );
+ }
+
+ /// A free function of another module is no kit call, even when it is named `row`.
+ #[test]
+ fn a_free_function_from_another_module_is_not_a_kit_call() {
+ assert!(literals("fn live() { other::row(ui, \"Not a kit label\", |ui| {}); }").is_empty());
+ }
+
+ /// `use crate::ui_kit as kit;` keeps the module binding for qualified calls.
+ #[test]
+ fn a_kit_module_import_binds_qualified_calls() {
+ assert_eq!(literals("use crate::ui_kit as kit; fn f() { kit::row(ui, \"Missing\", |ui| {}); }"), [("Missing".to_string(), false)]);
+ assert_eq!(literals("use crate::ui_kit::layout as l; fn f() { l::row(ui, \"Missing\", |ui| {}); }"), [("Missing".to_string(), false)]);
+ }
+
+ /// A glob import of the kit makes its functions callable unqualified.
+ #[test]
+ fn a_kit_glob_import_binds_unqualified_calls() {
+ assert_eq!(literals("use crate::ui_kit::*; fn f() { row(ui, \"Missing\", |ui| {}); }"), [("Missing".to_string(), false)]);
+ }
+
+ /// A relative alias import in a kit file resolves against the file's module path.
+ #[test]
+ fn a_relative_alias_import_is_resolved() {
+ let source = "use super::{row as custom_row}; fn f() { custom_row(ui, \"Missing\", |ui| {}); }";
+ assert_eq!(literals_at("src/ui_kit/choice.rs", source), [("Missing".to_string(), false)]);
+ }
+
+ /// A glob from another module does not make a same-named function a kit call.
+ #[test]
+ fn a_foreign_glob_import_is_not_a_kit_call() {
+ assert!(literals("use crate::other::*; fn f() { row(ui, \"X\", |ui| {}); }").is_empty());
+ }
+
+ /// A call through the kit's own path is a kit call without an import.
+ #[test]
+ fn a_kit_path_through_ui_kit_is_found() {
+ assert_eq!(literals("fn live() { ui_kit::row(ui, \"missing\", |ui| {}); }"), [("missing".to_string(), false)]);
+ }
+
+ /// A call inside `ui_kit/` counts without an import, as `ui_kit/choice.rs` calls `section`.
+ #[test]
+ fn a_call_inside_the_kit_is_found() {
+ let source = "fn options(ui: &mut Ui, id: &str, items: &mut [(&str, &mut bool)]) { section(ui, id, \"missing\", true, |ui| {}); }";
+ assert_eq!(literals_at("src/ui_kit/choice.rs", source), [("missing".to_string(), false)]);
+ }
+
+ /// Only the row label is normalised at run time (`sized_row`); everything else keeps its spaces.
+ #[test]
+ fn only_row_labels_are_trimmed() {
+ assert_eq!(kit("expr_row(ui, \" Minimum\", value)"), [("Minimum".to_string(), false)]);
+ assert_eq!(literals("fn live() { tr_label(\" Radius\"); }"), [(" Radius".to_string(), false)]);
+ assert_eq!(kit("dropdown(ui, id, selected, &[\" Option\"])"), [(" Option".to_string(), false)]);
+ assert_eq!(
+ kit("choice_row(ui, \" Label\", id, selected, &[\" Option\"])"),
+ [("Label".to_string(), false), (" Option".to_string(), false)]
+ );
+ }
+
+ /// The reference cases from the review, kept as tests of the token scanner.
+ #[test]
+ fn ordinary_and_multiline_row_calls_are_found() {
+ assert_eq!(literals("fn live() { row_label(\n ui, \n\"missing\"); }").len(), 0);
+ assert_eq!(kit("row(\n ui, \n\"missing\", |ui| {});").len(), 1);
+ }
+
+ #[test]
+ fn cfg_test_function_with_lifetime_preserves_production() {
+ let found = literals("#[cfg(test)] fn helper<'a>(x: &'a str) { let c = '}'; } fn live() { tr_label(\"missing\"); }");
+ assert_eq!(found.len(), 1);
+ assert_eq!(found[0].0, "missing");
+ }
+
+ #[test]
+ fn multiline_bare_tr_is_found() {
+ let found = literals("use crate::i18n::tr; fn live() { tr(\n\"missing\"); }");
+ assert_eq!(found.len(), 1);
+ assert!(found[0].1, "tr imported from crate::i18n is an id");
+ }
+
+ #[test]
+ fn raw_label_is_found() {
+ assert_eq!(literals(r##"fn live() { tr_label(r#"missing"#); }"##).len(), 1);
+ }
+
+ #[test]
+ fn comments_are_ignored() {
+ assert_eq!(literals("// tr_label(\"missing\")\nfn live() {}").len(), 0);
+ }
+
+ #[test]
+ fn raw_string_in_test_function_preserves_production() {
+ let s = r###"#[cfg(test)] fn helper() { let s = r#"" { "#; } fn live() { tr_label("missing"); }"###;
+ assert_eq!(literals(s).len(), 1);
+ }
+
+ #[test]
+ fn cfg_marker_in_comment_preserves_production() {
+ assert_eq!(literals("// #[cfg(test)]\nfn live() { tr_label(\"missing\"); }").len(), 1);
+ }
+
+ #[test]
+ fn decoded_escape_matches_catalog_text() {
+ assert_eq!(literals(r#"tr_label("Say \"hello\"")"#)[0].0, "Say \"hello\"");
+ }
+
+ #[test]
+ fn a_call_inside_a_macro_is_found() {
+ assert_eq!(literals("fn live() { format!(\"{}\", tr_label(\"missing\")); }").len(), 1);
+ }
+
+ #[test]
+ fn a_row_label_after_a_longer_first_argument_is_found() {
+ assert_eq!(
+ kit("row(&mut ui, \"missing\", |ui| {}); row(self.ui, \" other\", |ui| {});"),
+ [("missing".to_string(), false), ("other".to_string(), false)]
+ );
+ }
+
+ /// `context_menu::button` hands its label to `MenuItem::new` → `tr_label` (menu.rs:210); all
+ /// three origins count: the `crate::context_menu::…` path, a `use` import and a call inside
+ /// `context_menu.rs` itself.
+ #[test]
+ fn a_context_menu_button_label_is_found() {
+ assert_eq!(
+ literals("fn live() { crate::context_menu::button(ui, \"Add to New Folder\", \"folder\"); }"),
+ [("Add to New Folder".to_string(), false)]
+ );
+ assert_eq!(
+ literals("use crate::context_menu::button; fn live() { button(ui, \"Remove from Folder\", \"folder\"); }"),
+ [("Remove from Folder".to_string(), false)]
+ );
+ assert_eq!(
+ literals_at("src/context_menu.rs", "fn f() { button(ui, \"Roll Back Here\", \"history\"); }"),
+ [("Roll Back Here".to_string(), false)]
+ );
+ }
+
+ /// `context_menu::button_enabled` takes the same label at the same position.
+ #[test]
+ fn a_context_menu_button_enabled_label_is_found() {
+ assert_eq!(
+ literals("fn live() { context_menu::button_enabled(ui, \"Rename Feature\", \"rename\", enabled); }"),
+ [("Rename Feature".to_string(), false)]
+ );
+ }
+
+ /// Another module's `button(…)` is still no text carrier, with or without a qualifier.
+ #[test]
+ fn a_foreign_button_is_still_not_a_text_carrier() {
+ assert!(literals("fn live() { other::button(ui, \"Not a label\", icon); }").is_empty());
+ assert!(literals("fn live() { button(ui, \"Not a label\", icon); }").is_empty());
+ }
+
+ /// `ui_kit::row_label(ui)` only reads the row's accessibility tag: it takes no literal, so the
+ /// guard must not choke on it (the dialogs' own `row_label(ui, text)` is gone).
+ #[test]
+ fn reading_the_row_label_takes_no_literal() {
+ assert_eq!(literals("fn live() { ui_kit::row_label(ui); row_label(ui); }").len(), 0);
+ }
+
+ #[test]
+ fn a_comment_or_spacing_does_not_change_which_tr_a_file_means() {
+ let id = [("Preferences".to_string(), true)];
+ assert_eq!(literals("// fn tr(text: &str) -> &str\nuse crate::i18n::tr;\nfn live() { tr(\"Preferences\"); }"), id);
+ assert_eq!(literals("use crate :: i18n :: tr;\nfn live() { tr(\"Preferences\"); }"), id);
+ assert_eq!(literals("use crate::i18n::{format, tr};\nfn live() { tr(\"Preferences\"); }"), id);
+ assert_eq!(literals("fn live() { let tr = crate::i18n::tr; tr(\"Preferences\"); }"), id);
+ }
}
diff --git a/crates/ui-egui/src/i18n_ui_tests.rs b/crates/ui-egui/src/i18n_ui_tests.rs
index fe4343ff08..952d90d246 100644
--- a/crates/ui-egui/src/i18n_ui_tests.rs
+++ b/crates/ui-egui/src/i18n_ui_tests.rs
@@ -292,3 +292,17 @@ fn continuity_gap_and_sheet_metal_gap_are_separate_messages() {
assert_eq!(locale.text("ui.sheet_gap"), sheet, "{lang}");
}
}
+
+/// The reference labels of the cataloguing fix: a label passed as text (`Cylindrical face`) and an
+/// id (`thread.iso_metric`).
+#[test]
+fn newly_catalogued_dialog_labels_show_in_german() {
+ let mut h = Harness::new();
+ h.app.preferences.language = "de".into();
+ h.app.home.open = false;
+ h.call("ui.start", json!({"command":"solid.thread"}));
+ h.frames(3);
+ assert!(h.widget("Zylindrische Fläche").is_some(), "the Cylindrical face row must be translated");
+ assert!(h.widget("ISO metrisch").is_some(), "the thread.iso_metric label must be translated");
+ assert!(h.widget("ISO metric").is_none(), "the label must not fall back to English");
+}
diff --git a/crates/ui-egui/src/ui_kit/layout.rs b/crates/ui-egui/src/ui_kit/layout.rs
index 677bfdb24e..aa1c32f3b7 100644
--- a/crates/ui-egui/src/ui_kit/layout.rs
+++ b/crates/ui-egui/src/ui_kit/layout.rs
@@ -86,12 +86,15 @@ pub(super) fn sized_row<R>(ui: &mut Ui, text: &str, height: f32, control: impl F
let t = Tokens::get();
let width = dimension(ui.available_width());
let (rect, _) = ui.allocate_exact_size(vec2(width, height), egui::Sense::hover());
+ // A nested row (`" Of"`) lines up under the one above: the lookup uses the text without its
+ // indent and the indent stays in front of the translation. The `LABEL` tag keeps the original.
+ let shown = indented_label(text);
+ // Measuring takes the original text and prepares it the same way, so column and row agree.
let label_width = label_column(ui, text, width);
let label_rect = egui::Rect::from_min_size(rect.min, vec2(label_width, rect.height()));
ui.scope_builder(egui::UiBuilder::new().max_rect(label_rect).layout(egui::Layout::left_to_right(egui::Align::Center)), |ui| {
// Left aligned in the label column, as in the design.
- ui.add(egui::Label::new(RichText::new(crate::i18n::tr_label(text)).size(t.font_label).color(t.dialog_label)).truncate())
- .on_hover_text(crate::i18n::tr_label(text));
+ ui.add(egui::Label::new(RichText::new(shown.clone()).size(t.font_label).color(t.dialog_label)).truncate()).on_hover_text(shown);
});
let control_rect = egui::Rect::from_min_max(egui::pos2((label_rect.right() + label_gap(ui, width)).min(rect.right()), rect.top()), rect.max);
let result = ui
diff --git a/crates/ui-egui/src/ui_kit/metrics.rs b/crates/ui-egui/src/ui_kit/metrics.rs
index 3d2b3ab6bd..7755238294 100644
--- a/crates/ui-egui/src/ui_kit/metrics.rs
+++ b/crates/ui-egui/src/ui_kit/metrics.rs
@@ -27,10 +27,19 @@ pub(super) const LABEL_ACTIONS_SHARE: f32 = 0.45;
/// Widest a label column may grow, as a multiple of `form_label_width`.
const LABEL_COLUMN_MAX: f32 = 1.6;
+/// A label as drawn: the leading indent kept, the text itself translated (a nested row such as
+/// `" Of"` lines up under the one above and still translates). Measuring (`label_width`) and the
+/// row label (`sized_row`) both prepare their text with this, so a label is translated exactly
+/// once and the label column and the captions line up on the same text.
+pub(super) fn indented_label(text: &str) -> String {
+ let indent = text.len() - text.trim_start().len();
+ format!("{}{}", &text[..indent], crate::i18n::tr_label(text.trim_start()))
+}
+
/// Measured width of a label in the form label font. Tokens: `font_label, dialog_label`.
pub(super) fn label_width(ui: &Ui, text: &str) -> f32 {
let t = Tokens::get();
- ui.painter().layout_no_wrap(crate::i18n::tr_label(text).to_string(), egui::FontId::proportional(t.font_label), t.dialog_label).size().x.ceil()
+ ui.painter().layout_no_wrap(indented_label(text), egui::FontId::proportional(t.font_label), t.dialog_label).size().x.ceil()
}
/// Minimum content widths for table controls, including their token/native control metrics.
@@ -121,3 +130,19 @@ pub(super) fn label_gap(ui: &Ui, width: f32) -> f32 {
t.space_8
}
}
+
+#[cfg(test)]
+mod label_tests {
+ use super::indented_label;
+
+ /// `label_width` and `sized_row` share `indented_label`, so a label is translated once. German
+ /// `Profiles` is `Profile`, which is itself an English key that would translate again to
+ /// `Profil`; the row must show `Profile`, not the second translation.
+ #[test]
+ fn a_label_is_translated_once() {
+ let _de = crate::i18n::scope("de");
+ assert_eq!(indented_label("Profiles"), "Profile");
+ assert_eq!(indented_label(" Profiles"), " Profile");
+ assert_eq!(indented_label("Profile"), "Profil");
+ }
+}