ipadm: translate to English, fix help alignment

- All ipadm-internal messages (usage, prompts, errors) are now English
- Usage text is built programmatically from a (left, desc) row list with
  computed column width instead of hand-aligned spaces, so it can't drift
  out of alignment again when rows are added/changed
- README's literal usage block updated to match; rest of the repo docs
  stay German
This commit is contained in:
2026-08-18 11:49:47 +02:00
parent 8591223aca
commit 1a39f54858
9 changed files with 137 additions and 99 deletions
+7 -7
View File
@@ -10,7 +10,7 @@ var hostnameRe = regexp.MustCompile(`^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])
func validateHostname(name string) error {
if !hostnameRe.MatchString(name) {
return fmt.Errorf("ungültiger Hostname %q (nur Buchstaben, Ziffern, Bindestrich, kein führender/abschließender Bindestrich, keine Domain)", name)
return fmt.Errorf("invalid hostname %q (letters, digits, hyphen only; no leading/trailing hyphen; no domain)", name)
}
return nil
}
@@ -26,23 +26,23 @@ func ip4ToUint32(ip net.IP) uint32 {
func validateIP(ip, lanCIDR, poolStart, poolEnd string) error {
parsed := net.ParseIP(ip)
if parsed == nil || parsed.To4() == nil {
return fmt.Errorf("ungültige IPv4-Adresse: %q", ip)
return fmt.Errorf("invalid IPv4 address: %q", ip)
}
_, cidr, err := net.ParseCIDR(lanCIDR)
if err != nil {
return fmt.Errorf("internes Problem: ungültiges LAN-CIDR %q: %w", lanCIDR, err)
return fmt.Errorf("internal error: invalid LAN CIDR %q: %w", lanCIDR, err)
}
if !cidr.Contains(parsed) {
return fmt.Errorf("IP %s liegt nicht im LAN-Netz %s", ip, lanCIDR)
return fmt.Errorf("IP %s is not inside LAN network %s", ip, lanCIDR)
}
start := net.ParseIP(poolStart)
end := net.ParseIP(poolEnd)
if start == nil || end == nil {
return fmt.Errorf("internes Problem: ungültiger DHCP-Pool %q-%q", poolStart, poolEnd)
return fmt.Errorf("internal error: invalid DHCP pool %q-%q", poolStart, poolEnd)
}
v, s, e := ip4ToUint32(parsed), ip4ToUint32(start), ip4ToUint32(end)
if v >= s && v <= e {
return fmt.Errorf("IP %s liegt im dynamischen DHCP-Pool (%s-%s) und ist für statische Reservierungen gesperrt", ip, poolStart, poolEnd)
return fmt.Errorf("IP %s is inside the dynamic DHCP pool (%s-%s) and is reserved, not allowed for static assignments", ip, poolStart, poolEnd)
}
return nil
}
@@ -55,7 +55,7 @@ func normalizeMAC(mac string) (string, error) {
}
hw, err := net.ParseMAC(mac)
if err != nil {
return "", fmt.Errorf("ungültige MAC-Adresse %q: %w", mac, err)
return "", fmt.Errorf("invalid MAC address %q: %w", mac, err)
}
return hw.String(), nil
}