feat(sdk): module i18n labels — meter/unit/description localized labels#131
Merged
Conversation
Add per-locale display labels to three module-surface points, each built from ms.Text (a literal) or ms.T (an i18n catalog key) and resolved against the module's i18n catalogs at manifest build — mirroring the existing RegisterPermission label path: - ms.MetricLabel(l): metric display label → manifest metric `labels` - ms.MetricUnitLabel(l): metric UNIT display label → manifest `unitLabels` (Unit itself stays the untranslated billing identifier) - ms.Config.DescriptionLabel: module description label → manifest `descriptionLabels` All three resolve i18n.Label → per-locale map (locale → text) folded ALONGSIDE the plain default (Description / Unit / metric name), which stays the fallback. A zero Label is omitted entirely (omitempty), so plain-string modules ship no new keys. Resolution is lazy (manifest build), so catalog load ordering (RegisterMessages before or after Init) is free. Collapses the 3-branch stack (feat/meter-i18n-label → feat/meter-unit-i18n-label → feat/description-i18n-label) into one clean branch off main. 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.
Collapses the 3-branch stack (
feat/meter-i18n-label→feat/meter-unit-i18n-label→feat/description-i18n-label) into ONE clean branch offmain.What
Adds per-locale display labels to three module-surface points, each built from
ms.Text(a literal) orms.T(an i18n catalog key), resolved against the module's i18n catalogs at manifest build — mirroring the existingRegisterPermissionlabel path:ms.MetricLabel(l)— metric display label → manifest metriclabelsms.MetricUnitLabel(l)— metric UNIT display label → manifestunitLabels(theUnititself stays the untranslated billing identifier used for per-unit price aggregation)ms.Config.DescriptionLabel— module description label → manifestdescriptionLabelsEach resolves
i18n.Label→ a per-locale map (locale → text), folded into the manifest ALONGSIDE the plain default (Description/Unit/ metric name), which stays the fallback. A zeroLabelis omitted entirely (omitempty), so plain-string modules ship no new manifest keys. Resolution is lazy (at manifest build), so catalog-load ordering (RegisterMessagesbefore or afterInit) does not matter — only both-before-serve.Verification
go build ./...greengo vet ./...cleango test ./...green (the one unrelatedinternal/refcachesingleflight flake is pre-existing onmain, in a package this PR does not touch, and passes on re-run)Born-clean: single squashed concept-commit off current
main, no merge commits, no conflict markers.Co-Authored-By: Claude Fable 5 noreply@anthropic.com