diff --git a/README.md b/README.md index a05ca9d..0658dba 100644 --- a/README.md +++ b/README.md @@ -38,8 +38,8 @@ document: management/OOB IPs, VMs, topology labels, prefixes and IP addresses. All queries respect NetBox permissions (`.restrict(user, "view")`) — a technician only exports what they are allowed to see. -Open it via the **Customer doc** button on site, location, tenant and tenant -group pages, or via **Plugins → Customer documentation**. Output formats: +Open it via the **Customer Docs** button on site, location, tenant and tenant +group pages, or via **Plugins → Customer Documentation**. Output formats: **PDF**, **Word** and **HTML preview** (opens in a new tab). ## Compatibility @@ -47,6 +47,8 @@ group pages, or via **Plugins → Customer documentation**. Output formats: - NetBox `4.6.8` – `4.7.x` - Python `>=3.10` - System libraries for PDF and rack graphics in Word: Pango, Cairo +- Languages: English and German. The interface and the exported documents follow + the language set in the user's NetBox preferences. ## Installation diff --git a/netbox_customer_export/__init__.py b/netbox_customer_export/__init__.py index 5715091..3dc0c9c 100644 --- a/netbox_customer_export/__init__.py +++ b/netbox_customer_export/__init__.py @@ -1,10 +1,11 @@ +from django.utils.translation import gettext_lazy as _ from netbox.plugins import PluginConfig class CustomerExportConfig(PluginConfig): name = "netbox_customer_export" - verbose_name = "Kunden-Export" - description = "Kundendokumentation als PDF oder Word exportieren" + verbose_name = _("Customer Export") + description = _("Export customer documentation as PDF or Word") version = "0.11.0" author = "Claude" base_url = "customer-export" diff --git a/netbox_customer_export/blocks.py b/netbox_customer_export/blocks.py index e231df7..0d56fd7 100644 --- a/netbox_customer_export/blocks.py +++ b/netbox_customer_export/blocks.py @@ -3,6 +3,7 @@ import base64 from dataclasses import dataclass, field from django.utils.text import slugify +from django.utils.translation import gettext as _ EMPTY = "—" @@ -48,11 +49,11 @@ def P(text): def T(headers, rows): - return Block("table", headers=list(headers), rows=[[fmt(c) for c in r] for r in rows]) + return Block("table", headers=[str(h) for h in headers], rows=[[fmt(c) for c in r] for r in rows]) def KV(pairs, skip_empty=True): - rows = [[k, fmt(v)] for k, v in pairs if not (skip_empty and v in (None, "", [], EMPTY))] + rows = [[str(k), fmt(v)] for k, v in pairs if not (skip_empty and v in (None, "", [], EMPTY))] return Block("kv", rows=rows) @@ -84,7 +85,7 @@ def fmt(value): if value is None or value == "": return EMPTY if isinstance(value, bool): - return "Ja" if value else "Nein" + return _("Yes") if value else _("No") if isinstance(value, (list, tuple, set)) or hasattr(value, "all"): items = value.all() if hasattr(value, "all") else value return ", ".join(str(i) for i in items) or EMPTY diff --git a/netbox_customer_export/branding.py b/netbox_customer_export/branding.py index 0fa3e03..1fa61d6 100644 --- a/netbox_customer_export/branding.py +++ b/netbox_customer_export/branding.py @@ -6,10 +6,10 @@ from netbox.plugins import get_plugin_config PLUGIN = "netbox_customer_export" DEFAULT_BRANDING = { - "name": "Standard", + "name": "Default", "company_name": "", "logo_path": None, - "footer_text": "Vertraulich – nur für den internen Gebrauch des Kunden", + "footer_text": "Confidential – for the customer's internal use only", "primary_color": "1F4E79", # Überschriften, Tabellenköpfe "accent_color": "2E75B6", # Unterüberschriften "header_text_color": "FFFFFF", # Schrift im Tabellenkopf @@ -31,7 +31,7 @@ def _normalize(profile): for key in COLOR_KEYS: value = str(profile[key]).lstrip("#") if not _HEX.match(value): - raise ValueError(f"netbox_customer_export: {key}={profile[key]!r} ist keine Hex-Farbe (z.B. '1F4E79')") + raise ValueError(f"netbox_customer_export: {key}={profile[key]!r} is not a hex colour (e.g. '1F4E79')") profile[key] = value.upper() return profile diff --git a/netbox_customer_export/branding_views.py b/netbox_customer_export/branding_views.py index 396b4b3..a96d1a4 100644 --- a/netbox_customer_export/branding_views.py +++ b/netbox_customer_export/branding_views.py @@ -4,6 +4,8 @@ from django.contrib.auth.mixins import PermissionRequiredMixin from django.http import HttpResponse from django.shortcuts import get_object_or_404, redirect, render from django.utils import timezone +from django.utils.formats import date_format +from django.utils.translation import gettext as _ from django.views import View from .blocks import KV, P, T, Document, H @@ -40,7 +42,7 @@ class BrandingEditView(PermissionRequiredMixin, View): form = BrandingProfileForm(request.POST, request.FILES, instance=obj) if form.is_valid(): obj = form.save() - messages.success(request, f"Branding-Profil „{obj}“ gespeichert.") + messages.success(request, _("Branding profile “%(name)s” saved.") % {"name": obj}) return redirect(f"plugins:{APP}:branding_list") return render(request, self.template_name, {"object": obj, "form": form}) @@ -58,7 +60,7 @@ class BrandingDeleteView(PermissionRequiredMixin, View): if f: f.delete(save=False) obj.delete() - messages.success(request, f"Branding-Profil „{name}“ gelöscht.") + messages.success(request, _("Branding profile “%(name)s” deleted.") % {"name": name}) return redirect(f"plugins:{APP}:branding_list") @@ -70,24 +72,24 @@ class BrandingPreviewView(PermissionRequiredMixin, View): def get(self, request, pk): obj = get_object_or_404(BrandingProfile, pk=pk) blocks = [ - H(1, "Übersicht"), - KV([("Standort", "Musterstandort"), ("Status", "Aktiv"), ("Anschrift", "Musterstraße 1\n12345 Musterstadt")]), - H(2, "Geräte"), + H(1, _("Overview")), + KV([(_("Site"), _("Sample site")), (_("Status"), _("Active")), (_("Address"), _("1 Sample Street\nSample City"))]), + H(2, _("Devices")), T( - ["Name", "Hersteller / Modell", "Rack / HE", "Management-IP"], + [_("Name"), _("Manufacturer / model"), _("Rack / U"), _("Management IP")], [ - ["SW-CORE-01", "HPE Aruba 6100", "Rack A / HE 20", "10.0.0.2/24"], - ["SW-ACC-01", "HPE Aruba 6000", "Rack A / HE 18", "10.0.0.3/24"], - ["FW-01", "Sophos XGS 2100", "Rack A / HE 16", "10.0.0.1/24"], + ["SW-CORE-01", "HPE Aruba 6100", _("Rack A / U %(u)s") % {"u": 20}, "10.0.0.2/24"], + ["SW-ACC-01", "HPE Aruba 6000", _("Rack A / U %(u)s") % {"u": 18}, "10.0.0.3/24"], + ["FW-01", "Sophos XGS 2100", _("Rack A / U %(u)s") % {"u": 16}, "10.0.0.1/24"], ], ), - P("So sehen Überschriften, Tabellen und Fließtext mit diesem Profil aus."), + P(_("This is how headings, tables and body text look with this profile.")), ] doc = Document( - title="Netzwerkdokumentation Vorschau", - subtitle="Beispielkunde", + title=_("Network documentation preview"), + subtitle=_("Sample customer"), blocks=blocks, - meta={"author": request.user.username, "date": timezone.localtime().strftime("%d.%m.%Y")}, + meta={"author": request.user.username, "date": date_format(timezone.localdate(), "SHORT_DATE_FORMAT")}, branding=_normalize(obj.as_branding()), ) return HttpResponse(render_html(doc), content_type="text/html; charset=utf-8") diff --git a/netbox_customer_export/disks_utilities.py b/netbox_customer_export/disks_utilities.py index fb73733..e7db91c 100644 --- a/netbox_customer_export/disks_utilities.py +++ b/netbox_customer_export/disks_utilities.py @@ -1,5 +1,7 @@ """Datenträger und RAID-Gruppen aus dem Plugin Netbox-Utilities (netbox_utilities.Disk).""" from django.apps import apps +from django.utils.formats import date_format +from django.utils.translation import gettext as _ from .blocks import EMPTY, H, KV, T @@ -23,7 +25,7 @@ def _helpers(): def _date(value): - return value.strftime("%d.%m.%Y") if value else None + return date_format(value, "SHORT_DATE_FORMAT") if value else None def _slot(disk): @@ -53,18 +55,18 @@ def disk_blocks(scope, opts): by_device.setdefault(disk.device, []).append(disk) show_installed = bool(opts.get("disk_install_date")) - headers = ["Steckplatz", "Status", "Typ", "Hersteller / Modell", "Größe", "Seriennummer", "Firmware", "RAID"] - headers += ["Eingebaut"] * show_installed + ["Garantie bis", "Hinweise"] + headers = [_("Slot"), _("Status"), _("Type"), _("Manufacturer / model"), _("Size"), _("Serial number"), _("Firmware"), "RAID"] + headers += [_("Installed")] * show_installed + [_("Warranty until"), _("Notes")] blocks = [] for device, items in by_device.items(): slots = sum(b.slot_count for b in DiskBayLayout.objects.filter(device=device)) summary = helpers.disk_summary(items, slots) blocks.append(H(2, device.name or str(device))) blocks.append(KV([ - ("Steckplätze belegt", f"{summary['used']} / {slots}" if slots else summary["used"]), - ("Rohkapazität", fmt(summary["raw_capacity_gb"])), - ("Hot Spares", summary["spares"]), - ("Defekt", summary["failed"]), + (_("Slots used"), f"{summary['used']} / {slots}" if slots else summary["used"]), + (_("Raw capacity"), fmt(summary["raw_capacity_gb"])), + (_("Hot spares"), summary["spares"]), + (_("Failed"), summary["failed"]), ])) groups = list(RAIDGroup.objects.filter(device=device).order_by("name")) @@ -81,7 +83,7 @@ def disk_blocks(scope, opts): tolerated if tolerated is not None else EMPTY, group.description, ]) - blocks.append(T(["RAID-Gruppe", "Level", "Datenträger", "Nutzbar", "Ausfalltoleranz", "Beschreibung"], rows)) + blocks.append(T([_("RAID group"), _("Level"), _("Disks"), _("Usable"), _("Fault tolerance"), _("Description")], rows)) rows = [] for d in items: diff --git a/netbox_customer_export/forms.py b/netbox_customer_export/forms.py index 4948d3a..c6f8ee4 100644 --- a/netbox_customer_export/forms.py +++ b/netbox_customer_export/forms.py @@ -1,4 +1,5 @@ from django import forms +from django.utils.translation import gettext_lazy as _ from dcim.models import DeviceRole, DeviceType, Location, Site from netbox.plugins import get_plugin_config from tenancy.models import Tenant, TenantGroup @@ -9,93 +10,93 @@ from .models import BrandingProfile, TopologySymbol from .sections import DEFAULT_DEVICE_COLUMNS, DEVICE_COLUMNS, SECTIONS from .symbols import KIND_CHOICES -FORMAT_CHOICES = (("pdf", "PDF"), ("docx", "Word"), ("html", "HTML-Vorschau")) +FORMAT_CHOICES = (("pdf", "PDF"), ("docx", "Word"), ("html", _("HTML preview"))) class ScopeSelectForm(forms.Form): - site = DynamicModelChoiceField(queryset=Site.objects.all(), required=False, label="Standort") - location = DynamicModelChoiceField(queryset=Location.objects.all(), required=False, label="Lokation") - tenant = DynamicModelChoiceField(queryset=Tenant.objects.all(), required=False, label="Mandant") - tenantgroup = DynamicModelChoiceField(queryset=TenantGroup.objects.all(), required=False, label="Mandantengruppe") + site = DynamicModelChoiceField(queryset=Site.objects.all(), required=False, label=_("Site")) + location = DynamicModelChoiceField(queryset=Location.objects.all(), required=False, label=_("Location")) + tenant = DynamicModelChoiceField(queryset=Tenant.objects.all(), required=False, label=_("Tenant")) + tenantgroup = DynamicModelChoiceField(queryset=TenantGroup.objects.all(), required=False, label=_("Tenant group")) def clean(self): data = super().clean() chosen = [(k, v) for k, v in data.items() if v] if len(chosen) != 1: - raise forms.ValidationError("Bitte genau einen Scope auswählen.") + raise forms.ValidationError(_("Select exactly one scope.")) data["kind"], data["obj"] = chosen[0] return data class ExportForm(forms.Form): - format = forms.ChoiceField(choices=FORMAT_CHOICES, initial="pdf", label="Format") - title = forms.CharField(max_length=200, label="Titel") - subtitle = forms.CharField(max_length=200, required=False, label="Untertitel") - author = forms.CharField(max_length=100, required=False, label="Erstellt von") - branding = forms.ChoiceField(choices=(), label="Design / Firma") + format = forms.ChoiceField(choices=FORMAT_CHOICES, initial="pdf", label=_("Format")) + title = forms.CharField(max_length=200, label=_("Title")) + subtitle = forms.CharField(max_length=200, required=False, label=_("Subtitle")) + author = forms.CharField(max_length=100, required=False, label=_("Created by")) + branding = forms.ChoiceField(choices=(), label=_("Design / company")) sections = forms.MultipleChoiceField( choices=[(s.key, s.label) for s in SECTIONS.values()], initial=[s.key for s in SECTIONS.values() if s.default], widget=forms.CheckboxSelectMultiple, - label="Inhalte", + label=_("Contents"), ) roles = forms.ModelMultipleChoiceField( - queryset=DeviceRole.objects.none(), required=False, widget=forms.CheckboxSelectMultiple, label="Geräterollen" + queryset=DeviceRole.objects.none(), required=False, widget=forms.CheckboxSelectMultiple, label=_("Device roles") ) device_columns = forms.MultipleChoiceField( choices=[(k, v[0]) for k, v in DEVICE_COLUMNS.items()], initial=DEFAULT_DEVICE_COLUMNS, required=False, widget=forms.CheckboxSelectMultiple, - label="Gerätespalten", + label=_("Device columns"), ) - group_by_site = forms.BooleanField(required=False, initial=True, label="Geräte nach Standort gruppieren") + group_by_site = forms.BooleanField(required=False, initial=True, label=_("Group devices by site")) - disk_install_date = forms.BooleanField(required=False, initial=False, label="Einbaudatum der Datenträger anzeigen") + disk_install_date = forms.BooleanField(required=False, initial=False, label=_("Show disk installation date")) - rack_svg = forms.BooleanField(required=False, initial=True, label="Rack-Ansichten (SVG) einbetten") - rack_images = forms.BooleanField(required=False, initial=False, label="Gerätebilder anzeigen (wie in NetBox)") + rack_svg = forms.BooleanField(required=False, initial=True, label=_("Embed rack elevations (SVG)")) + rack_images = forms.BooleanField(required=False, initial=False, label=_("Show device images (as in NetBox)")) rack_faces = forms.MultipleChoiceField( - choices=(("front", "Vorderseite"), ("rear", "Rückseite")), + choices=(("front", _("Front")), ("rear", _("Rear"))), initial=["front"], required=False, widget=forms.CheckboxSelectMultiple, - label="Rack-Seiten", + label=_("Rack faces"), ) - rack_devices = forms.BooleanField(required=False, initial=True, label="Geräteliste je Rack") - rack_pagebreak = forms.BooleanField(required=False, initial=True, label="Seitenumbruch nach jedem Rack") + rack_devices = forms.BooleanField(required=False, initial=True, label=_("Device list per rack")) + rack_pagebreak = forms.BooleanField(required=False, initial=True, label=_("Page break after each rack")) topo_details = forms.MultipleChoiceField( - choices=(("model", "Modell"), ("primary_ip", "Management-IP"), ("ports", "Ports an Verbindungen")), + choices=(("model", _("Model")), ("primary_ip", _("Management IP")), ("ports", _("Ports on links"))), initial=["primary_ip"], required=False, widget=forms.CheckboxSelectMultiple, - label="Beschriftung", + label=_("Labels"), ) topo_scope = forms.MultipleChoiceField( - choices=(("site", "Gesamtes Netzwerk (je Standort)"), ("rack", "Je Rack")), + choices=(("site", _("Whole network (per site)")), ("rack", _("Per rack"))), initial=["site"], required=False, widget=forms.CheckboxSelectMultiple, - label="Umfang", + label=_("Scope"), ) topo_external = forms.BooleanField( - required=False, initial=True, label="Provider-Leitungen & Geräte außerhalb anzeigen" + required=False, initial=True, label=_("Show provider circuits and devices outside the scope") ) - topo_isolated = forms.BooleanField(required=False, initial=False, label="Unverkabelte Geräte anzeigen") + topo_isolated = forms.BooleanField(required=False, initial=False, label=_("Show uncabled devices")) ip_versions = forms.MultipleChoiceField( choices=(("4", "IPv4"), ("6", "IPv6")), initial=["4", "6"], required=False, widget=forms.CheckboxSelectMultiple, - label="IP-Versionen", + label=_("IP versions"), ) - include_empty = forms.BooleanField(required=False, label="Leere Abschnitte trotzdem aufführen") - include_secrets = forms.BooleanField(required=False, label="Geheimnisse (z.B. WLAN-PSK) mit exportieren") + include_empty = forms.BooleanField(required=False, label=_("List empty sections anyway")) + include_secrets = forms.BooleanField(required=False, label=_("Include secrets (e.g. Wi-Fi PSK)")) def __init__(self, *args, scope=None, **kwargs): super().__init__(*args, **kwargs) @@ -113,7 +114,7 @@ class ExportForm(forms.Form): roles = DeviceRole.objects.filter(pk__in=role_ids).order_by("name") self.fields["roles"].queryset = roles self.fields["roles"].initial = [r.pk for r in roles] - self.fields["title"].initial = f"Netzwerkdokumentation {scope.obj}" + self.fields["title"].initial = _("Network documentation %(name)s") % {"name": scope.obj} self.fields["subtitle"].initial = f"{scope.label}: {scope.obj}" if not get_plugin_config("netbox_customer_export", "allow_secrets"): del self.fields["include_secrets"] @@ -144,10 +145,10 @@ class BrandingProfileForm(forms.ModelForm): "extra_css": forms.Textarea(attrs={"rows": 4, "class": "form-control font-monospace"}), } help_texts = { - "is_default": "Wird im Exportformular vorausgewählt.", - "logo": "PNG oder JPG, erscheint auf dem Deckblatt.", - "docx_template": ".docx oder .dotx: Formatvorlagen, Kopf-/Fußzeile und Ränder werden übernommen.", - "docx_table_style": "Name wie in Word angezeigt, z.B. Gitternetztabelle 4 – Akzent 1. Leer = eigene Einfärbung.", + "is_default": _("Preselected in the export form."), + "logo": _("PNG or JPG, shown on the cover page."), + "docx_template": _(".docx or .dotx: styles, header/footer and margins are applied."), + "docx_table_style": _("Name as shown in Word, e.g. Grid Table 4 – Accent 1. Empty = own colouring."), } def __init__(self, *args, **kwargs): @@ -161,17 +162,17 @@ class BrandingProfileForm(forms.ModelForm): class TopologySymbolForm(forms.ModelForm): - device_type = DynamicModelChoiceField(queryset=DeviceType.objects.all(), required=False, label="Gerätetyp") - role = DynamicModelChoiceField(queryset=DeviceRole.objects.all(), required=False, label="Geräterolle") + device_type = DynamicModelChoiceField(queryset=DeviceType.objects.all(), required=False, label=_("Device type")) + role = DynamicModelChoiceField(queryset=DeviceRole.objects.all(), required=False, label=_("Device role")) kind = forms.ChoiceField( - choices=[("", "Automatisch")] + KIND_CHOICES, required=False, widget=forms.RadioSelect, label="Symbol" + choices=[("", _("Automatic"))] + KIND_CHOICES, required=False, widget=forms.RadioSelect, label=_("Symbol") ) class Meta: model = TopologySymbol fields = ("device_type", "role", "kind", "icon") help_texts = { - "icon": "PNG, JPG oder GIF, am besten quadratisch mit transparentem Hintergrund. Ersetzt das gewählte Symbol.", + "icon": _("PNG, JPG or GIF, ideally square with a transparent background. Replaces the selected symbol."), } def __init__(self, *args, **kwargs): diff --git a/netbox_customer_export/licenses_slm.py b/netbox_customer_export/licenses_slm.py index 8a455b6..f59143f 100644 --- a/netbox_customer_export/licenses_slm.py +++ b/netbox_customer_export/licenses_slm.py @@ -4,6 +4,9 @@ from itertools import groupby from django.apps import apps from django.db.models import Q +from django.utils.formats import date_format +from django.utils.translation import gettext as _ +from django.utils.translation import ngettext from .blocks import EMPTY, H, T @@ -55,29 +58,37 @@ def licenses_for_scope(scope): def _validity(lic, today): """(Laufzeit-Text, Status-Text).""" if lic.lifetime: - return "unbefristet", "aktiv" - start = lic.start_date.strftime("%d.%m.%Y") if lic.start_date else "" - end = lic.expiration_date.strftime("%d.%m.%Y") if lic.expiration_date else "" - period = f"{start} – {end}" if start and end else (f"bis {end}" if end else (f"ab {start}" if start else EMPTY)) + return _("unlimited"), _("active") + start = date_format(lic.start_date, "SHORT_DATE_FORMAT") if lic.start_date else "" + end = date_format(lic.expiration_date, "SHORT_DATE_FORMAT") if lic.expiration_date else "" + if start and end: + period = f"{start} – {end}" + elif end: + period = _("until %(date)s") % {"date": end} + elif start: + period = _("from %(date)s") % {"date": start} + else: + period = EMPTY if lic.renewal_interval and lic.renewal_interval_unit: - if lic.renewal_interval == 1: - every = {"days": "täglich", "months": "monatlich", "years": "jährlich"}.get(lic.renewal_interval_unit, "") - else: - unit = {"days": "Tage", "months": "Monate", "years": "Jahre"}.get(lic.renewal_interval_unit, lic.renewal_interval_unit) - every = f"alle {lic.renewal_interval} {unit}" - period += f" (Verlängerung {every})" + n = lic.renewal_interval + every = { + "days": ngettext("daily", "every %(n)d days", n), + "months": ngettext("monthly", "every %(n)d months", n), + "years": ngettext("yearly", "every %(n)d years", n), + }.get(lic.renewal_interval_unit, f"{n} {lic.renewal_interval_unit}") + period += " " + _("(renewal %(interval)s)") % {"interval": every % {"n": n}} if not lic.expiration_date: - return period, "aktiv" + return period, _("active") days = (lic.expiration_date - today).days if days < 0: - return period, "abgelaufen" + return period, _("expired") if days <= SOON_DAYS: - return period, f"läuft in {days} Tagen ab" - return period, "aktiv" + return period, ngettext("expires in %(days)d day", "expires in %(days)d days", days) % {"days": days} + return period, _("active") def _support(value): - return {True: "Ja", False: "Nein"}.get(value, EMPTY) + return {True: _("Yes"), False: _("No")}.get(value, EMPTY) def _installed_on(lic): @@ -85,7 +96,7 @@ def _installed_on(lic): if not inst: return None target = inst.device or inst.virtualmachine or inst.cluster - kind = "Gerät" if inst.device_id else ("VM" if inst.virtualmachine_id else "Cluster") + kind = _("Device") if inst.device_id else (_("VM") if inst.virtualmachine_id else _("Cluster")) return f"{target} ({kind})" if target else None @@ -96,9 +107,9 @@ def slm_blocks(scope, opts): return [] today = date.today() show_key = bool(opts.get("include_secrets")) - headers = ["Lizenz", "Produkt / Version", "Typ", "Anzahl", "Laufzeit", "Status", "Support", "Installiert auf", "Mandant"] + headers = [_("License"), _("Product / version"), _("Type"), _("Quantity"), _("Term"), _("Status"), _("Support"), _("Installed on"), _("Tenant")] if show_key: - headers.append("Lizenzschlüssel") + headers.append(_("License key")) blocks = [] by_manufacturer = sorted(qs, key=lambda lic: (str(lic.software_product.manufacturer or "~"), str(lic.software_product), lic.name)) @@ -121,6 +132,6 @@ def slm_blocks(scope, opts): if show_key: row.append(lic.license_key) rows.append(row) - blocks.append(H(2, str(manufacturer) if manufacturer else "Ohne Hersteller")) + blocks.append(H(2, str(manufacturer) if manufacturer else _("No manufacturer"))) blocks.append(T(headers, rows)) return blocks diff --git a/netbox_customer_export/locale/de/LC_MESSAGES/django.mo b/netbox_customer_export/locale/de/LC_MESSAGES/django.mo new file mode 100644 index 0000000..898300d Binary files /dev/null and b/netbox_customer_export/locale/de/LC_MESSAGES/django.mo differ diff --git a/netbox_customer_export/locale/de/LC_MESSAGES/django.po b/netbox_customer_export/locale/de/LC_MESSAGES/django.po new file mode 100644 index 0000000..eaffffc --- /dev/null +++ b/netbox_customer_export/locale/de/LC_MESSAGES/django.po @@ -0,0 +1,1341 @@ +# German translation of netbox-customer-export. +# This file is distributed under the same license as the netbox-customer-export package. +# +msgid "" +msgstr "" +"Project-Id-Version: netbox-customer-export\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2026-10-26 20:23+0000\n" +"PO-Revision-Date: 2026-10-26 20:30+0000\n" +"Last-Translator: \n" +"Language-Team: German\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: __init__.py:7 +msgid "Customer Export" +msgstr "Kunden-Export" + +#: __init__.py:8 +msgid "Export customer documentation as PDF or Word" +msgstr "Kundendokumentation als PDF oder Word exportieren" + +#: blocks.py:88 licenses_slm.py:91 +msgid "Yes" +msgstr "Ja" + +#: blocks.py:88 licenses_slm.py:91 +msgid "No" +msgstr "Nein" + +#: branding_views.py:45 +#, python-format +msgid "Branding profile “%(name)s” saved." +msgstr "Branding-Profil „%(name)s“ gespeichert." + +#: branding_views.py:63 +#, python-format +msgid "Branding profile “%(name)s” deleted." +msgstr "Branding-Profil „%(name)s“ gelöscht." + +#: branding_views.py:75 sections.py:100 +msgid "Overview" +msgstr "Übersicht" + +#: branding_views.py:76 forms.py:17 scope.py:20 sections.py:68 sections.py:145 +#: sections.py:340 +msgid "Site" +msgstr "Standort" + +#: branding_views.py:76 +msgid "Sample site" +msgstr "Musterstandort" + +#: branding_views.py:76 disks_utilities.py:58 licenses_slm.py:110 +#: sections.py:71 sections.py:119 sections.py:134 sections.py:185 +#: sections.py:277 sections.py:292 sections.py:325 sections.py:340 +#: sections.py:361 sections.py:371 sections.py:393 +msgid "Status" +msgstr "Status" + +#: branding_views.py:76 +msgid "Active" +msgstr "Aktiv" + +#: branding_views.py:76 sections.py:361 +msgid "Address" +msgstr "Anschrift" + +#: branding_views.py:76 +msgid "" +"1 Sample Street\n" +"Sample City" +msgstr "Musterstraße 1\n12345 Musterstadt" + +#: branding_views.py:77 sections.py:104 sections.py:235 sections.py:237 +#: templates/netbox_customer_export/export.html:100 +msgid "Devices" +msgstr "Geräte" + +#: branding_views.py:79 models.py:16 sections.py:66 sections.py:162 +#: sections.py:292 sections.py:307 sections.py:340 +#: templates/netbox_customer_export/branding_list.html:20 +msgid "Name" +msgstr "Name" + +#: branding_views.py:79 disks_utilities.py:58 sections.py:67 sections.py:223 +msgid "Manufacturer / model" +msgstr "Hersteller / Modell" + +#: branding_views.py:79 sections.py:70 +msgid "Rack / U" +msgstr "Rack / HE" + +#: branding_views.py:79 forms.py:72 sections.py:73 +msgid "Management IP" +msgstr "Management-IP" + +#: branding_views.py:81 branding_views.py:82 branding_views.py:83 +#, python-format +msgid "Rack A / U %(u)s" +msgstr "Rack A / HE %(u)s" + +#: branding_views.py:86 +msgid "This is how headings, tables and body text look with this profile." +msgstr "So sehen Überschriften, Tabellen und Fließtext mit diesem Profil aus." + +#: branding_views.py:89 +msgid "Network documentation preview" +msgstr "Netzwerkdokumentation Vorschau" + +#: branding_views.py:90 +msgid "Sample customer" +msgstr "Beispielkunde" + +#: disks_utilities.py:58 +msgid "Slot" +msgstr "Steckplatz" + +#: disks_utilities.py:58 licenses_slm.py:110 sections.py:187 sections.py:277 +#: sections.py:393 +msgid "Type" +msgstr "Typ" + +#: disks_utilities.py:58 +msgid "Size" +msgstr "Größe" + +#: disks_utilities.py:58 sections.py:75 +msgid "Serial number" +msgstr "Seriennummer" + +#: disks_utilities.py:58 +msgid "Firmware" +msgstr "Firmware" + +#: disks_utilities.py:59 +msgid "Installed" +msgstr "Eingebaut" + +#: disks_utilities.py:59 +msgid "Warranty until" +msgstr "Garantie bis" + +#: disks_utilities.py:59 +msgid "Notes" +msgstr "Hinweise" + +#: disks_utilities.py:66 +msgid "Slots used" +msgstr "Steckplätze belegt" + +#: disks_utilities.py:67 +msgid "Raw capacity" +msgstr "Rohkapazität" + +#: disks_utilities.py:68 +msgid "Hot spares" +msgstr "Hot Spares" + +#: disks_utilities.py:69 +msgid "Failed" +msgstr "Defekt" + +#: disks_utilities.py:86 +msgid "RAID group" +msgstr "RAID-Gruppe" + +#: disks_utilities.py:86 +msgid "Level" +msgstr "Level" + +#: disks_utilities.py:86 templates/netbox_customer_export/export.html:128 +msgid "Disks" +msgstr "Datenträger" + +#: disks_utilities.py:86 +msgid "Usable" +msgstr "Nutzbar" + +#: disks_utilities.py:86 +msgid "Fault tolerance" +msgstr "Ausfalltoleranz" + +#: disks_utilities.py:86 sections.py:78 sections.py:126 sections.py:134 +#: sections.py:191 sections.py:307 sections.py:325 sections.py:340 +#: sections.py:361 sections.py:393 sections.py:412 +msgid "Description" +msgstr "Beschreibung" + +#: forms.py:13 +msgid "HTML preview" +msgstr "HTML-Vorschau" + +#: forms.py:18 scope.py:21 sections.py:69 sections.py:134 sections.py:146 +msgid "Location" +msgstr "Lokation" + +#: forms.py:19 licenses_slm.py:110 scope.py:22 sections.py:77 sections.py:121 +#: sections.py:147 sections.py:190 sections.py:307 +msgid "Tenant" +msgstr "Mandant" + +#: forms.py:20 scope.py:23 +msgid "Tenant group" +msgstr "Mandantengruppe" + +#: forms.py:26 +msgid "Select exactly one scope." +msgstr "Bitte genau einen Scope auswählen." + +#: forms.py:32 templates/netbox_customer_export/export.html:41 +msgid "Format" +msgstr "Format" + +#: forms.py:33 +msgid "Title" +msgstr "Titel" + +#: forms.py:34 +msgid "Subtitle" +msgstr "Untertitel" + +#: forms.py:35 renderers/docx.py:107 +#: templates/netbox_customer_export/document.html:64 +msgid "Created by" +msgstr "Erstellt von" + +#: forms.py:36 +msgid "Design / company" +msgstr "Design / Firma" + +#: forms.py:42 templates/netbox_customer_export/export.html:76 +msgid "Contents" +msgstr "Inhalte" + +#: forms.py:46 +msgid "Device roles" +msgstr "Geräterollen" + +#: forms.py:53 +msgid "Device columns" +msgstr "Gerätespalten" + +#: forms.py:55 +msgid "Group devices by site" +msgstr "Geräte nach Standort gruppieren" + +#: forms.py:57 +msgid "Show disk installation date" +msgstr "Einbaudatum der Datenträger anzeigen" + +#: forms.py:59 +msgid "Embed rack elevations (SVG)" +msgstr "Rack-Ansichten (SVG) einbetten" + +#: forms.py:60 +msgid "Show device images (as in NetBox)" +msgstr "Gerätebilder anzeigen (wie in NetBox)" + +#: forms.py:62 sections.py:202 +msgid "Front" +msgstr "Vorderseite" + +#: forms.py:62 sections.py:202 +msgid "Rear" +msgstr "Rückseite" + +#: forms.py:66 +msgid "Rack faces" +msgstr "Rack-Seiten" + +#: forms.py:68 +msgid "Device list per rack" +msgstr "Geräteliste je Rack" + +#: forms.py:69 +msgid "Page break after each rack" +msgstr "Seitenumbruch nach jedem Rack" + +#: forms.py:72 +msgid "Model" +msgstr "Modell" + +#: forms.py:72 +msgid "Ports on links" +msgstr "Ports an Verbindungen" + +#: forms.py:76 templates/netbox_customer_export/branding_list.html:34 +msgid "Labels" +msgstr "Beschriftung" + +#: forms.py:79 +msgid "Whole network (per site)" +msgstr "Gesamtes Netzwerk (je Standort)" + +#: forms.py:79 +msgid "Per rack" +msgstr "Je Rack" + +#: forms.py:83 sections.py:325 +msgid "Scope" +msgstr "Umfang" + +#: forms.py:86 +msgid "Show provider circuits and devices outside the scope" +msgstr "Provider-Leitungen & Geräte außerhalb anzeigen" + +#: forms.py:88 +msgid "Show uncabled devices" +msgstr "Unverkabelte Geräte anzeigen" + +#: forms.py:95 +msgid "IP versions" +msgstr "IP-Versionen" + +#: forms.py:98 +msgid "List empty sections anyway" +msgstr "Leere Abschnitte trotzdem aufführen" + +#: forms.py:99 +msgid "Include secrets (e.g. Wi-Fi PSK)" +msgstr "Geheimnisse (z.B. WLAN-PSK) mit exportieren" + +#: forms.py:117 +#, python-format +msgid "Network documentation %(name)s" +msgstr "Netzwerkdokumentation %(name)s" + +#: forms.py:148 +msgid "Preselected in the export form." +msgstr "Wird im Exportformular vorausgewählt." + +#: forms.py:149 +msgid "PNG or JPG, shown on the cover page." +msgstr "PNG oder JPG, erscheint auf dem Deckblatt." + +#: forms.py:150 +msgid ".docx or .dotx: styles, header/footer and margins are applied." +msgstr ".docx oder .dotx: Formatvorlagen, Kopf-/Fußzeile und Ränder werden übernommen." + +#: forms.py:151 +msgid "" +"Name as shown in Word, e.g. Grid Table 4 – Accent 1. Empty = own colouring." +msgstr "Name wie in Word angezeigt, z.B. Gitternetztabelle 4 – Akzent 1. Leer = eigene Einfärbung." + +#: forms.py:165 models.py:84 models.py:106 +msgid "Device type" +msgstr "Gerätetyp" + +#: forms.py:166 models.py:87 models.py:106 +msgid "Device role" +msgstr "Geräterolle" + +#: forms.py:168 models.py:111 +msgid "Automatic" +msgstr "Automatisch" + +#: forms.py:168 models.py:89 +#: templates/netbox_customer_export/_symbol_table.html:3 +#: templates/netbox_customer_export/symbol_edit.html:33 +msgid "Symbol" +msgstr "Symbol" + +#: forms.py:175 +msgid "" +"PNG, JPG or GIF, ideally square with a transparent background. Replaces the " +"selected symbol." +msgstr "PNG, JPG oder GIF, am besten quadratisch mit transparentem Hintergrund. Ersetzt das gewählte Symbol." + +#: licenses_slm.py:61 +msgid "unlimited" +msgstr "unbefristet" + +#: licenses_slm.py:61 licenses_slm.py:81 licenses_slm.py:87 +msgid "active" +msgstr "aktiv" + +#: licenses_slm.py:67 +#, python-format +msgid "until %(date)s" +msgstr "bis %(date)s" + +#: licenses_slm.py:69 +#, python-format +msgid "from %(date)s" +msgstr "ab %(date)s" + +#: licenses_slm.py:75 +#, python-format +msgid "daily" +msgid_plural "every %(n)d days" +msgstr[0] "täglich" +msgstr[1] "alle %(n)d Tage" + +#: licenses_slm.py:76 +#, python-format +msgid "monthly" +msgid_plural "every %(n)d months" +msgstr[0] "monatlich" +msgstr[1] "alle %(n)d Monate" + +#: licenses_slm.py:77 +#, python-format +msgid "yearly" +msgid_plural "every %(n)d years" +msgstr[0] "jährlich" +msgstr[1] "alle %(n)d Jahre" + +#: licenses_slm.py:79 +#, python-format +msgid "(renewal %(interval)s)" +msgstr "(Verlängerung %(interval)s)" + +#: licenses_slm.py:84 +msgid "expired" +msgstr "abgelaufen" + +#: licenses_slm.py:86 +#, python-format +msgid "expires in %(days)d day" +msgid_plural "expires in %(days)d days" +msgstr[0] "läuft in %(days)d Tag ab" +msgstr[1] "läuft in %(days)d Tagen ab" + +#: licenses_slm.py:99 sections.py:223 sections.py:409 +msgid "Device" +msgstr "Gerät" + +#: licenses_slm.py:99 +msgid "VM" +msgstr "VM" + +#: licenses_slm.py:99 sections.py:292 +msgid "Cluster" +msgstr "Cluster" + +#: licenses_slm.py:110 sections.py:407 +msgid "License" +msgstr "Lizenz" + +#: licenses_slm.py:110 +msgid "Product / version" +msgstr "Produkt / Version" + +#: licenses_slm.py:110 sections.py:410 +msgid "Quantity" +msgstr "Anzahl" + +#: licenses_slm.py:110 +msgid "Term" +msgstr "Laufzeit" + +#: licenses_slm.py:110 +msgid "Support" +msgstr "Support" + +#: licenses_slm.py:110 +msgid "Installed on" +msgstr "Installiert auf" + +#: licenses_slm.py:112 +msgid "License key" +msgstr "Lizenzschlüssel" + +#: licenses_slm.py:135 +msgid "No manufacturer" +msgstr "Ohne Hersteller" + +#: models.py:6 +msgid "Expected a hex colour without #, e.g. 1F4E79" +msgstr "Hex-Farbe ohne # erwartet, z.B. 1F4E79" + +#: models.py:17 +msgid "Default profile" +msgstr "Standardprofil" + +#: models.py:18 +msgid "Company name" +msgstr "Firmenname" + +#: models.py:20 +msgid "Footer" +msgstr "Fußzeile" + +#: models.py:22 templates/netbox_customer_export/branding_list.html:20 +msgid "Logo" +msgstr "Logo" + +#: models.py:23 +msgid "Primary colour" +msgstr "Primärfarbe" + +#: models.py:24 +msgid "Accent colour" +msgstr "Akzentfarbe" + +#: models.py:25 +msgid "Table header text" +msgstr "Schrift Tabellenkopf" + +#: models.py:26 +msgid "Label background" +msgstr "Hintergrund Beschriftungen" + +#: models.py:27 templates/netbox_customer_export/branding_list.html:35 +msgid "Row stripes" +msgstr "Zebrastreifen" + +#: models.py:28 templates/netbox_customer_export/branding_list.html:20 +msgid "Font" +msgstr "Schriftart" + +#: models.py:30 +msgid "Font size (pt)" +msgstr "Schriftgröße (pt)" + +#: models.py:36 templates/netbox_customer_export/branding_list.html:20 +msgid "Word template" +msgstr "Word-Vorlage" + +#: models.py:38 +msgid "Table style (Word)" +msgstr "Tabellenformatvorlage (Word)" + +#: models.py:39 +msgid "Additional CSS (PDF/HTML)" +msgstr "Zusätzliches CSS (PDF/HTML)" + +#: models.py:44 +msgid "branding profile" +msgstr "Branding-Profil" + +#: models.py:45 +msgid "branding profiles" +msgstr "Branding-Profile" + +#: models.py:90 templates/netbox_customer_export/_symbol_table.html:12 +msgid "Custom icon" +msgstr "Eigenes Icon" + +#: models.py:95 +msgid "topology symbol" +msgstr "Topologie-Symbol" + +#: models.py:96 +msgid "topology symbols" +msgstr "Topologie-Symbole" + +#: models.py:117 +msgid "Select exactly one device type or one device role." +msgstr "Bitte genau einen Gerätetyp oder eine Geräterolle wählen." + +#: models.py:119 +msgid "Select a symbol or upload a custom icon." +msgstr "Bitte ein Symbol wählen oder ein eigenes Icon hochladen." + +#: navigation.py:7 templates/netbox_customer_export/select.html:4 +msgid "Customer Documentation" +msgstr "Kundendokumentation" + +#: navigation.py:12 templates/netbox_customer_export/symbol_list.html:3 +msgid "Topology Symbols" +msgstr "Topologie-Symbole" + +#: navigation.py:17 navigation.py:30 +#: templates/netbox_customer_export/branding_list.html:7 +msgid "Add" +msgstr "Hinzufügen" + +#: navigation.py:25 templates/netbox_customer_export/branding_list.html:3 +msgid "Branding Profiles" +msgstr "Branding-Profile" + +#: renderers/__init__.py:24 +#, python-format +msgid "" +"PDF export requires WeasyPrint (pip install weasyprint + Pango): %(error)s" +msgstr "PDF-Export benötigt WeasyPrint (pip install weasyprint + Pango): %(error)s" + +#: renderers/docx.py:51 +#, python-format +msgid "" +"Word export requires python-docx (pip install python-docx cairosvg): " +"%(error)s" +msgstr "Word-Export benötigt python-docx (pip install python-docx cairosvg): %(error)s" + +#: renderers/docx.py:61 +#, python-format +msgid "Word template %(path)r could not be loaded: %(error)s" +msgstr "Word-Vorlage %(path)r konnte nicht geladen werden: %(error)s" + +#: renderers/docx.py:107 templates/netbox_customer_export/document.html:63 +msgid "As of" +msgstr "Stand" + +#: renderers/docx.py:113 templates/netbox_customer_export/document.html:69 +msgid "Table of contents" +msgstr "Inhaltsverzeichnis" + +#: renderers/docx.py:217 +msgid "(rack graphic not available)" +msgstr "(Rack-Grafik nicht verfügbar)" + +#: sections.py:60 +#, python-format +msgid "U %(u)s" +msgstr "HE %(u)s" + +#: sections.py:72 +msgid "Platform / OS" +msgstr "Plattform / OS" + +#: sections.py:74 +msgid "OOB IP" +msgstr "OOB-IP" + +#: sections.py:76 +msgid "Asset tag" +msgstr "Inventarnr." + +#: sections.py:91 +msgid "No entries." +msgstr "Keine Einträge vorhanden." + +#: sections.py:98 +msgid "Overview & site data" +msgstr "Übersicht & Standortdaten" + +#: sections.py:98 sections.py:141 +#: templates/netbox_customer_export/branding_edit.html:18 +msgid "General" +msgstr "Allgemein" + +#: sections.py:98 +msgid "Key figures, addresses, location tree" +msgstr "Kennzahlen, Adressen, Lokationsbaum" + +#: sections.py:102 +msgid "Sites" +msgstr "Standorte" + +#: sections.py:103 sections.py:166 sections.py:173 +#: templates/netbox_customer_export/export.html:114 +msgid "Racks" +msgstr "Racks" + +#: sections.py:105 sections.py:284 sections.py:287 +msgid "Virtual machines" +msgstr "Virtuelle Maschinen" + +#: sections.py:106 +msgid "Prefixes" +msgstr "Präfixe" + +#: sections.py:107 sections.py:332 sections.py:335 +msgid "VLANs" +msgstr "VLANs" + +#: sections.py:108 sections.py:385 sections.py:388 +msgid "Circuits" +msgstr "Leitungen" + +#: sections.py:115 sections.py:177 sections.py:251 topology.py:137 +#, python-format +msgid "Site %(name)s" +msgstr "Standort %(name)s" + +#: sections.py:120 +msgid "Region" +msgstr "Region" + +#: sections.py:122 +msgid "Facility" +msgstr "Einrichtung" + +#: sections.py:123 +msgid "Physical address" +msgstr "Anschrift" + +#: sections.py:124 +msgid "Shipping address" +msgstr "Lieferanschrift" + +#: sections.py:125 +msgid "Time zone" +msgstr "Zeitzone" + +#: sections.py:134 +msgid "Parent" +msgstr "Übergeordnet" + +#: sections.py:141 sections.py:159 +msgid "Contacts" +msgstr "Ansprechpartner" + +#: sections.py:141 +msgid "Contacts of sites, locations, tenants" +msgstr "Kontakte an Standorten, Lokationen, Mandanten" + +#: sections.py:162 sections.py:361 +msgid "Assigned to" +msgstr "Zugewiesen an" + +#: sections.py:162 sections.py:186 sections.py:292 sections.py:325 +#: sections.py:340 sections.py:361 +msgid "Role" +msgstr "Rolle" + +#: sections.py:162 +msgid "Priority" +msgstr "Priorität" + +#: sections.py:162 +msgid "Phone" +msgstr "Telefon" + +#: sections.py:162 +msgid "Email" +msgstr "E-Mail" + +#: sections.py:166 sections.py:235 sections.py:258 sections.py:269 +#: sections.py:284 +msgid "Infrastructure" +msgstr "Infrastruktur" + +#: sections.py:166 +msgid "By site & location, with rack elevation" +msgstr "Nach Standort & Lokation, mit Rack-Ansicht" + +#: sections.py:179 +#, python-format +msgid "Location %(name)s" +msgstr "Lokation %(name)s" + +#: sections.py:179 +msgid "No location" +msgstr "Ohne Lokation" + +#: sections.py:181 topology.py:106 +#, python-format +msgid "Rack %(name)s" +msgstr "Rack %(name)s" + +#: sections.py:188 +msgid "Height" +msgstr "Höhe" + +#: sections.py:188 +#, python-format +msgid "%(u)s U" +msgstr "%(u)s HE" + +#: sections.py:189 +msgid "Facility ID" +msgstr "Facility-ID" + +#: sections.py:214 +#, python-format +msgid "Rack elevation (%(face)s) could not be created: %(error)s" +msgstr "Rack-Ansicht (%(face)s) konnte nicht erzeugt werden: %(error)s" + +#: sections.py:223 +msgid "U" +msgstr "HE" + +#: sections.py:223 +msgid "Face" +msgstr "Seite" + +#: sections.py:235 +msgid "Tables per device role" +msgstr "Tabellen je Geräterolle" + +#: sections.py:258 sections.py:262 +msgid "Disks & RAID" +msgstr "Datenträger & RAID" + +#: sections.py:258 +msgid "From Netbox-Utilities (if installed)" +msgstr "Aus Netbox-Utilities (falls installiert)" + +#: sections.py:264 +msgid "Netbox-Utilities with disk management is not installed – see README." +msgstr "Netbox-Utilities mit Datenträger-Verwaltung ist nicht installiert – siehe README." + +#: sections.py:269 sections.py:272 +msgid "Power" +msgstr "Stromversorgung" + +#: sections.py:269 +msgid "Power panels & feeds" +msgstr "Power Panels & Feeds" + +#: sections.py:277 +msgid "Panel" +msgstr "Panel" + +#: sections.py:277 +msgid "Feed" +msgstr "Feed" + +#: sections.py:277 +msgid "Rack" +msgstr "Rack" + +#: sections.py:277 +msgid "Phase" +msgstr "Phase" + +#: sections.py:277 +msgid "Voltage" +msgstr "Spannung" + +#: sections.py:277 +msgid "Amperage" +msgstr "Ampere" + +#: sections.py:284 +msgid "Cluster, resources, IP" +msgstr "Cluster, Ressourcen, IP" + +#: sections.py:292 +msgid "OS" +msgstr "OS" + +#: sections.py:292 +msgid "RAM (MB)" +msgstr "RAM (MB)" + +#: sections.py:292 +msgid "Disk (MB)" +msgstr "Disk (MB)" + +#: sections.py:299 sections.py:302 +msgid "VRFs" +msgstr "VRFs" + +#: sections.py:299 sections.py:314 sections.py:332 sections.py:347 +#: sections.py:365 sections.py:385 sections.py:448 +msgid "Network" +msgstr "Netzwerk" + +#: sections.py:299 +msgid "Including route targets" +msgstr "Inkl. Route Targets" + +#: sections.py:307 +msgid "Import RT" +msgstr "Import-RT" + +#: sections.py:307 +msgid "Export RT" +msgstr "Export-RT" + +#: sections.py:314 sections.py:318 +msgid "IP networks" +msgstr "IP-Netze" + +#: sections.py:314 +msgid "Prefixes grouped by VRF" +msgstr "Präfixe gruppiert nach VRF" + +#: sections.py:322 sections.py:355 +msgid "Global" +msgstr "Global" + +#: sections.py:325 +msgid "Prefix" +msgstr "Präfix" + +#: sections.py:332 +msgid "VID, name, group, role" +msgstr "VID, Name, Gruppe, Rolle" + +#: sections.py:340 sections.py:371 +msgid "Group" +msgstr "Gruppe" + +#: sections.py:347 sections.py:351 +msgid "IP addresses" +msgstr "IP-Adressen" + +#: sections.py:347 +msgid "Detailed – can get long" +msgstr "Ausführlich – kann lang werden" + +#: sections.py:361 +msgid "DNS name" +msgstr "DNS-Name" + +#: sections.py:365 sections.py:368 +msgid "Wireless LANs" +msgstr "WLANs" + +#: sections.py:365 +msgid "SSIDs, authentication" +msgstr "SSIDs, Authentifizierung" + +#: sections.py:371 +msgid "Authentication" +msgstr "Authentifizierung" + +#: sections.py:371 +msgid "Cipher" +msgstr "Verschlüsselung" + +#: sections.py:385 +msgid "Provider, circuit ID, bandwidth" +msgstr "Provider, Leitungs-ID, Bandbreite" + +#: sections.py:393 +msgid "Circuit ID" +msgstr "Leitungs-ID" + +#: sections.py:393 +msgid "Provider" +msgstr "Provider" + +#: sections.py:393 +msgid "Commit rate (Kbps)" +msgstr "Bandbreite (Kbit/s)" + +#: sections.py:408 +msgid "Manufacturer" +msgstr "Hersteller" + +#: sections.py:411 +msgid "Contract" +msgstr "Vertrag" + +#: sections.py:418 sections.py:423 +msgid "Licenses" +msgstr "Lizenzen" + +#: sections.py:418 +msgid "Contracts & licenses" +msgstr "Verträge & Lizenzen" + +#: sections.py:418 +msgid "From NetBox-SLM or another license plugin" +msgstr "Aus NetBox-SLM oder anderem Lizenz-Plugin" + +#: sections.py:444 +msgid "" +"No license plugin installed (NetBox-SLM or netbox-lifecycle) – see README." +msgstr "Kein Lizenz-Plugin installiert (NetBox-SLM oder netbox-lifecycle) – siehe README." + +#: sections.py:448 sections.py:452 +msgid "Network topology" +msgstr "Netzwerk-Topologie" + +#: sections.py:448 +msgid "Diagram with symbols, like Packet Tracer" +msgstr "Diagramm mit Symbolen, wie Packet Tracer" + +#: sections.py:461 +msgid "Topology per rack" +msgstr "Topologie je Rack" + +#: sections.py:463 +msgid "No cabled devices found." +msgstr "Keine verkabelten Geräte gefunden." + +#: symbol_views.py:79 +#, python-format +msgid "Topology symbol for “%(name)s” saved." +msgstr "Topologie-Symbol für „%(name)s“ gespeichert." + +#: symbol_views.py:96 +#, python-format +msgid "" +"Topology symbol for “%(name)s” deleted – automatic detection applies again." +msgstr "Topologie-Symbol für „%(name)s“ gelöscht – es gilt wieder die automatische Erkennung." + +#: symbols.py:12 +msgid "Internet / provider" +msgstr "Internet / Provider" + +#: symbols.py:13 +msgid "Modem / NTU / media converter" +msgstr "Modem / NTU / Medienkonverter" + +#: symbols.py:14 +msgid "Firewall" +msgstr "Firewall" + +#: symbols.py:15 +msgid "Router" +msgstr "Router" + +#: symbols.py:16 +msgid "Layer 3 switch / core" +msgstr "Layer-3-Switch / Core" + +#: symbols.py:17 +msgid "Switch" +msgstr "Switch" + +#: symbols.py:18 +msgid "Radio link / microwave" +msgstr "Funkstrecke / Richtfunk" + +#: symbols.py:19 +msgid "Wireless controller" +msgstr "WLAN-Controller" + +#: symbols.py:20 +msgid "PoE injector" +msgstr "PoE-Injektor" + +#: symbols.py:21 +msgid "Access point" +msgstr "Access Point" + +#: symbols.py:22 +msgid "Server" +msgstr "Server" + +#: symbols.py:23 +msgid "Storage / SAN (MSA)" +msgstr "Storage / SAN (MSA)" + +#: symbols.py:24 +msgid "NAS" +msgstr "NAS" + +#: symbols.py:25 +msgid "Tape drive / tape library" +msgstr "Bandlaufwerk / Tape Library" + +#: symbols.py:26 +msgid "UPS / ATS" +msgstr "USV / ATS" + +#: symbols.py:27 +msgid "Phone system (PBX)" +msgstr "Telefonanlage" + +#: symbols.py:28 +msgid "IP phone" +msgstr "IP-Telefon" + +#: symbols.py:29 +msgid "PC / client" +msgstr "PC / Client" + +#: symbols.py:30 +msgid "Printer" +msgstr "Drucker" + +#: symbols.py:31 +msgid "Camera" +msgstr "Kamera" + +#: symbols.py:32 +msgid "Other device" +msgstr "Sonstiges Gerät" + +#: symbols.py:36 +msgid "Hide in topology" +msgstr "In Topologie ausblenden" + +#: template_content.py:19 +msgid "Customer Docs" +msgstr "Kundendoku" + +#: template_content.py:42 +msgid "Topology Symbol" +msgstr "Topologie-Symbol" + +#: templates/netbox_customer_export/_pills.html:5 +msgid "No entries in scope." +msgstr "Keine Einträge im Scope." + +#: templates/netbox_customer_export/_symbol_table.html:3 +msgid "Assignment" +msgstr "Zuordnung" + +#: templates/netbox_customer_export/_symbol_table.html:15 +#: templates/netbox_customer_export/branding_list.html:42 +msgid "Edit" +msgstr "Bearbeiten" + +#: templates/netbox_customer_export/_symbol_table.html:18 +#: templates/netbox_customer_export/branding_delete.html:14 +#: templates/netbox_customer_export/branding_list.html:45 +#: templates/netbox_customer_export/symbol_delete.html:14 +msgid "Delete" +msgstr "Löschen" + +#: templates/netbox_customer_export/branding_delete.html:3 +#, python-format +msgid "Delete %(object)s" +msgstr "%(object)s löschen" + +#: templates/netbox_customer_export/branding_delete.html:9 +#, python-format +msgid "" +"Do you really want to delete the branding profile %(object)s? The profile's logo and Word template will be removed as well." +msgstr "Soll das Branding-Profil %(object)s wirklich gelöscht werden? Logo und Word-Vorlage des Profils werden ebenfalls entfernt." + +#: templates/netbox_customer_export/branding_delete.html:13 +#: templates/netbox_customer_export/branding_edit.html:77 +#: templates/netbox_customer_export/export.html:157 +#: templates/netbox_customer_export/symbol_delete.html:13 +#: templates/netbox_customer_export/symbol_edit.html:62 +msgid "Cancel" +msgstr "Abbrechen" + +#: templates/netbox_customer_export/branding_edit.html:3 +#, python-format +msgid "Edit %(object)s" +msgstr "%(object)s bearbeiten" + +#: templates/netbox_customer_export/branding_edit.html:3 +msgid "New branding profile" +msgstr "Neues Branding-Profil" + +#: templates/netbox_customer_export/branding_edit.html:27 +msgid "Current logo" +msgstr "Aktuelles Logo" + +#: templates/netbox_customer_export/branding_edit.html:38 +msgid "Colours & font" +msgstr "Farben & Schrift" + +#: templates/netbox_customer_export/branding_edit.html:78 +#: templates/netbox_customer_export/branding_list.html:40 +msgid "Preview" +msgstr "Vorschau" + +#: templates/netbox_customer_export/branding_edit.html:79 +#: templates/netbox_customer_export/symbol_edit.html:63 +msgid "Save" +msgstr "Speichern" + +#: templates/netbox_customer_export/branding_list.html:20 +msgid "Company" +msgstr "Firma" + +#: templates/netbox_customer_export/branding_list.html:20 +msgid "Colours" +msgstr "Farben" + +#: templates/netbox_customer_export/branding_list.html:27 +msgid "Default" +msgstr "Standard" + +#: templates/netbox_customer_export/branding_list.html:32 +msgid "Primary" +msgstr "Primär" + +#: templates/netbox_customer_export/branding_list.html:33 +msgid "Accent" +msgstr "Akzent" + +#: templates/netbox_customer_export/branding_list.html:51 +msgid "" +"No branding profiles yet. Until then, the settings from " +"configuration.py apply." +msgstr "Noch keine Branding-Profile angelegt. Bis dahin gelten die Einstellungen aus configuration.py." + +#: templates/netbox_customer_export/document.html:10 +msgid "Page" +msgstr "Seite" + +#: templates/netbox_customer_export/export.html:4 +#, python-format +msgid "Customer documentation: %(object)s" +msgstr "Kundendokumentation: %(object)s" + +#: templates/netbox_customer_export/export.html:39 +msgid "Document" +msgstr "Dokument" + +#: templates/netbox_customer_export/export.html:53 +msgid "Empty = your user name" +msgstr "Leer = dein Benutzername" + +#: templates/netbox_customer_export/export.html:62 +msgid "" +"Applies to management/OOB IPs, VMs, topology, IP networks and IP addresses." +msgstr "Gilt für Management-/OOB-IPs, VMs, Topologie, IP-Netze und IP-Adressen." + +#: templates/netbox_customer_export/export.html:64 +msgid "Options" +msgstr "Optionen" + +#: templates/netbox_customer_export/export.html:82 +#: templates/netbox_customer_export/export.html:103 +msgid "All" +msgstr "Alle" + +#: templates/netbox_customer_export/export.html:82 +#: templates/netbox_customer_export/export.html:103 +msgid "None" +msgstr "Keine" + +#: templates/netbox_customer_export/export.html:106 +msgid "Columns" +msgstr "Spalten" + +#: templates/netbox_customer_export/export.html:116 +msgid "Embed rack elevations" +msgstr "Rack-Ansichten einbetten" + +#: templates/netbox_customer_export/export.html:118 +msgid "Faces" +msgstr "Seiten" + +#: templates/netbox_customer_export/export.html:120 +#: templates/netbox_customer_export/export.html:148 +msgid "More" +msgstr "Weiteres" + +#: templates/netbox_customer_export/export.html:137 +msgid "Topology" +msgstr "Topologie" + +#: templates/netbox_customer_export/export.html:139 +msgid "Manage symbols" +msgstr "Symbole verwalten" + +#: templates/netbox_customer_export/export.html:145 +msgid "" +"“Per rack” additionally shows each rack separately; connected devices " +"outside appear dashed." +msgstr "„Je Rack“ zeigt zusätzlich jedes Rack einzeln; verbundene Geräte außerhalb erscheinen gestrichelt." + +#: templates/netbox_customer_export/export.html:158 +msgid "Create document" +msgstr "Dokument erstellen" + +#: templates/netbox_customer_export/select.html:9 +msgid "Select scope" +msgstr "Scope wählen" + +#: templates/netbox_customer_export/select.html:11 +msgid "Fill in exactly one of the fields." +msgstr "Genau eines der Felder ausfüllen." + +#: templates/netbox_customer_export/select.html:18 +msgid "Continue" +msgstr "Weiter" + +#: templates/netbox_customer_export/symbol_delete.html:3 +msgid "Delete symbol assignment" +msgstr "Symbol-Zuordnung löschen" + +#: templates/netbox_customer_export/symbol_delete.html:9 +#, python-format +msgid "" +"Delete the symbol assignment for %(label)s %(object)s? " +"Automatic detection applies again afterwards. An uploaded icon will be " +"removed as well." +msgstr "Soll die Symbol-Zuordnung für %(label)s %(object)s gelöscht werden? Danach gilt wieder die automatische Erkennung. Ein hochgeladenes Icon wird ebenfalls entfernt." + +#: templates/netbox_customer_export/symbol_edit.html:4 +#, python-format +msgid "Symbol for %(object)s" +msgstr "Symbol für %(object)s" + +#: templates/netbox_customer_export/symbol_edit.html:4 +msgid "New symbol assignment" +msgstr "Neue Symbol-Zuordnung" + +#: templates/netbox_customer_export/symbol_edit.html:23 +msgid "Applies to" +msgstr "Gilt für" + +#: templates/netbox_customer_export/symbol_edit.html:25 +msgid "" +"Select either a device type or a device role. The device type takes " +"precedence." +msgstr "Entweder einen Gerätetyp oder eine Geräterolle wählen. Gerätetyp hat Vorrang." + +#: templates/netbox_customer_export/symbol_edit.html:48 +msgid "Custom icon (optional)" +msgstr "Eigenes Icon (optional)" + +#: templates/netbox_customer_export/symbol_edit.html:50 +msgid "Current icon" +msgstr "Aktuelles Icon" + +#: templates/netbox_customer_export/symbol_edit.html:53 +msgid "" +"If no symbol is selected, automatic detection determines the level in the " +"diagram." +msgstr "Ist kein Symbol gewählt, bestimmt die Automatik die Ebene im Diagramm." + +#: templates/netbox_customer_export/symbol_list.html:7 +msgid "Add assignment" +msgstr "Zuordnung hinzufügen" + +#: templates/netbox_customer_export/symbol_list.html:23 +msgid "Assignments per device type" +msgstr "Zuordnungen je Gerätetyp" + +#: templates/netbox_customer_export/symbol_list.html:24 +msgid "No device types assigned yet." +msgstr "Noch keine Gerätetypen zugeordnet." + +#: templates/netbox_customer_export/symbol_list.html:27 +msgid "Assignments per device role" +msgstr "Zuordnungen je Geräterolle" + +#: templates/netbox_customer_export/symbol_list.html:28 +msgid "No device roles assigned yet." +msgstr "Noch keine Geräterollen zugeordnet." + +#: templates/netbox_customer_export/symbol_list.html:33 +msgid "How the symbol is determined" +msgstr "So wird das Symbol bestimmt" + +#: templates/netbox_customer_export/symbol_list.html:36 +msgid "Device type assignment (custom icon or symbol)" +msgstr "Gerätetyp-Zuordnung (eigenes Icon oder Symbol)" + +#: templates/netbox_customer_export/symbol_list.html:37 +msgid "Device role assignment" +msgstr "Geräterolle-Zuordnung" + +#: templates/netbox_customer_export/symbol_list.html:38 +msgid "" +"Automatic based on role, model and manufacturer, e.g. " +"“Switch”, “Firewall”, “Sophos”, “Access Point”. Patch panels, power strips, " +"PDUs and UPSs are hidden automatically." +msgstr "Automatisch anhand von Rolle, Modell und Hersteller, z.B. „Switch“, „Firewall“, „Sophos“, „Access Point“. Patchpanels, Steckdosenleisten, PDUs und USVs werden automatisch ausgeblendet." + +#: templates/netbox_customer_export/symbol_list.html:44 +msgid "Built-in symbols" +msgstr "Eingebaute Symbole" + +#: topology.py:140 +#, python-format +msgid "Rack %(name)s (%(where)s)" +msgstr "Rack %(name)s (%(where)s)" diff --git a/netbox_customer_export/migrations/0003_i18n_verbose_names.py b/netbox_customer_export/migrations/0003_i18n_verbose_names.py new file mode 100644 index 0000000..d26520b --- /dev/null +++ b/netbox_customer_export/migrations/0003_i18n_verbose_names.py @@ -0,0 +1,44 @@ +# Generated by Django 6.1.2 on 2026-10-26 20:23 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('netbox_customer_export', '0002_topologysymbol'), + ] + + operations = [ + migrations.AlterField( + model_name='brandingprofile', + name='accent_color', + field=models.CharField(default='2E75B6', max_length=6, validators=[django.core.validators.RegexValidator('^[0-9A-Fa-f]{6}$', 'Expected a hex colour without #, e.g. 1F4E79')]), + ), + migrations.AlterField( + model_name='brandingprofile', + name='footer_text', + field=models.CharField(blank=True, default="Confidential – for the customer's internal use only", max_length=300), + ), + migrations.AlterField( + model_name='brandingprofile', + name='header_text_color', + field=models.CharField(default='FFFFFF', max_length=6, validators=[django.core.validators.RegexValidator('^[0-9A-Fa-f]{6}$', 'Expected a hex colour without #, e.g. 1F4E79')]), + ), + migrations.AlterField( + model_name='brandingprofile', + name='label_bg_color', + field=models.CharField(default='DEEAF6', max_length=6, validators=[django.core.validators.RegexValidator('^[0-9A-Fa-f]{6}$', 'Expected a hex colour without #, e.g. 1F4E79')]), + ), + migrations.AlterField( + model_name='brandingprofile', + name='primary_color', + field=models.CharField(default='1F4E79', max_length=6, validators=[django.core.validators.RegexValidator('^[0-9A-Fa-f]{6}$', 'Expected a hex colour without #, e.g. 1F4E79')]), + ), + migrations.AlterField( + model_name='brandingprofile', + name='stripe_color', + field=models.CharField(default='F3F7FB', max_length=6, validators=[django.core.validators.RegexValidator('^[0-9A-Fa-f]{6}$', 'Expected a hex colour without #, e.g. 1F4E79')]), + ), + ] diff --git a/netbox_customer_export/models.py b/netbox_customer_export/models.py index cb2f09e..cd960c5 100644 --- a/netbox_customer_export/models.py +++ b/netbox_customer_export/models.py @@ -1,8 +1,9 @@ from django.core.validators import FileExtensionValidator, MaxValueValidator, MinValueValidator, RegexValidator from django.db import models from django.urls import reverse +from django.utils.translation import gettext_lazy as _ -hex_color = RegexValidator(r"^[0-9A-Fa-f]{6}$", "Hex-Farbe ohne # erwartet, z.B. 1F4E79") +hex_color = RegexValidator(r"^[0-9A-Fa-f]{6}$", _("Expected a hex colour without #, e.g. 1F4E79")) def _color(default, verbose_name): @@ -12,36 +13,36 @@ def _color(default, verbose_name): class BrandingProfile(models.Model): """In NetBox gepflegtes Design-Profil (Alternative/Ergänzung zu PLUGINS_CONFIG['brandings']).""" - name = models.CharField(max_length=100, unique=True, verbose_name="Name") - is_default = models.BooleanField(default=False, verbose_name="Standardprofil") - company_name = models.CharField(max_length=200, blank=True, verbose_name="Firmenname") + name = models.CharField(max_length=100, unique=True, verbose_name=_("Name")) + is_default = models.BooleanField(default=False, verbose_name=_("Default profile")) + company_name = models.CharField(max_length=200, blank=True, verbose_name=_("Company name")) footer_text = models.CharField( - max_length=300, blank=True, default="Vertraulich – nur für den internen Gebrauch des Kunden", verbose_name="Fußzeile" + max_length=300, blank=True, default="Confidential – for the customer's internal use only", verbose_name=_("Footer") ) - logo = models.ImageField(upload_to="customer-export/logos/", blank=True, verbose_name="Logo") - primary_color = _color("1F4E79", "Primärfarbe") - accent_color = _color("2E75B6", "Akzentfarbe") - header_text_color = _color("FFFFFF", "Schrift Tabellenkopf") - label_bg_color = _color("DEEAF6", "Hintergrund Beschriftungen") - stripe_color = _color("F3F7FB", "Zebrastreifen") - font_family = models.CharField(max_length=100, default="Calibri", verbose_name="Schriftart") + logo = models.ImageField(upload_to="customer-export/logos/", blank=True, verbose_name=_("Logo")) + primary_color = _color("1F4E79", _("Primary colour")) + accent_color = _color("2E75B6", _("Accent colour")) + header_text_color = _color("FFFFFF", _("Table header text")) + label_bg_color = _color("DEEAF6", _("Label background")) + stripe_color = _color("F3F7FB", _("Row stripes")) + font_family = models.CharField(max_length=100, default="Calibri", verbose_name=_("Font")) font_size = models.PositiveSmallIntegerField( - default=10, validators=[MinValueValidator(7), MaxValueValidator(16)], verbose_name="Schriftgröße (pt)" + default=10, validators=[MinValueValidator(7), MaxValueValidator(16)], verbose_name=_("Font size (pt)") ) docx_template = models.FileField( upload_to="customer-export/templates/", blank=True, validators=[FileExtensionValidator(["docx", "dotx"])], - verbose_name="Word-Vorlage", + verbose_name=_("Word template"), ) - docx_table_style = models.CharField(max_length=100, blank=True, verbose_name="Tabellenformatvorlage (Word)") - extra_css = models.TextField(blank=True, verbose_name="Zusätzliches CSS (PDF/HTML)") + docx_table_style = models.CharField(max_length=100, blank=True, verbose_name=_("Table style (Word)")) + extra_css = models.TextField(blank=True, verbose_name=_("Additional CSS (PDF/HTML)")) last_updated = models.DateTimeField(auto_now=True) class Meta: ordering = ("-is_default", "name") - verbose_name = "Branding-Profil" - verbose_name_plural = "Branding-Profile" + verbose_name = _("branding profile") + verbose_name_plural = _("branding profiles") def __str__(self): return self.name @@ -80,19 +81,19 @@ class TopologySymbol(models.Model): """Topologie-Symbol für einen Gerätetyp oder eine Geräterolle (Gerätetyp hat Vorrang).""" device_type = models.OneToOneField( - "dcim.DeviceType", on_delete=models.CASCADE, null=True, blank=True, related_name="+", verbose_name="Gerätetyp" + "dcim.DeviceType", on_delete=models.CASCADE, null=True, blank=True, related_name="+", verbose_name=_("Device type") ) role = models.OneToOneField( - "dcim.DeviceRole", on_delete=models.CASCADE, null=True, blank=True, related_name="+", verbose_name="Geräterolle" + "dcim.DeviceRole", on_delete=models.CASCADE, null=True, blank=True, related_name="+", verbose_name=_("Device role") ) - kind = models.CharField(max_length=20, blank=True, verbose_name="Symbol") - icon = models.ImageField(upload_to="customer-export/symbols/", blank=True, verbose_name="Eigenes Icon") + kind = models.CharField(max_length=20, blank=True, verbose_name=_("Symbol")) + icon = models.ImageField(upload_to="customer-export/symbols/", blank=True, verbose_name=_("Custom icon")) last_updated = models.DateTimeField(auto_now=True) class Meta: ordering = ("device_type__model", "role__name") - verbose_name = "Topologie-Symbol" - verbose_name_plural = "Topologie-Symbole" + verbose_name = _("topology symbol") + verbose_name_plural = _("topology symbols") def __str__(self): return str(self.device_type or self.role) @@ -102,17 +103,17 @@ class TopologySymbol(models.Model): @property def target_label(self): - return "Gerätetyp" if self.device_type_id else "Geräterolle" + return _("Device type") if self.device_type_id else _("Device role") def get_kind_display(self): from .symbols import KIND_CHOICES - return dict(KIND_CHOICES).get(self.kind, "Automatisch") + return dict(KIND_CHOICES).get(self.kind, _("Automatic")) def clean(self): from django.core.exceptions import ValidationError if bool(self.device_type_id) == bool(self.role_id): - raise ValidationError("Bitte genau einen Gerätetyp oder eine Geräterolle wählen.") + raise ValidationError(_("Select exactly one device type or one device role.")) if not self.kind and not self.icon: - raise ValidationError("Bitte ein Symbol wählen oder ein eigenes Icon hochladen.") + raise ValidationError(_("Select a symbol or upload a custom icon.")) diff --git a/netbox_customer_export/navigation.py b/netbox_customer_export/navigation.py index 6bc922e..1ecb406 100644 --- a/netbox_customer_export/navigation.py +++ b/netbox_customer_export/navigation.py @@ -1,19 +1,20 @@ +from django.utils.translation import gettext_lazy as _ from netbox.plugins import PluginMenuButton, PluginMenuItem menu_items = ( PluginMenuItem( link="plugins:netbox_customer_export:select", - link_text="Kundendokumentation", + link_text=_("Customer Documentation"), permissions=["dcim.view_site"], ), PluginMenuItem( link="plugins:netbox_customer_export:symbol_list", - link_text="Topologie-Symbole", + link_text=_("Topology Symbols"), permissions=["netbox_customer_export.view_topologysymbol"], buttons=( PluginMenuButton( link="plugins:netbox_customer_export:symbol_add", - title="Hinzufügen", + title=_("Add"), icon_class="mdi mdi-plus-thick", permissions=["netbox_customer_export.add_topologysymbol"], ), @@ -21,12 +22,12 @@ menu_items = ( ), PluginMenuItem( link="plugins:netbox_customer_export:branding_list", - link_text="Branding-Profile", + link_text=_("Branding Profiles"), permissions=["netbox_customer_export.view_brandingprofile"], buttons=( PluginMenuButton( link="plugins:netbox_customer_export:branding_add", - title="Hinzufügen", + title=_("Add"), icon_class="mdi mdi-plus-thick", permissions=["netbox_customer_export.add_brandingprofile"], ), diff --git a/netbox_customer_export/renderers/__init__.py b/netbox_customer_export/renderers/__init__.py index 55febd4..221c1f9 100644 --- a/netbox_customer_export/renderers/__init__.py +++ b/netbox_customer_export/renderers/__init__.py @@ -1,3 +1,6 @@ +from django.utils.translation import gettext as _ + + class MissingDependency(Exception): pass @@ -18,6 +21,6 @@ def render(doc, fmt, request=None): try: from weasyprint import HTML except (ImportError, OSError) as e: - raise MissingDependency(f"PDF-Export benötigt WeasyPrint (pip install weasyprint + Pango): {e}") + raise MissingDependency(_("PDF export requires WeasyPrint (pip install weasyprint + Pango): %(error)s") % {"error": e}) base_url = request.build_absolute_uri("/") if request else None return HTML(string=html, base_url=base_url).write_pdf(), "application/pdf", "pdf" diff --git a/netbox_customer_export/renderers/docx.py b/netbox_customer_export/renderers/docx.py index 5487d53..fa8285c 100644 --- a/netbox_customer_export/renderers/docx.py +++ b/netbox_customer_export/renderers/docx.py @@ -1,6 +1,8 @@ import zipfile from io import BytesIO +from django.utils.translation import gettext as _ + from . import MissingDependency DOTX_TYPE = b"application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml" @@ -46,7 +48,7 @@ def render_docx(doc): from docx.oxml.ns import qn from docx.shared import Cm, Pt, RGBColor except ImportError as e: - raise MissingDependency(f"Word-Export benötigt python-docx (pip install python-docx cairosvg): {e}") + raise MissingDependency(_("Word export requires python-docx (pip install python-docx cairosvg): %(error)s") % {"error": e}) b = doc.branding primary = RGBColor.from_string(b["primary_color"]) @@ -56,7 +58,7 @@ def render_docx(doc): try: d = _load_template(template) except (OSError, KeyError, zipfile.BadZipFile) as e: - raise MissingDependency(f"Word-Vorlage {template!r} konnte nicht geladen werden: {e}") + raise MissingDependency(_("Word template %(path)r could not be loaded: %(error)s") % {"path": template, "error": e}) else: # Ohne Vorlage: Standarddokument mit Farben/Schrift aus dem Branding d = Docx() @@ -92,7 +94,7 @@ def render_docx(doc): meta = doc.meta if b.get("logo_path"): d.add_picture(b["logo_path"], width=Cm(5)) - for _ in range(6): + for _blank in range(6): d.add_paragraph() title = d.add_paragraph() run = title.add_run(doc.title) @@ -102,13 +104,13 @@ def render_docx(doc): d.add_paragraph().add_run(doc.subtitle).font.size = Pt(16) d.add_paragraph() info = d.add_paragraph() - for label, value in (("Stand", meta.get("date")), ("Erstellt von", meta.get("author")), ("", b.get("company_name"))): + for label, value in ((_("As of"), meta.get("date")), (_("Created by"), meta.get("author")), ("", b.get("company_name"))): if value: info.add_run(f"{label + ': ' if label else ''}{value}\n") d.add_page_break() # Inhaltsverzeichnis (wird beim Öffnen in Word aktualisiert) - d.add_heading("Inhaltsverzeichnis", level=1) + d.add_heading(_("Table of contents"), level=1) fld = OxmlElement("w:fldSimple") fld.set(qn("w:instr"), 'TOC \\o "1-2" \\h \\z \\u') d.add_paragraph()._p.append(fld) @@ -212,7 +214,7 @@ def render_docx(doc): # Topologie: volle Breite; Racks: 7 cm (Höhe skaliert mit der Rackgröße) cell.add_run().add_picture(BytesIO(png), width=Cm(16.5 if blk.level == 1 else 7)) else: - cell.add_run("(Rack-Grafik nicht verfügbar)") + cell.add_run(_("(rack graphic not available)")) cap = t.cell(1, i).paragraphs[0] cap.alignment = WD_ALIGN_PARAGRAPH.CENTER if img["caption"]: diff --git a/netbox_customer_export/scope.py b/netbox_customer_export/scope.py index 28ab4c6..f573e1e 100644 --- a/netbox_customer_export/scope.py +++ b/netbox_customer_export/scope.py @@ -1,5 +1,6 @@ """Ermittelt, welche Objekte zu einem Export-Scope (Standort, Lokation, Mandant, Mandantengruppe) gehören.""" from django.db.models import Q +from django.utils.translation import gettext_lazy as _ from circuits.models import Circuit from dcim.models import Device, Location, PowerFeed, Rack, Site @@ -16,10 +17,10 @@ SCOPE_MODELS = { } SCOPE_LABELS = { - "site": "Standort", - "location": "Lokation", - "tenant": "Mandant", - "tenantgroup": "Mandantengruppe", + "site": _("Site"), + "location": _("Location"), + "tenant": _("Tenant"), + "tenantgroup": _("Tenant group"), } NONE = Q(pk__in=[]) diff --git a/netbox_customer_export/sections.py b/netbox_customer_export/sections.py index d1dd557..1ed5e39 100644 --- a/netbox_customer_export/sections.py +++ b/netbox_customer_export/sections.py @@ -5,6 +5,8 @@ from itertools import groupby from django.apps import apps from django.contrib.contenttypes.models import ContentType +from django.utils.translation import gettext as _ +from django.utils.translation import gettext_lazy from netbox.plugins import get_plugin_config from .blocks import EMPTY, H, IMAGES, KV, LANDSCAPE, P, PAGEBREAK, T, get @@ -55,25 +57,25 @@ def primary_ips(obj, opts, sep=", "): def _rack_pos(d, o=None): if not d.rack: return None - pos = f" / HE {d.position:g}" if d.position else "" + pos = " / " + _("U %(u)s") % {"u": f"{d.position:g}"} if d.position else "" return f"{d.rack}{pos}" DEVICE_COLUMNS = OrderedDict( [ - ("name", ("Name", lambda d, o: d.name or str(d))), - ("model", ("Hersteller / Modell", lambda d, o: f"{d.device_type.manufacturer} {d.device_type.model}")), - ("site", ("Standort", lambda d, o: d.site)), - ("location", ("Lokation", lambda d, o: d.location)), - ("rack", ("Rack / HE", _rack_pos)), - ("status", ("Status", lambda d, o: d.get_status_display())), - ("platform", ("Plattform / OS", lambda d, o: d.platform)), - ("primary_ip", ("Management-IP", lambda d, o: primary_ips(d, o))), - ("oob_ip", ("OOB-IP", lambda d, o: ip_text([d.oob_ip], o))), - ("serial", ("Seriennummer", lambda d, o: d.serial)), - ("asset_tag", ("Inventarnr.", lambda d, o: d.asset_tag)), - ("tenant", ("Mandant", lambda d, o: d.tenant)), - ("description", ("Beschreibung", lambda d, o: d.description)), + ("name", (gettext_lazy("Name"), lambda d, o: d.name or str(d))), + ("model", (gettext_lazy("Manufacturer / model"), lambda d, o: f"{d.device_type.manufacturer} {d.device_type.model}")), + ("site", (gettext_lazy("Site"), lambda d, o: d.site)), + ("location", (gettext_lazy("Location"), lambda d, o: d.location)), + ("rack", (gettext_lazy("Rack / U"), _rack_pos)), + ("status", (gettext_lazy("Status"), lambda d, o: d.get_status_display())), + ("platform", (gettext_lazy("Platform / OS"), lambda d, o: d.platform)), + ("primary_ip", (gettext_lazy("Management IP"), lambda d, o: primary_ips(d, o))), + ("oob_ip", (gettext_lazy("OOB IP"), lambda d, o: ip_text([d.oob_ip], o))), + ("serial", (gettext_lazy("Serial number"), lambda d, o: d.serial)), + ("asset_tag", (gettext_lazy("Asset tag"), lambda d, o: d.asset_tag)), + ("tenant", (gettext_lazy("Tenant"), lambda d, o: d.tenant)), + ("description", (gettext_lazy("Description"), lambda d, o: d.description)), ] ) DEFAULT_DEVICE_COLUMNS = ["name", "model", "location", "rack", "primary_ip", "serial"] @@ -84,44 +86,44 @@ def _device_table(devices, columns, opts): return T([c[0] for c in cols], [[c[1](d, opts) for c in cols] for d in devices]) -def _empty(opts, blocks, text="Keine Einträge vorhanden."): +def _empty(opts, blocks, text=None): if opts.get("include_empty"): - blocks.append(P(text)) + blocks.append(P(text or _("No entries."))) return blocks return [] # --- Abschnitte ------------------------------------------------------------- -@section("overview", "Übersicht & Standortdaten", "Allgemein", hint="Kennzahlen, Adressen, Lokationsbaum") +@section("overview", gettext_lazy("Overview & site data"), gettext_lazy("General"), hint=gettext_lazy("Key figures, addresses, location tree")) def overview(scope, opts): - blocks = [H(1, "Übersicht")] + blocks = [H(1, _("Overview"))] counts = [ - ("Standorte", scope.sites().count()), - ("Racks", scope.racks().count()), - ("Geräte", scope.devices().count()), - ("Virtuelle Maschinen", scope.virtual_machines().count()), - ("Präfixe", scope.prefixes().count()), - ("VLANs", scope.vlans().count()), - ("Leitungen", scope.circuits().count()), + (_("Sites"), scope.sites().count()), + (_("Racks"), scope.racks().count()), + (_("Devices"), scope.devices().count()), + (_("Virtual machines"), scope.virtual_machines().count()), + (_("Prefixes"), scope.prefixes().count()), + (_("VLANs"), scope.vlans().count()), + (_("Circuits"), scope.circuits().count()), ] blocks.append(KV([(f"{scope.label}", scope.obj)] + counts)) if getattr(scope.obj, "description", ""): blocks.append(P(scope.obj.description)) for site in scope.sites().select_related("region", "group", "tenant"): - blocks.append(H(2, f"Standort {site.name}")) + blocks.append(H(2, _("Site %(name)s") % {"name": site.name})) blocks.append( KV( [ - ("Status", site.get_status_display()), - ("Region", site.region), - ("Mandant", site.tenant), - ("Einrichtung", site.facility), - ("Anschrift", site.physical_address), - ("Lieferanschrift", site.shipping_address), - ("Zeitzone", site.time_zone), - ("Beschreibung", site.description), + (_("Status"), site.get_status_display()), + (_("Region"), site.region), + (_("Tenant"), site.tenant), + (_("Facility"), site.facility), + (_("Physical address"), site.physical_address), + (_("Shipping address"), site.shipping_address), + (_("Time zone"), site.time_zone), + (_("Description"), site.description), ] ) ) @@ -129,20 +131,20 @@ def overview(scope, opts): if locs.exists(): blocks.append( T( - ["Lokation", "Übergeordnet", "Status", "Beschreibung"], + [_("Location"), _("Parent"), _("Status"), _("Description")], [[(" " * loc.level) + loc.name, loc.parent, loc.get_status_display(), loc.description] for loc in locs], ) ) return blocks -@section("contacts", "Ansprechpartner", "Allgemein", hint="Kontakte an Standorten, Lokationen, Mandanten") +@section("contacts", gettext_lazy("Contacts"), gettext_lazy("General"), hint=gettext_lazy("Contacts of sites, locations, tenants")) def contacts(scope, opts): ContactAssignment = apps.get_model("tenancy", "ContactAssignment") targets = [ - (scope.sites(), "Standort"), - (scope.location_objects(), "Lokation"), - (scope.tenant_objects(), "Mandant"), + (scope.sites(), _("Site")), + (scope.location_objects(), _("Location")), + (scope.tenant_objects(), _("Tenant")), ] rows = [] for qs, label in targets: @@ -154,39 +156,39 @@ def contacts(scope, opts): rows.append( [f"{label}: {a.object}", a.contact.name, a.role, a.get_priority_display(), a.contact.phone, a.contact.email] ) - blocks = [H(1, "Ansprechpartner")] + blocks = [H(1, _("Contacts"))] if not rows: return _empty(opts, blocks) - blocks.append(T(["Zuordnung", "Name", "Rolle", "Priorität", "Telefon", "E-Mail"], rows)) + blocks.append(T([_("Assigned to"), _("Name"), _("Role"), _("Priority"), _("Phone"), _("Email")], rows)) return blocks -@section("racks", "Racks", "Infrastruktur", hint="Nach Standort & Lokation, mit Rack-Ansicht") +@section("racks", gettext_lazy("Racks"), gettext_lazy("Infrastructure"), hint=gettext_lazy("By site & location, with rack elevation")) def racks(scope, opts): qs = ( scope.racks() .select_related("site", "location", "role", "tenant", "rack_type") .order_by("site__name", "location__name", "name") ) - blocks = [H(1, "Racks")] + blocks = [H(1, _("Racks"))] if not qs.exists(): return _empty(opts, blocks) for site, site_racks in groupby(qs, key=lambda r: r.site): - blocks.append(H(2, f"Standort {site}")) + blocks.append(H(2, _("Site %(name)s") % {"name": site})) for location, loc_racks in groupby(site_racks, key=lambda r: r.location): - blocks.append(H(3, f"Lokation {location}" if location else "Ohne Lokation")) + blocks.append(H(3, _("Location %(name)s") % {"name": location} if location else _("No location"))) for rack in loc_racks: - blocks.append(H(4, f"Rack {rack.name}")) + blocks.append(H(4, _("Rack %(name)s") % {"name": rack.name})) blocks.append( KV( [ - ("Status", rack.get_status_display()), - ("Rolle", rack.role), - ("Typ", rack.rack_type), - ("Höhe", f"{rack.u_height} HE"), - ("Facility-ID", rack.facility_id), - ("Mandant", rack.tenant), - ("Beschreibung", rack.description), + (_("Status"), rack.get_status_display()), + (_("Role"), rack.role), + (_("Type"), rack.rack_type), + (_("Height"), _("%(u)s U") % {"u": rack.u_height}), + (_("Facility ID"), rack.facility_id), + (_("Tenant"), rack.tenant), + (_("Description"), rack.description), ] ) ) @@ -197,7 +199,7 @@ def racks(scope, opts): ) with_images = bool(opts.get("rack_images")) for face in opts.get("rack_faces") or ["front"]: - caption = "Vorderseite" if face == "front" else "Rückseite" + caption = _("Front") if face == "front" else _("Rear") svg, svg_error = render_rack_svg(rack, face, scope.user, images=with_images, devices=rack_devs) png = None # PNG wird für Word gebraucht (falls kein cairosvg) und ersetzt ein fehlgeschlagenes SVG @@ -209,7 +211,7 @@ def racks(scope, opts): if svg or png: images.append((svg, caption, png)) else: - errors.append(f"Rack-Ansicht ({caption}) konnte nicht erzeugt werden: {svg_error}") + errors.append(_("Rack elevation (%(face)s) could not be created: %(error)s") % {"face": caption, "error": svg_error}) if images: blocks.append(IMAGES(images)) blocks += [P(e) for e in errors] @@ -218,7 +220,7 @@ def racks(scope, opts): if devs.exists(): blocks.append( T( - ["HE", "Gerät", "Hersteller / Modell", "Seite"], + [_("U"), _("Device"), _("Manufacturer / model"), _("Face")], [ [f"{d.position:g}" if d.position else EMPTY, d.name, f"{d.device_type.manufacturer} {d.device_type.model}", d.get_face_display() if d.face else EMPTY] for d in devs @@ -230,9 +232,9 @@ def racks(scope, opts): return blocks -@section("devices", "Geräte", "Infrastruktur", hint="Tabellen je Geräterolle") +@section("devices", gettext_lazy("Devices"), gettext_lazy("Infrastructure"), hint=gettext_lazy("Tables per device role")) def devices(scope, opts): - blocks = [H(1, "Geräte")] + blocks = [H(1, _("Devices"))] base = scope.devices().select_related( "device_type__manufacturer", "role", "site", "location", "rack", "platform", "primary_ip4", "primary_ip6", "oob_ip", "tenant" ) @@ -246,127 +248,127 @@ def devices(scope, opts): blocks.append(H(2, role.name)) if opts.get("group_by_site"): for site, site_devs in groupby(devs, key=lambda d: d.site): - blocks.append(H(3, f"Standort {site}")) + blocks.append(H(3, _("Site %(name)s") % {"name": site})) blocks.append(_device_table(list(site_devs), columns, opts)) else: blocks.append(_device_table(devs, columns, opts)) return blocks if found else _empty(opts, blocks) -@section("disks", "Datenträger & RAID", "Infrastruktur", default=False, hint="Aus Netbox-Utilities (falls installiert)") +@section("disks", gettext_lazy("Disks & RAID"), gettext_lazy("Infrastructure"), default=False, hint=gettext_lazy("From Netbox-Utilities (if installed)")) def disks(scope, opts): from . import disks_utilities - blocks = [H(1, "Datenträger & RAID")] + blocks = [H(1, _("Disks & RAID"))] if not disks_utilities.is_installed(): - return _empty(opts, blocks, "Netbox-Utilities mit Datenträger-Verwaltung ist nicht installiert – siehe README.") + return _empty(opts, blocks, _("Netbox-Utilities with disk management is not installed – see README.")) blocks += disks_utilities.disk_blocks(scope, opts) return blocks if len(blocks) > 1 else _empty(opts, blocks) -@section("power", "Stromversorgung", "Infrastruktur", default=False, hint="Power Panels & Feeds") +@section("power", gettext_lazy("Power"), gettext_lazy("Infrastructure"), default=False, hint=gettext_lazy("Power panels & feeds")) def power(scope, opts): qs = scope.power_feeds().select_related("power_panel", "rack").order_by("power_panel__name", "name") - blocks = [H(1, "Stromversorgung")] + blocks = [H(1, _("Power"))] if not qs.exists(): return _empty(opts, blocks) blocks.append( T( - ["Panel", "Feed", "Rack", "Status", "Typ", "Phase", "Spannung", "Ampere"], + [_("Panel"), _("Feed"), _("Rack"), _("Status"), _("Type"), _("Phase"), _("Voltage"), _("Amperage")], [[f.power_panel, f.name, f.rack, get(f, "status"), get(f, "type"), get(f, "phase"), f"{f.voltage} V", f"{f.amperage} A"] for f in qs], ) ) return blocks -@section("vms", "Virtuelle Maschinen", "Infrastruktur", default=False, hint="Cluster, Ressourcen, IP") +@section("vms", gettext_lazy("Virtual machines"), gettext_lazy("Infrastructure"), default=False, hint=gettext_lazy("Cluster, resources, IP")) def vms(scope, opts): qs = scope.virtual_machines().select_related("cluster", "role", "platform", "primary_ip4", "primary_ip6").order_by("cluster__name", "name") - blocks = [H(1, "Virtuelle Maschinen")] + blocks = [H(1, _("Virtual machines"))] if not qs.exists(): return _empty(opts, blocks) blocks.append( T( - ["Name", "Cluster", "Rolle", "Status", "OS", "vCPU", "RAM (MB)", "Disk (MB)", "IP"], + [_("Name"), _("Cluster"), _("Role"), _("Status"), _("OS"), "vCPU", _("RAM (MB)"), _("Disk (MB)"), "IP"], [[vm.name, vm.cluster, vm.role, get(vm, "status"), vm.platform, vm.vcpus, vm.memory, vm.disk, primary_ips(vm, opts)] for vm in qs], ) ) return blocks -@section("vrfs", "VRFs", "Netzwerk", hint="Inkl. Route Targets") +@section("vrfs", gettext_lazy("VRFs"), gettext_lazy("Network"), hint=gettext_lazy("Including route targets")) def vrfs(scope, opts): qs = scope.vrfs().select_related("tenant").prefetch_related("import_targets", "export_targets").order_by("name") - blocks = [H(1, "VRFs")] + blocks = [H(1, _("VRFs"))] if not qs.exists(): return _empty(opts, blocks) blocks.append( T( - ["Name", "RD", "Mandant", "Import-RT", "Export-RT", "Beschreibung"], + [_("Name"), "RD", _("Tenant"), _("Import RT"), _("Export RT"), _("Description")], [[v.name, v.rd, v.tenant, v.import_targets, v.export_targets, v.description] for v in qs], ) ) return blocks -@section("prefixes", "IP-Netze", "Netzwerk", hint="Präfixe gruppiert nach VRF") +@section("prefixes", gettext_lazy("IP networks"), gettext_lazy("Network"), hint=gettext_lazy("Prefixes grouped by VRF")) def prefixes(scope, opts): qs = scope.prefixes().select_related("vrf", "vlan", "role", "tenant").order_by("vrf__name", "prefix") qs = qs.filter(prefix__family__in=ip_versions(opts)) - blocks = [H(1, "IP-Netze")] + blocks = [H(1, _("IP networks"))] if not qs.exists(): return _empty(opts, blocks) for vrf, items in groupby(qs, key=lambda p: p.vrf): - blocks.append(H(2, f"VRF {vrf}" if vrf else "Global")) + blocks.append(H(2, f"VRF {vrf}" if vrf else _("Global"))) blocks.append( T( - ["Präfix", "VLAN", "Rolle", "Status", "Scope", "Beschreibung"], + [_("Prefix"), "VLAN", _("Role"), _("Status"), _("Scope"), _("Description")], [[p.prefix, p.vlan, p.role, get(p, "status"), p.scope, p.description] for p in items], ) ) return blocks -@section("vlans", "VLANs", "Netzwerk", hint="VID, Name, Gruppe, Rolle") +@section("vlans", gettext_lazy("VLANs"), gettext_lazy("Network"), hint=gettext_lazy("VID, name, group, role")) def vlans(scope, opts): qs = scope.vlans().select_related("group", "site", "role", "tenant").order_by("group__name", "vid") - blocks = [H(1, "VLANs")] + blocks = [H(1, _("VLANs"))] if not qs.exists(): return _empty(opts, blocks) blocks.append( T( - ["VID", "Name", "Gruppe", "Standort", "Rolle", "Status", "Beschreibung"], + ["VID", _("Name"), _("Group"), _("Site"), _("Role"), _("Status"), _("Description")], [[v.vid, v.name, v.group, v.site, v.role, get(v, "status"), v.description] for v in qs], ) ) return blocks -@section("ips", "IP-Adressen", "Netzwerk", default=False, hint="Ausführlich – kann lang werden") +@section("ips", gettext_lazy("IP addresses"), gettext_lazy("Network"), default=False, hint=gettext_lazy("Detailed – can get long")) def ips(scope, opts): qs = scope.ip_addresses().select_related("vrf", "tenant").prefetch_related("assigned_object").order_by("vrf__name", "address") qs = qs.filter(address__family__in=ip_versions(opts)) - blocks = [H(1, "IP-Adressen")] + blocks = [H(1, _("IP addresses"))] if not qs.exists(): return _empty(opts, blocks) for vrf, items in groupby(qs, key=lambda i: i.vrf): - blocks.append(H(2, f"VRF {vrf}" if vrf else "Global")) + blocks.append(H(2, f"VRF {vrf}" if vrf else _("Global"))) rows = [] for ip in items: obj = ip.assigned_object parent = getattr(obj, "parent_object", None) rows.append([ip.address, get(ip, "status"), get(ip, "role"), ip.dns_name, f"{parent} – {obj}" if parent else obj, ip.description]) - blocks.append(T(["Adresse", "Status", "Rolle", "DNS-Name", "Zugewiesen an", "Beschreibung"], rows)) + blocks.append(T([_("Address"), _("Status"), _("Role"), _("DNS name"), _("Assigned to"), _("Description")], rows)) return blocks -@section("wireless", "WLANs", "Netzwerk", default=False, hint="SSIDs, Authentifizierung") +@section("wireless", gettext_lazy("Wireless LANs"), gettext_lazy("Network"), default=False, hint=gettext_lazy("SSIDs, authentication")) def wireless(scope, opts): qs = scope.wireless_lans().select_related("group", "vlan").order_by("ssid") - blocks = [H(1, "WLANs")] + blocks = [H(1, _("Wireless LANs"))] if not qs.exists(): return _empty(opts, blocks) - headers = ["SSID", "Gruppe", "VLAN", "Status", "Authentifizierung", "Verschlüsselung"] + headers = ["SSID", _("Group"), "VLAN", _("Status"), _("Authentication"), _("Cipher")] show_psk = opts.get("include_secrets") if show_psk: headers.append("PSK") @@ -380,15 +382,15 @@ def wireless(scope, opts): return blocks -@section("circuits", "Leitungen", "Netzwerk", default=False, hint="Provider, Leitungs-ID, Bandbreite") +@section("circuits", gettext_lazy("Circuits"), gettext_lazy("Network"), default=False, hint=gettext_lazy("Provider, circuit ID, bandwidth")) def circuits(scope, opts): qs = scope.circuits().select_related("provider", "type", "tenant").order_by("provider__name", "cid") - blocks = [H(1, "Leitungen")] + blocks = [H(1, _("Circuits"))] if not qs.exists(): return _empty(opts, blocks) blocks.append( T( - ["Leitungs-ID", "Provider", "Typ", "Status", "Bandbreite (Kbit/s)", "Beschreibung"], + [_("Circuit ID"), _("Provider"), _("Type"), _("Status"), _("Commit rate (Kbps)"), _("Description")], [[c.cid, c.provider, c.type, get(c, "status"), c.commit_rate, c.description] for c in qs], ) ) @@ -402,23 +404,23 @@ DEFAULT_LICENSE_SOURCES = [ "model": "netbox_lifecycle.licenseassignment", "device_field": "device", "columns": [ - ("Lizenz", "license"), - ("Hersteller", "license.manufacturer"), - ("Gerät", "device"), - ("Anzahl", "quantity"), - ("Vertrag", "license.contract"), - ("Beschreibung", "description"), + (gettext_lazy("License"), "license"), + (gettext_lazy("Manufacturer"), "license.manufacturer"), + (gettext_lazy("Device"), "device"), + (gettext_lazy("Quantity"), "quantity"), + (gettext_lazy("Contract"), "license.contract"), + (gettext_lazy("Description"), "description"), ], }, ] -@section("licenses", "Lizenzen", "Verträge & Lizenzen", hint="Aus NetBox-SLM oder anderem Lizenz-Plugin") +@section("licenses", gettext_lazy("Licenses"), gettext_lazy("Contracts & licenses"), hint=gettext_lazy("From NetBox-SLM or another license plugin")) def licenses(scope, opts): from . import licenses_slm sources = get_plugin_config("netbox_customer_export", "license_sources") or DEFAULT_LICENSE_SOURCES - blocks = [H(1, "Lizenzen")] + blocks = [H(1, _("Licenses"))] found_source = False if licenses_slm.is_installed(): found_source = True @@ -439,15 +441,15 @@ def licenses(scope, opts): cols = src["columns"] blocks.append(T([c[0] for c in cols], [[get(o, c[1]) for c in cols] for o in qs])) if not found_source: - return _empty(opts, blocks, "Kein Lizenz-Plugin installiert (NetBox-SLM oder netbox-lifecycle) – siehe README.") + return _empty(opts, blocks, _("No license plugin installed (NetBox-SLM or netbox-lifecycle) – see README.")) return blocks if len(blocks) > 1 else _empty(opts, blocks) -@section("topology", "Netzwerk-Topologie", "Netzwerk", default=False, hint="Diagramm mit Symbolen, wie Packet Tracer") +@section("topology", gettext_lazy("Network topology"), gettext_lazy("Network"), default=False, hint=gettext_lazy("Diagram with symbols, like Packet Tracer")) def topology(scope, opts): from .topology import build_graphs, render_png - title = H(1, "Netzwerk-Topologie") + title = H(1, _("Network topology")) scopes = opts.get("topo_scope") or ["site"] ports = "ports" in (opts.get("topo_details") or []) pages = [] # (Überschriften, Graph) – je eine Querformat-Seite @@ -456,9 +458,9 @@ def topology(scope, opts): if "rack" in scopes: racks = build_graphs(scope, opts, per="rack") # Rack-Seiten unter einer gemeinsamen Zwischenüberschrift, Racks selbst eine Ebene tiefer (kürzeres Inhaltsverzeichnis) - pages += [(([H(2, "Topologie je Rack")] if i == 0 else []) + [H(3, g.title)], g) for i, g in enumerate(racks)] + pages += [(([H(2, _("Topology per rack"))] if i == 0 else []) + [H(3, g.title)], g) for i, g in enumerate(racks)] if not pages: - return _empty(opts, [title], "Keine verkabelten Geräte gefunden.") + return _empty(opts, [title], _("No cabled devices found.")) # Die Abschnittsüberschrift steht mit auf der ersten Seite return [ LANDSCAPE(([title] if i == 0 else []) + headings, render_png(g, show_ports=ports)) diff --git a/netbox_customer_export/symbol_views.py b/netbox_customer_export/symbol_views.py index 6df5418..24e1e1b 100644 --- a/netbox_customer_export/symbol_views.py +++ b/netbox_customer_export/symbol_views.py @@ -4,6 +4,7 @@ from django.contrib.auth.mixins import LoginRequiredMixin, PermissionRequiredMix from django.http import Http404, HttpResponse from django.shortcuts import get_object_or_404, redirect, render from django.urls import reverse +from django.utils.translation import gettext as _ from django.views import View from .forms import TopologySymbolForm @@ -75,7 +76,7 @@ class SymbolEditView(PermissionRequiredMixin, View): form = TopologySymbolForm(request.POST, request.FILES, instance=obj) if form.is_valid(): obj = form.save() - messages.success(request, f"Topologie-Symbol für „{obj}“ gespeichert.") + messages.success(request, _("Topology symbol for “%(name)s” saved.") % {"name": obj}) return redirect(f"plugins:{APP}:symbol_list") return self._render(request, obj, form) @@ -92,5 +93,5 @@ class SymbolDeleteView(PermissionRequiredMixin, View): if obj.icon: obj.icon.delete(save=False) obj.delete() - messages.success(request, f"Topologie-Symbol für „{name}“ gelöscht – es gilt wieder die automatische Erkennung.") + messages.success(request, _("Topology symbol for “%(name)s” deleted – automatic detection applies again.") % {"name": name}) return redirect(f"plugins:{APP}:symbol_list") diff --git a/netbox_customer_export/symbols.py b/netbox_customer_export/symbols.py index 41e1c06..bcc4f29 100644 --- a/netbox_customer_export/symbols.py +++ b/netbox_customer_export/symbols.py @@ -4,34 +4,36 @@ from collections import OrderedDict from functools import lru_cache from io import BytesIO +from django.utils.translation import gettext_lazy as _ + # Schlüssel -> (Bezeichnung, Ebene im Diagramm; kleiner = weiter oben) KINDS = OrderedDict( [ - ("cloud", ("Internet / Provider", 0)), - ("modem", ("Modem / NTU / Medienkonverter", 1)), - ("firewall", ("Firewall", 1)), - ("router", ("Router", 1)), - ("l3switch", ("Layer-3-Switch / Core", 2)), - ("switch", ("Switch", 3)), - ("radio", ("Funkstrecke / Richtfunk", 3)), - ("wlc", ("WLAN-Controller", 3)), - ("poe", ("PoE-Injektor", 4)), - ("ap", ("Access Point", 4)), - ("server", ("Server", 4)), - ("storage", ("Storage / SAN (MSA)", 4)), - ("nas", ("NAS", 4)), - ("tape", ("Bandlaufwerk / Tape Library", 4)), - ("ups", ("USV / ATS", 4)), - ("pbx", ("Telefonanlage", 4)), - ("phone", ("IP-Telefon", 4)), - ("pc", ("PC / Client", 4)), - ("printer", ("Drucker", 4)), - ("camera", ("Kamera", 4)), - ("generic", ("Sonstiges Gerät", 4)), + ("cloud", (_("Internet / provider"), 0)), + ("modem", (_("Modem / NTU / media converter"), 1)), + ("firewall", (_("Firewall"), 1)), + ("router", (_("Router"), 1)), + ("l3switch", (_("Layer 3 switch / core"), 2)), + ("switch", (_("Switch"), 3)), + ("radio", (_("Radio link / microwave"), 3)), + ("wlc", (_("Wireless controller"), 3)), + ("poe", (_("PoE injector"), 4)), + ("ap", (_("Access point"), 4)), + ("server", (_("Server"), 4)), + ("storage", (_("Storage / SAN (MSA)"), 4)), + ("nas", (_("NAS"), 4)), + ("tape", (_("Tape drive / tape library"), 4)), + ("ups", (_("UPS / ATS"), 4)), + ("pbx", (_("Phone system (PBX)"), 4)), + ("phone", (_("IP phone"), 4)), + ("pc", (_("PC / client"), 4)), + ("printer", (_("Printer"), 4)), + ("camera", (_("Camera"), 4)), + ("generic", (_("Other device"), 4)), ] ) HIDDEN = "hidden" -KIND_CHOICES = [(k, v[0]) for k, v in KINDS.items() if k != "cloud"] + [(HIDDEN, "In Topologie ausblenden")] +KIND_CHOICES = [(k, v[0]) for k, v in KINDS.items() if k != "cloud"] + [(HIDDEN, _("Hide in topology"))] # Reihenfolge wichtig: erster Treffer gewinnt. None = passiv, nicht zeichnen. # Tippvarianten („Acces Point“, „Controler“, „Libary“) sind absichtlich mit abgedeckt. diff --git a/netbox_customer_export/template_content.py b/netbox_customer_export/template_content.py index b6a82b8..93d85ee 100644 --- a/netbox_customer_export/template_content.py +++ b/netbox_customer_export/template_content.py @@ -1,5 +1,6 @@ from django.urls import reverse from django.utils.html import format_html +from django.utils.translation import gettext as _ from netbox.plugins import PluginTemplateExtension @@ -13,8 +14,9 @@ class CustomerExportButton(PluginTemplateExtension): kwargs={"kind": obj._meta.model_name, "pk": obj.pk}, ) return format_html( - ' Kundendoku', + ' {}', url, + _("Customer Docs"), ) @@ -37,7 +39,7 @@ class TopologySymbolButton(PluginTemplateExtension): else: url = f"{reverse('plugins:netbox_customer_export:symbol_add')}?{field}={obj.pk}" return format_html( - ' Topologie-Symbol', url + ' {}', url, _("Topology Symbol") ) diff --git a/netbox_customer_export/templates/netbox_customer_export/_pills.html b/netbox_customer_export/templates/netbox_customer_export/_pills.html index 9ba678a..8bdca1a 100644 --- a/netbox_customer_export/templates/netbox_customer_export/_pills.html +++ b/netbox_customer_export/templates/netbox_customer_export/_pills.html @@ -1,6 +1,6 @@ -
+{% load i18n %}
{% for cb in field %} - {% empty %}Keine Einträge im Scope.{% endfor %} + {% empty %}{% trans "No entries in scope." %}{% endfor %}
diff --git a/netbox_customer_export/templates/netbox_customer_export/_symbol_table.html b/netbox_customer_export/templates/netbox_customer_export/_symbol_table.html index 39eb966..a3f5d48 100644 --- a/netbox_customer_export/templates/netbox_customer_export/_symbol_table.html +++ b/netbox_customer_export/templates/netbox_customer_export/_symbol_table.html @@ -1,6 +1,6 @@ -
+{% load i18n %}
- + {% for s, preview in rows %} @@ -9,13 +9,13 @@ {% if s.device_type %}{{ s.device_type.manufacturer }} {{ s.device_type.model }} {% else %}{{ s.role }}{% endif %} - + diff --git a/netbox_customer_export/templates/netbox_customer_export/branding_delete.html b/netbox_customer_export/templates/netbox_customer_export/branding_delete.html index a1c805f..c9983db 100644 --- a/netbox_customer_export/templates/netbox_customer_export/branding_delete.html +++ b/netbox_customer_export/templates/netbox_customer_export/branding_delete.html @@ -1,16 +1,17 @@ {% extends 'generic/_base.html' %} -{% block title %}{{ object }} löschen{% endblock %} +{% load i18n %} +{% block title %}{% blocktrans %}Delete {{ object }}{% endblocktrans %}{% endblock %} {% block content %} {% csrf_token %}
-

