feat(i18n): use English source strings with German translation

Wrap all user-visible strings for translation, ship a complete German catalogue, align the NetBox version range (4.4.0-4.7.x) with the README and add a test that keeps them in sync.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
MrBlakeandClaude Opus 5.5 committed 2026-10-26 21:28:37 +01:00
1 parent e6995630e9
commit f557e7d49d
33 files changed
+1564 -314

No files matched your search

+6 -5
View File
@@ -1,6 +1,7 @@
import base64
from io import BytesIO
import re
from django.utils.translation import gettext as _
class EmbeddedImageError(ValueError):
@@ -20,23 +21,23 @@ def _decode(match):
try:
content = base64.b64decode(payload, validate=True)
except (ValueError, TypeError) as exc:
raise EmbeddedImageError("Ein eingefügtes Bild enthält ungültige Base64-Daten.") from exc
raise EmbeddedImageError(_("A pasted image contains invalid Base64 data.")) from exc
try:
from PIL import Image
image = Image.open(BytesIO(content))
image.verify()
except Exception as exc:
raise EmbeddedImageError("Ein eingefügter Inhalt ist keine gültige Bilddatei.") from exc
raise EmbeddedImageError(_("Pasted content is not a valid image file.")) from exc
return match.group("mime").lower(), content
def validate_embedded_images(html, max_total_bytes):
total = 0
for match in DATA_IMAGE_RE.finditer(html or ""):
_, content = _decode(match)
_mime, content = _decode(match)
total += len(content)
if total > max_total_bytes:
raise EmbeddedImageError("Die eingefügten Bilder überschreiten die erlaubte Gesamtgröße.")
raise EmbeddedImageError(_("The pasted images exceed the allowed total size."))
def store_embedded_images(html, max_total_bytes, store):
@@ -47,7 +48,7 @@ def store_embedded_images(html, max_total_bytes, store):
mime, content = _decode(match)
total += len(content)
if total > max_total_bytes:
raise EmbeddedImageError("Die eingefügten Bilder überschreiten die erlaubte Gesamtgröße.")
raise EmbeddedImageError(_("The pasted images exceed the allowed total size."))
url = store(mime, content)
return f'{match.group("prefix")}{url}{match.group("quote")}'