feat(i18n): translate UI to English and German
Use English as source language for all user-visible strings, wrap them for translation and ship a German catalog. Add a test that keeps the README's NetBox range in sync with min_version/max_version. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
133cb1d9fc
commit
cce6e21a09
40 files changed
+1456
-244
No files matched your search
@@ -0,0 +1,37 @@
|
||||
"""Keeps the NetBox range in README.md in sync with the PluginConfig."""
|
||||
import ast
|
||||
import re
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
|
||||
|
||||
def plugin_versions():
|
||||
tree = ast.parse((ROOT / "netbox_topology_views" / "__init__.py").read_text())
|
||||
values = {}
|
||||
for node in ast.walk(tree):
|
||||
if isinstance(node, ast.Assign) and isinstance(node.value, ast.Constant):
|
||||
for target in node.targets:
|
||||
if isinstance(target, ast.Name) and target.id in ("min_version", "max_version"):
|
||||
values[target.id] = node.value.value
|
||||
return values["min_version"], values["max_version"]
|
||||
|
||||
|
||||
def expected_range(min_version, max_version):
|
||||
upper = re.sub(r"\.99$", ".x", max_version)
|
||||
if min_version.endswith(".0") and upper == min_version[:-2] + ".x":
|
||||
return f"`{upper}`"
|
||||
return f"`{min_version}` – `{upper}`"
|
||||
|
||||
|
||||
class MetadataTest(unittest.TestCase):
|
||||
def test_readme_matches_plugin_config(self):
|
||||
readme = (ROOT / "README.md").read_text()
|
||||
expected = expected_range(*plugin_versions())
|
||||
self.assertIn(f"| **NetBox** | {expected} |", readme)
|
||||
self.assertIn(f"- NetBox {expected}", readme)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user