diff --git a/README.md b/README.md index e438f67..28ad389 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ IP ranges created automatically from the saved IP addresses: ## Compatibility -- NetBox `4.6.5` – `4.7.x` (verified with 4.7.2) +- NetBox `4.6.5` – `4.7.x` (verified with 4.7.3) - Python `>=3.12` ## Installation @@ -169,6 +169,29 @@ NetBox has no separate core model called organisation. The overview maps organisation to NetBox `Region` and includes child regions and their sites and locations. +### Language + +The plugin is available in English (source) and German. Switch the display +language as usual in the user profile (**Preferences → Language**). +Translations live in `netbox_better_ips/locale/de/LC_MESSAGES/`. + +## Development and tests + +```bash +python -m unittest discover -s tests +``` + +The tests check that the NetBox range in this README and the package version +match the `PluginConfig`, and that the translations are shipped. + +After changing user-visible strings, update and compile the catalogue from +within `netbox_better_ips/`: + +```bash +django-admin makemessages -l de --no-location +msgfmt --check -o locale/de/LC_MESSAGES/django.mo locale/de/LC_MESSAGES/django.po +``` + ## License Apache License 2.0 — see [LICENSE](LICENSE). diff --git a/netbox_better_ips/forms.py b/netbox_better_ips/forms.py index 8a9bbbc..876df10 100644 --- a/netbox_better_ips/forms.py +++ b/netbox_better_ips/forms.py @@ -1,25 +1,26 @@ from django import forms +from django.utils.translation import gettext_lazy as _ from dcim.models import Location, Region, Site, SiteGroup from tenancy.models import Tenant, TenantGroup class NetworkOverviewFilterForm(forms.Form): - q = forms.CharField(required=False, label="Suche") + q = forms.CharField(required=False, label=_("Search")) organization = forms.ModelChoiceField( - queryset=Region.objects.all(), required=False, label="Organisation / Region" + queryset=Region.objects.all(), required=False, label=_("Organisation / Region") ) site_group = forms.ModelChoiceField( - queryset=SiteGroup.objects.all(), required=False, label="Standortgruppe" + queryset=SiteGroup.objects.all(), required=False, label=_("Site group") ) - site = forms.ModelChoiceField(queryset=Site.objects.all(), required=False, label="Standort") + site = forms.ModelChoiceField(queryset=Site.objects.all(), required=False, label=_("Site")) location = forms.ModelChoiceField( - queryset=Location.objects.all(), required=False, label="Lokation" + queryset=Location.objects.all(), required=False, label=_("Location") ) tenant_group = forms.ModelChoiceField( - queryset=TenantGroup.objects.all(), required=False, label="Mandantengruppe" + queryset=TenantGroup.objects.all(), required=False, label=_("Tenant group") ) tenant = forms.ModelChoiceField( - queryset=Tenant.objects.all(), required=False, label="Mandant" + queryset=Tenant.objects.all(), required=False, label=_("Tenant") ) def __init__(self, *args, **kwargs): diff --git a/netbox_better_ips/locale/de/LC_MESSAGES/django.mo b/netbox_better_ips/locale/de/LC_MESSAGES/django.mo new file mode 100644 index 0000000..26c0deb Binary files /dev/null and b/netbox_better_ips/locale/de/LC_MESSAGES/django.mo differ diff --git a/netbox_better_ips/locale/de/LC_MESSAGES/django.po b/netbox_better_ips/locale/de/LC_MESSAGES/django.po new file mode 100644 index 0000000..2e77143 --- /dev/null +++ b/netbox_better_ips/locale/de/LC_MESSAGES/django.po @@ -0,0 +1,102 @@ +# German translation of NetBox Better IPs. +# This file is distributed under the same license as the netbox-better-ips package. +# +msgid "" +msgstr "" +"Project-Id-Version: netbox-better-ips\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2026-10-26 21:14+0100\n" +"PO-Revision-Date: 2026-10-26 21:15+0100\n" +"Last-Translator: NetBox Better IPs contributors\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" + +msgid "Search" +msgstr "Suche" + +msgid "Organisation / Region" +msgstr "Organisation / Region" + +msgid "Site group" +msgstr "Standortgruppe" + +msgid "Site" +msgstr "Standort" + +msgid "Location" +msgstr "Lokation" + +msgid "Tenant group" +msgstr "Mandantengruppe" + +msgid "Tenant" +msgstr "Mandant" + +msgid "IP Network Overview" +msgstr "IP-Netzübersicht" + +msgid "Device / VM" +msgstr "Gerät / VM" + +msgid "Extended network overview" +msgstr "Erweiterte Netzübersicht" + +msgid "Create all missing ranges" +msgstr "Alle fehlenden Bereiche anlegen" + +#, python-format +msgid "%(counter)s network" +msgid_plural "%(counter)s networks" +msgstr[0] "%(counter)s Netz" +msgstr[1] "%(counter)s Netze" + +msgid "Network" +msgstr "Netz" + +msgid "VRF" +msgstr "VRF" + +msgid "Scope" +msgstr "Geltungsbereich" + +msgid "Status" +msgstr "Status" + +msgid "Description" +msgstr "Beschreibung" + +msgid "No matching networks found." +msgstr "Keine passenden Netze gefunden." + +msgid "Previous" +msgstr "Vorherige" + +#, python-format +msgid "Page %(number)s of %(total)s" +msgstr "Seite %(number)s von %(total)s" + +msgid "Next" +msgstr "Nächste" + +msgid "Filter" +msgstr "Filter" + +msgid "Apply" +msgstr "Anwenden" + +msgid "Reset" +msgstr "Zurücksetzen" + +#, python-brace-format +msgid "" +"{created} ranges were created; {failed} IP addresses could not be processed." +msgstr "{created} Bereiche wurden angelegt; {failed} IP-Adressen konnten nicht verarbeitet werden." + +#, python-brace-format +msgid "" +"{created} missing ranges were created. {skipped} host addresses were ignored." +msgstr "{created} fehlende Bereiche wurden angelegt. {skipped} Host-Adressen wurden ignoriert." \ No newline at end of file diff --git a/netbox_better_ips/management/commands/reconcile_ip_prefixes.py b/netbox_better_ips/management/commands/reconcile_ip_prefixes.py index 5c26a5b..c335eb5 100644 --- a/netbox_better_ips/management/commands/reconcile_ip_prefixes.py +++ b/netbox_better_ips/management/commands/reconcile_ip_prefixes.py @@ -21,7 +21,7 @@ class Command(BaseCommand): skipped += int(ip_range is None) except Exception as exc: failed += 1 - self.stderr.write(f"Fehler bei {address}: {exc}") - verb = "würden erstellt" if options["dry_run"] else "erstellt" - message = f"{created} IP-Bereiche {verb}; {skipped} Hostmasken ignoriert; {failed} Fehler." + self.stderr.write(f"Error for {address}: {exc}") + verb = "would be created" if options["dry_run"] else "created" + message = f"{created} IP ranges {verb}; {skipped} host masks ignored; {failed} errors." self.stdout.write(self.style.SUCCESS(message) if not failed else self.style.WARNING(message)) diff --git a/netbox_better_ips/navigation.py b/netbox_better_ips/navigation.py index 02e7f31..4a3dea3 100644 --- a/netbox_better_ips/navigation.py +++ b/netbox_better_ips/navigation.py @@ -1,3 +1,4 @@ +from django.utils.translation import gettext_lazy as _ from netbox.navigation import MenuItem @@ -15,7 +16,7 @@ def register_ipam_menu_item(): *group.items, MenuItem( link=link, - link_text="IP-Netzübersicht", + link_text=_("IP Network Overview"), permissions=["ipam.view_prefix"], ), ) diff --git a/netbox_better_ips/tables.py b/netbox_better_ips/tables.py index e54b536..2637b26 100644 --- a/netbox_better_ips/tables.py +++ b/netbox_better_ips/tables.py @@ -1,4 +1,5 @@ import django_tables2 as tables +from django.utils.translation import gettext_lazy as _ from ipam.tables import IPAddressTable from utilities.tables import register_table_column @@ -7,7 +8,7 @@ device_or_vm = tables.Column( accessor="assigned_object__parent_object", linkify=True, orderable=False, - verbose_name="Gerät / VM", + verbose_name=_("Device / VM"), empty_values=(), ) diff --git a/netbox_better_ips/templates/netbox_better_ips/inc/iprange_list_buttons.html b/netbox_better_ips/templates/netbox_better_ips/inc/iprange_list_buttons.html index bca9897..79601d7 100644 --- a/netbox_better_ips/templates/netbox_better_ips/inc/iprange_list_buttons.html +++ b/netbox_better_ips/templates/netbox_better_ips/inc/iprange_list_buttons.html @@ -1,7 +1,8 @@ +{% load i18n %} {% if perms.ipam.view_prefix %} - Erweiterte Netzübersicht + {% trans "Extended network overview" %} {% endif %} {% if perms.ipam.view_ipaddress and perms.ipam.add_iprange %} @@ -9,7 +10,7 @@ {% csrf_token %} {% endif %} diff --git a/netbox_better_ips/templates/netbox_better_ips/network_overview.html b/netbox_better_ips/templates/netbox_better_ips/network_overview.html index e18a4b6..0569fbd 100644 --- a/netbox_better_ips/templates/netbox_better_ips/network_overview.html +++ b/netbox_better_ips/templates/netbox_better_ips/network_overview.html @@ -1,12 +1,12 @@ {% extends 'base/layout.html' %} -{% load helpers %} +{% load helpers i18n %} -{% block title %}IP-Netzübersicht{% endblock %} +{% block title %}{% trans "IP Network Overview" %}{% endblock %} {% block header %}
| Netz | VRF | Scope | Mandant | Status | Beschreibung |
|---|---|---|---|---|---|
| {% trans "Network" %} | {% trans "VRF" %} | {% trans "Scope" %} | {% trans "Tenant" %} | {% trans "Status" %} | {% trans "Description" %} |
| {{ prefix.description|placeholder }} | |||||
| Keine passenden Netze gefunden. | |||||
| {% trans "No matching networks found." %} | |||||