Soll das Branding-Profil {{ object }} wirklich gelöscht werden? - Logo und Word-Vorlage des Profils werden ebenfalls entfernt.

+

{% blocktrans trimmed %}Do you really want to delete the branding profile {{ object }}? + The profile's logo and Word template will be removed as well.{% endblocktrans %}

diff --git a/netbox_customer_export/templates/netbox_customer_export/branding_edit.html b/netbox_customer_export/templates/netbox_customer_export/branding_edit.html index 932c041..4141826 100644 --- a/netbox_customer_export/templates/netbox_customer_export/branding_edit.html +++ b/netbox_customer_export/templates/netbox_customer_export/branding_edit.html @@ -1,5 +1,6 @@ {% extends 'generic/_base.html' %} -{% block title %}{% if object.pk %}{{ object }} bearbeiten{% else %}Neues Branding-Profil{% endif %}{% endblock %} +{% load i18n %} +{% block title %}{% if object.pk %}{% blocktrans %}Edit {{ object }}{% endblocktrans %}{% else %}{% trans "New branding profile" %}{% endif %}{% endblock %} {% block content %}
ZuordnungSymbol
{% trans "Assignment" %}{% trans "Symbol" %}
{% if s.icon %}Eigenes Icon{% endif %} {{ s.get_kind_display }}{% if s.icon %}{% trans "Custom icon" %}{% endif %} {{ s.get_kind_display }} {% if perms.netbox_customer_export.change_topologysymbol %} - + {% endif %} {% if perms.netbox_customer_export.delete_topologysymbol %} - + {% endif %}