feat(i18n): English source strings with German translation

All UI texts and generated document texts use gettext; exports follow the user's language. Adds a check that README and PluginConfig version ranges match.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
MrBlakeandClaude Opus 5.5 committed 2026-10-26 21:27:47 +01:00
1 parent 0d046f3a9d
commit 9dba7e07a0
35 files changed
+1841 -364

No files matched your search

+29 -28
View File
@@ -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."))