feat(tenant_config): accept i18n-keyed labels for nav_links#87
Open
BimaPangestu28 wants to merge 1 commit into
Open
feat(tenant_config): accept i18n-keyed labels for nav_links#87BimaPangestu28 wants to merge 1 commit into
BimaPangestu28 wants to merge 1 commit into
Conversation
Operators can now ship per-locale labels for `nav_links` entries via the
webchat-gui setup wizard, keeping parity with flow-card i18n so demos
like deep-research can fully localize the topbar nav. Pairs with the
matching `renderTopbarNav` change in greentic-messaging-providers.
The `label` field of each `nav_links_json` entry now accepts either a
plain string (single-language, unchanged behaviour) or a JSON object
keyed by locale code:
```json
{
"label": { "en": "Help", "id": "Bantuan", "de": "Hilfe" },
"url": "/help"
}
```
A new `sanitize_nav_label` helper trims whitespace, drops non-string
values, and rejects entries whose object would end up empty. Plain
string labels are still validated as before. The runtime resolves the
displayed label via selectedLocale → base language → `en` → first
non-empty value.
Tests cover both forms, plus the malformed-object case (drops empty
strings, strips non-string values, rejects entries with no usable
label).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
nav_linksentries in the webchat-gui setup wizard, matching the i18n pattern used for flow-rendered Adaptive Cards.labelmay be either a plain string (single-language, unchanged) or a JSON object keyed by locale code (e.g.{"en": "Help", "id": "Bantuan", "de": "Hilfe"}).sanitize_nav_labelhelper trims whitespace, strips non-string locale entries, and rejects label objects with no usable values. Plain-string labels keep the existing validation.renderTopbarNavreads the resolved label via the corresponding change in greenticai/greentic-messaging-providers#149 (resolution order: exactselectedLocale→ base language →en→ first non-empty value).Test plan
cargo test --lib tenant_config— 24/24 ok (addedsync_nav_links_accepts_locale_keyed_label_objectandsync_nav_links_drops_label_object_with_only_empty_values)cargo clippy --workspace --all-targets -- -D warnings— clean for this change