Merge branch 'feat/i18n' into main
Bring the English/German translation up to date with main. Conflicts are resolved in favour of main's features (rack photos, floor plans, CPU & RAM, virtualization clusters, location overview, merged disk table), with their texts now translatable and added to the German catalogue. Bump version to 0.17.0. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
commit
38b3ec2a27
37 files changed
+2093
-419
No files matched your search
@@ -3,6 +3,7 @@ import base64
|
||||
from dataclasses import dataclass, field
|
||||
|
||||
from django.utils.text import slugify
|
||||
from django.utils.translation import gettext as _
|
||||
|
||||
EMPTY = "—"
|
||||
|
||||
@@ -53,11 +54,11 @@ def REF(text, target, prefix=""):
|
||||
|
||||
|
||||
def T(headers, rows):
|
||||
return Block("table", headers=list(headers), rows=[[fmt(c) for c in r] for r in rows])
|
||||
return Block("table", headers=[str(h) for h in headers], rows=[[fmt(c) for c in r] for r in rows])
|
||||
|
||||
|
||||
def KV(pairs, skip_empty=True):
|
||||
rows = [[k, fmt(v)] for k, v in pairs if not (skip_empty and v in (None, "", [], EMPTY))]
|
||||
rows = [[str(k), fmt(v)] for k, v in pairs if not (skip_empty and v in (None, "", [], EMPTY))]
|
||||
return Block("kv", rows=rows)
|
||||
|
||||
|
||||
@@ -91,7 +92,7 @@ def fmt(value):
|
||||
if value is None or value == "":
|
||||
return EMPTY
|
||||
if isinstance(value, bool):
|
||||
return "Ja" if value else "Nein"
|
||||
return _("Yes") if value else _("No")
|
||||
if isinstance(value, (list, tuple, set)) or hasattr(value, "all"):
|
||||
items = value.all() if hasattr(value, "all") else value
|
||||
return ", ".join(str(i) for i in items) or EMPTY
|
||||
|
||||
Reference in new issue
Block a user