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

+7
View File
@@ -0,0 +1,7 @@
import django
from django.conf import settings
# The importer tests load modules without NetBox; gettext still needs configured settings.
if not settings.configured:
settings.configure(USE_I18N=True, LANGUAGE_CODE="en")
django.setup()
+2 -2
View File
@@ -43,6 +43,6 @@ def test_embedded_images_respect_total_size_limit():
try:
embedded.validate_embedded_images(html, 1)
except embedded.EmbeddedImageError as exc:
assert "Gesamtgröße" in str(exc)
assert "total size" in str(exc)
else:
raise AssertionError("Größenlimit wurde nicht angewendet")
raise AssertionError("size limit was not applied")
+1 -1
View File
@@ -168,7 +168,7 @@ def test_excel_preview_limits_rows_without_affecting_sheet_detection():
include_image_data=False,
)
assert "Vorschau auf 100 Zeilen begrenzt" in results[0].markdown
assert "Preview limited to 100 rows" in results[0].markdown
assert ">99<" in results[0].markdown
assert ">100<" not in results[0].markdown
+24
View File
@@ -0,0 +1,24 @@
import ast
import re
from pathlib import Path
ROOT = Path(__file__).parents[1]
def plugin_versions():
tree = ast.parse((ROOT / "netbox_documentation" / "__init__.py").read_text())
config = next(node for node in tree.body if isinstance(node, ast.ClassDef))
values = {
target.id: node.value.value
for node in config.body if isinstance(node, ast.Assign) and isinstance(node.value, ast.Constant)
for target in node.targets if isinstance(target, ast.Name)
}
return values["min_version"], values["max_version"]
def test_readme_matches_plugin_version_range():
minimum, maximum = plugin_versions()
expected = f"`{minimum}` – `{'.'.join(maximum.split('.')[:2])}.x`"
readme = (ROOT / "README.md").read_text()
assert re.search(rf"\| \*\*NetBox\*\* \| {re.escape(expected)} \|", readme)
assert f"- NetBox {expected}" in readme