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]]:
|
||||
"""
|
||||
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.
|
||||
"""
|
||||
|
|
@ -199,10 +201,7 @@ def _buildDynamicBlock(
|
|||
else:
|
||||
featureLabel = {"de": instance.featureCode, "en": instance.featureCode}
|
||||
|
||||
if isinstance(featureLabel, str):
|
||||
resolvedFeatureLabel = featureLabel
|
||||
else:
|
||||
resolvedFeatureLabel = featureLabel.get("de", featureLabel.get("en", instance.featureCode))
|
||||
resolvedFeatureLabel = resolveText(featureLabel)
|
||||
|
||||
featuresMap[featureKey] = {
|
||||
"uiComponent": f"feature.{instance.featureCode}",
|
||||
|
|
@ -239,8 +238,8 @@ def _buildDynamicBlock(
|
|||
# Build path for this view
|
||||
viewPath = f"/mandates/{mandateId}/{instance.featureCode}/{instance.id}/{viewName}"
|
||||
|
||||
label = uiObj.get("label", {})
|
||||
uiLabel = label.get("de", label.get("en", viewName)) if isinstance(label, dict) else label
|
||||
rawViewLabel = uiObj.get("label")
|
||||
uiLabel = resolveText(rawViewLabel) if rawViewLabel not in (None, "") else ""
|
||||
|
||||
views.append({
|
||||
"uiComponent": f"page.feature.{instance.featureCode}.{viewName}",
|
||||
|
|
@ -473,8 +472,8 @@ def get_navigation(
|
|||
"""
|
||||
Get unified navigation structure with blocks.
|
||||
|
||||
All labels are German base texts (i18n keys).
|
||||
The frontend translates them via t().
|
||||
Static items and dynamic feature/view labels are resolved with resolveText()
|
||||
for the current request language. User-defined instance/mandate names are raw.
|
||||
|
||||
Endpoint: GET /api/navigation
|
||||
"""
|
||||
|
|
|
|||
Loading…
Reference in a new issue