feat(sdk): per-locale module tag labels (TagLabels), mirroring NameLabels#134
Merged
Conversation
…bels The module card (info-dialog header + grid tile) renders the raw Config.Tags list, so a module's badges stay English regardless of locale. NameLabels already carries a per-locale display name (module.name catalog key), but Tags had no per-locale map at all. Add ManifestDefaults.TagLabels (map[string][]string, locale -> tag LIST, JSON "tagLabels", omitempty) ALONGSIDE the raw Tags fallback. It resolves from the module's i18n catalog key "module.tags" whose per-locale value packs the list into one comma-separated string (message catalogs are string-valued, so a JSON array leaf can't be used) -- new i18n.LookupList splits on the delimiter and trims each tag. A locale with no translation is omitted, so the web falls back to raw Tags exactly as it falls back to Name for NameLabels. No api-platform change: the map flows through as JSONB verbatim, the same path DescriptionLabels/NameLabels already use. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Problem
The module card (module-info-dialog header + the /modules grid tile) renders a module's TAGS ("Auth") in English regardless of locale. The manifest's
defaults.Tagsis a raw[]stringwith no per-locale map at all — unlikedefaults.NameLabels(per-locale display name,module.namecatalog key) anddescriptionLabels(added earlier this session), which the web already resolves by locale.Change (SDK only)
Add
ManifestDefaults.TagLabels map[string][]string(locale → localized tag LIST, JSON keytagLabels,omitempty) alongside the existing rawTags—Tagsstays the default/fallback, mirroring howNamestays the fallback forNameLabels.Resolution mirrors
NameLabels: read the module's i18n catalog at manifest build. Newi18n.LookupList(key, sep)is the list counterpart ofi18n.Lookup— likeLookupit does not fall back to the raw key, so a locale with no translation is omitted and the web falls back to rawTags.Authoring convention (wire shape for the web agent)
Message catalogs are string-valued (
flatten()ignores JSON array leaves), so the author packs each locale's tag list into a single comma-separated catalog value under the keymodule.tags:The manifest splits on
","and space-trims each tag →tagLabels: { "en-US": ["Auth"], "zh-TW": ["驗證"] }. Multiple tags:"Auth, Payments"→["Auth","Payments"].No api-platform change — the map flows through verbatim as JSONB, the same path
NameLabels/descriptionLabelsalready use.Tests
i18n.LookupList: splits/trims/drops-empties; missing key → empty map (no raw-key fallback).module.name+module.tagssurfacesnameLabels+tagLabelsper-locale; a module with neither leaves both absent (rawName/Tagsfallback).go build ./...+go vet ./...+go test ./...all green.Consumer (separate, uncommitted)
ms-app-modules/oauth-coreauthorsmodule.tags(en-USAuth, zh-TW驗證) in its catalog — nomain.gochange needed since tags resolve from the catalog likeNameLabels. Verified it compiles against this branch via a temp GOWORK.🤖 Generated with Claude Code