-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtranslate-parameters.ps1
More file actions
126 lines (118 loc) · 31.1 KB
/
translate-parameters.ps1
File metadata and controls
126 lines (118 loc) · 31.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
$jsonPath = "data\marlin-commands.json"
$content = Get-Content $jsonPath -Raw -Encoding UTF8
$json = $content | ConvertFrom-Json
# Dictionary of English -> German translations for parameter descriptions
$translations = @{
"An absolute or relative coordinate on the X axis (in current units)." = "Eine absolute oder relative Koordinate auf der X-Achse (in aktuellen Einheiten)."
"An absolute or relative coordinate on the Y axis (in current units)." = "Eine absolute oder relative Koordinate auf der Y-Achse (in aktuellen Einheiten)."
"An absolute or relative coordinate on the Z axis (in current units)." = "Eine absolute oder relative Koordinate auf der Z-Achse (in aktuellen Einheiten)."
"An absolute or relative coordinate on the A axis (in current units)." = "Eine absolute oder relative Koordinate auf der A-Achse (in aktuellen Einheiten)."
"An absolute or relative coordinate on the B axis (in current units)." = "Eine absolute oder relative Koordinate auf der B-Achse (in aktuellen Einheiten)."
"An absolute or relative coordinate on the C axis (in current units)." = "Eine absolute oder relative Koordinate auf der C-Achse (in aktuellen Einheiten)."
"An absolute or relative coordinate on the U axis (in current units)." = "Eine absolute oder relative Koordinate auf der U-Achse (in aktuellen Einheiten)."
"An absolute or relative coordinate on the V axis (in current units)." = "Eine absolute oder relative Koordinate auf der V-Achse (in aktuellen Einheiten)."
"An absolute or relative coordinate on the W axis (in current units)." = "Eine absolute oder relative Koordinate auf der W-Achse (in aktuellen Einheiten)."
"An absolute or relative coordinate on the E (extruder) axis (in current units). The E axis describes the position of the filament in terms of input to the extruder feeder." = "Eine absolute oder relative Koordinate auf der E-Achse (Extruder). Position des Filaments relativ zum Extruder-Eingang."
"Set the requested movement rate for this move and any following moves. As with other rate parameters this value is specified in current units per minute. By default this feedrate is interpreted according to the specification for LinuxCNC default state (trivial kinematics, CANON_XYZ feed reference mode, Units-Per-Minute mode). For details, refer to the LinuxCNC documentation." = "Setzt die Vorschubgeschwindigkeit (Feedrate) für diese und folgende Bewegungen (in Einheiten/Minute)."
"Target temperature (wait for cooling or heating)." = "Zieltemperatur (warten auf Aufheizen oder Abkühlen)."
"Target temperature (wait for heating only)." = "Zieltemperatur (nur auf Aufheizen warten)."
"Target temperature." = "Zieltemperatur."
"Proportional value" = "Proportional-Anteil (P-Wert)"
"Integral value" = "Integral-Anteil (I-Wert)"
"Derivative value" = "Ableitungs-Anteil (D-Wert)"
"Index (tool) number for the E axis. If not specified, the E0 extruder." = "Werkzeug-Index für die E-Achse. Standard ist E0."
"Tool index" = "Werkzeug-Index"
"Extruder index" = "Extruder-Index"
"Material preset index. Overrides S." = "Material-Voreinstellungs-Index. Überschreibt S."
"Fan index" = "Lüfter-Index"
"Fan speed (0-255)" = "Lüftergeschwindigkeit (0-255)"
"Duration in milliseconds" = "Dauer in Millisekunden"
"Duration in seconds" = "Dauer in Sekunden"
"Beep frequency" = "Piepton-Frequenz"
"Message string" = "Nachrichtentext"
"The position to set the current location to." = "Die Position, auf die der aktuelle Standort gesetzt wird."
"Set Macro to the given commands, separated by the pipe character." = "Makro auf die angegebenen Befehle setzen (getrennt durch Pipe |)."
"Movement feedrate for the tool-change." = "Bewegungsgeschwindigkeit für den Werkzeugwechsel."
"Specify movement in XY after the tool-change. (Default: allow)" = "Bewegung in XY nach Werkzeugwechsel festlegen. (Standard: erlauben)"
"Target extruder" = "Ziel-Extruder"
"An offset from the current Y position to use as the arc center" = "Ein Versatz von der aktuellen Y-Position zum Bogenmittelpunkt"
"An offset from the current X position to use as the arc center" = "Ein Versatz von der aktuellen X-Position zum Bogenmittelpunkt"
"The amount to extrude between the start point and end point" = "Menge an Material, die zwischen Start- und Endpunkt extrudiert wird"
"Target laser coolant temperature." = "Zieltemperatur für Laserkühlmittel."
"Amount of retraction for unload (negative)" = "Rückzugsmenge für Entladen (negativ)"
"Specify complete circles." = "Vollkreise spezifizieren."
"An optional message to display on the LCD" = "Eine optionale Nachricht für das LCD"
"A coordinate on the A axis" = "Eine Koordinate auf der A-Achse"
"Move the Z axis by this distance" = "Bewege die Z-Achse um diesen Abstand"
"Current for the E0 stepper" = "Strom für den E0-Stepper"
"Expire time, in seconds" = "Ablaufzeit in Sekunden"
"Expire time, in milliseconds" = "Ablaufzeit in Millisekunden"
"Target temperature (wait only when heating)." = "Zieltemperatur (nur auf Aufheizen warten)."
"Select the pin to set for all specified axes." = "Wähle den Pin für alle angegebenen Achsen."
"Target temperature" = "Zieltemperatur"
"X Position" = "X-Position"
"Solenoid index" = "Solenoid-Index"
"X axis absolute coordinate." = "X-Achse absolute Koordinate."
"Y axis absolute coordinate." = "Y-Achse absolute Koordinate."
"Z axis absolute coordinate." = "Z-Achse absolute Koordinate."
"Coordinate to move to on the X axis." = "Zielkoordinate auf der X-Achse."
"Coordinate to move to on the Y axis." = "Zielkoordinate auf der Y-Achse."
"Coordinate to move to on the Z axis." = "Zielkoordinate auf der Z-Achse."
"Feedrate" = "Vorschub"
"Feedrate." = "Vorschub."
"Feed rate" = "Vorschub"
"Retract length" = "Rückzugslänge"
"Retract speed" = "Rückzugsgeschwindigkeit"
"Prime length" = "Prime-Länge"
"Prime speed" = "Prime-geschwindigkeit"
"Pattern style selection" = "Muster-Auswahl"
"Radius of nozzle cleaning circle" = "Radius des Düsenreinigungs-Kreises"
"Number of repetitions of the pattern" = "Anzahl der Wiederholungen des Musters"
"Number of triangles in the zigzag pattern" = "Anzahl der Dreiecke im Zick-Zack-Muster"
"Include X motion when cleaning with limited axes. (Leave out X, Y, and Z to use all axes)" = "X-Bewegung beim Reinigen mit begrenzten Achsen einbeziehen."
"Include Z motion when cleaning with limited axes. (Leave out X, Y, and Z to use all axes)" = "Z-Bewegung beim Reinigen mit begrenzten Achsen einbeziehen."
"Set or report the current extruder or other tool" = "Setze oder berichte den aktuellen Extruder oder ein anderes Werkzeug"
}
# Regex replacements for variable parts
$regexTranslations = @(
@{ Pattern = "Monitor ([A-Z]) with the given displacement \(1 - 255mm\) on either side of the\s+current position\."; Replacement = "Überwache $1 mit der angegebenen Verschiebung (1-255mm) beidseitig der aktuellen Position." }
@{ Pattern = "Index for multiple steppers\. \(i\.e\., .*?\)\."; Replacement = "Index für Mehrfach-Stepper." }
@{ Pattern = "Current \(mA\) setting for ([A-Z0-9]+).*"; Replacement = "Strom (mA) Einstellung für $1." }
@{ Pattern = "An offset from the current ([A-Z]) position to use as the arc center"; Replacement = "Ein Versatz von der aktuellen $1-Position zum Bogenmittelpunkt" }
)
$count = 0
$total = 0
foreach ($cmd in $json.commands) {
# Translate overall command description if it matches
if ($cmd.desc -and $cmd.desc.en) {
$enCmd = $cmd.desc.en.Trim()
if ($translations.ContainsKey($enCmd)) {
$cmd.desc.de = $translations[$enCmd]
$count++
}
}
if ($cmd.params) {
foreach ($p in $cmd.params) {
if ($p.desc -and $p.desc.en) {
$enText = $p.desc.en.Trim()
if ($translations.ContainsKey($enText)) {
$p.desc.de = $translations[$enText]
$count++
}
else {
# Try Regex
foreach ($rt in $regexTranslations) {
if ($enText -match $rt.Pattern) {
$p.desc.de = $enText -replace $rt.Pattern, $rt.Replacement
$count++
break
}
}
}
$total++
}
}
}
}
Write-Host "Updated $count descriptions out of $total items checked." -ForegroundColor Green
$json | ConvertTo-Json -Depth 20 | Set-Content $jsonPath -Encoding UTF8