fixed instance nav labels i18n
This commit is contained in:
parent
958449c9dd
commit
c18ad6f8e7
1 changed files with 8 additions and 9 deletions
|
|
@ -137,7 +137,9 @@ def _buildDynamicBlock(
|
||||||
) -> Optional[Dict[str, Any]]:
|
) -> Optional[Dict[str, Any]]:
|
||||||
"""
|
"""
|
||||||
Build the dynamic features block with mandates, features, and instances.
|
Build the dynamic features block with mandates, features, and instances.
|
||||||
Labels are German base texts (i18n keys). Frontend translates via t().
|
View and feature labels use resolveText() for the current request language
|
||||||
|
(same contract as static navigation items in _formatBlockItem).
|
||||||
|
Instance and mandate display names are user-defined and passed through as-is.
|
||||||
|
|
||||||
Returns None if user has no feature instances.
|
Returns None if user has no feature instances.
|
||||||
"""
|
"""
|
||||||
|
|
@ -199,10 +201,7 @@ def _buildDynamicBlock(
|
||||||
else:
|
else:
|
||||||
featureLabel = {"de": instance.featureCode, "en": instance.featureCode}
|
featureLabel = {"de": instance.featureCode, "en": instance.featureCode}
|
||||||
|
|
||||||
if isinstance(featureLabel, str):
|
resolvedFeatureLabel = resolveText(featureLabel)
|
||||||
resolvedFeatureLabel = featureLabel
|
|
||||||
else:
|
|
||||||
resolvedFeatureLabel = featureLabel.get("de", featureLabel.get("en", instance.featureCode))
|
|
||||||
|
|
||||||
featuresMap[featureKey] = {
|
featuresMap[featureKey] = {
|
||||||
"uiComponent": f"feature.{instance.featureCode}",
|
"uiComponent": f"feature.{instance.featureCode}",
|
||||||
|
|
@ -239,8 +238,8 @@ def _buildDynamicBlock(
|
||||||
# Build path for this view
|
# Build path for this view
|
||||||
viewPath = f"/mandates/{mandateId}/{instance.featureCode}/{instance.id}/{viewName}"
|
viewPath = f"/mandates/{mandateId}/{instance.featureCode}/{instance.id}/{viewName}"
|
||||||
|
|
||||||
label = uiObj.get("label", {})
|
rawViewLabel = uiObj.get("label")
|
||||||
uiLabel = label.get("de", label.get("en", viewName)) if isinstance(label, dict) else label
|
uiLabel = resolveText(rawViewLabel) if rawViewLabel not in (None, "") else ""
|
||||||
|
|
||||||
views.append({
|
views.append({
|
||||||
"uiComponent": f"page.feature.{instance.featureCode}.{viewName}",
|
"uiComponent": f"page.feature.{instance.featureCode}.{viewName}",
|
||||||
|
|
@ -473,8 +472,8 @@ def get_navigation(
|
||||||
"""
|
"""
|
||||||
Get unified navigation structure with blocks.
|
Get unified navigation structure with blocks.
|
||||||
|
|
||||||
All labels are German base texts (i18n keys).
|
Static items and dynamic feature/view labels are resolved with resolveText()
|
||||||
The frontend translates them via t().
|
for the current request language. User-defined instance/mandate names are raw.
|
||||||
|
|
||||||
Endpoint: GET /api/navigation
|
Endpoint: GET /api/navigation
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue