Skip to content

feat(sdk): module i18n labels — meter/unit/description localized labels#131

Merged
I-am-nothing merged 1 commit into
mainfrom
feat/module-i18n-labels
Jul 3, 2026
Merged

feat(sdk): module i18n labels — meter/unit/description localized labels#131
I-am-nothing merged 1 commit into
mainfrom
feat/module-i18n-labels

Conversation

@I-am-nothing

Copy link
Copy Markdown
Contributor

Collapses the 3-branch stack (feat/meter-i18n-labelfeat/meter-unit-i18n-labelfeat/description-i18n-label) into ONE clean branch off main.

What

Adds per-locale display labels to three module-surface points, each built from ms.Text (a literal) or ms.T (an i18n catalog key), 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 (the Unit itself stays the untranslated billing identifier used for per-unit price aggregation)
  • ms.Config.DescriptionLabel — module description label → manifest descriptionLabels

Each 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 zero Label is omitted entirely (omitempty), so plain-string modules ship no new manifest keys. Resolution is lazy (at manifest build), so catalog-load ordering (RegisterMessages before or after Init) does not matter — only both-before-serve.

Verification

  • go build ./... green
  • go vet ./... clean
  • go test ./... green (the one unrelated internal/refcache singleflight flake is pre-existing on main, in a package this PR does not touch, and passes on re-run)
  • Tests added: description label (literal surfaces / plain leaves labels absent / per-locale catalog resolve) + meter label + unit label (surfaces + per-locale catalog resolve)

Born-clean: single squashed concept-commit off current main, no merge commits, no conflict markers.

Co-Authored-By: Claude Fable 5 noreply@anthropic.com

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>
@I-am-nothing I-am-nothing merged commit 31ac650 into main Jul 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant