All notable changes to this project are documented in this file.
This project follows Semantic Versioning.
- CLDR plural forms: optional
short_forms/long_formsonRawMessage(keys: zero, one, two, few, many, other) andplural_param(defaultcount).internal/pluralselects form by language and count. Binary{{plural:count|singular|plural}}unchanged. - MessageDef: type for defining messages in Go (Key, Short, Long, ShortForms, LongForms, PluralParam, Code). msgcat extract -source finds MessageDef struct literals and merges their content into source YAML.
- Optional group:
Messages.GroupandOptionalGroup(int or string in YAML, e.g.group: 0orgroup: "api"). CLI extract/merge preserve group. - CLI extract (keys from GetMessageWithCtx/WrapErrorWithCtx/GetErrorWithCtx; sync to YAML with MessageDef merge) and merge (translate.<lang>.yaml with group and plural fields copied).
- Examples:
cldr_plural,msgdef. Docs: CLI_WORKFLOW_PLAN, CLDR_AND_GO_MESSAGES_PLAN. - String message keys (e.g.
"greeting.hello") instead of numeric codes for lookup.
- LoadMessages now preserves
ShortForms,LongForms, andPluralParamon runtime-loaded messages. - Merge now treats a target entry as translated when it has either
short/longorshort_forms/long_forms, so forms-only translations are kept.
- CI uses Go 1.26 (matches go.mod) and builds
./cmd/...(msgcat CLI). - MIGRATION §10 added: optional group, CLDR forms, MessageDef (no migration required).
- Named template parameters:
{{name}},{{plural:count|...}},{{num:amount}},{{date:when}}withmsgcat.Params. - Optional string
codefield: any value (e.g."404","ERR_NOT_FOUND"); not unique. YAML acceptscode: 404orcode: "ERR_001". HelpersCodeInt(),CodeString(). Message.KeyandErrorKey()for API identifier when code is empty.- Runnable examples:
basic,load_messages,reload,strict,stats; HTTP and metrics examples get message resources. - Documentation: "Message and error codes" section; API examples (README, CONTEXT7); CONVERSION_PLAN final state; MIGRATION section 9 for string keys.
GetMessageWithCtx(ctx, msgKey string, params Params);WrapErrorWithCtx/GetErrorWithCtxtakemsgKey stringandparams Params. Params can be nil.Message.CodeandErrorCode()arestring(empty when not set). UseKey/ErrorKey()when empty.LoadMessages: eachRawMessagemust haveKeywith prefixsys.; no numeric code range. UseCode: msgcat.CodeInt(503)ormsgcat.CodeString("ERR_X").- Observer:
OnMessageMissing(lang, msgKey string),OnTemplateIssue(lang, msgKey string, issue string). - YAML:
setuses string keys; optionalcodeper entry;groupremoved. Template placeholders are named only. - Constants
CodeMissingMessageandCodeMissingLanguageare strings ("msgcat.missing_message","msgcat.missing_language").
- Async, panic-safe observer pipeline with bounded queue (
ObserverBuffer). - Bounded stats cardinality (
StatsMaxKeys) with__overflow__bucket. - Reload retries (
ReloadRetries,ReloadRetryDelay). - Extended stats fields:
DroppedEvents,LastReloadAt. - Helper functions:
ResetStats(catalog),Close(catalog). - Production-oriented docs for Context7 + retrieval-friendly docs.
- Additional tests: observer behavior, stats capping/reset, reload retry behavior.
- Benchmarks and fuzz test entrypoints.
- GitHub Actions CI workflow (test, race, vet, examples build).
SECURITY.mdfor vulnerability reporting..golangci.ymlfor lint configuration (replaces misspelled.golanci.yml).
Reloadnow supports transient read/parse retries.- Observer callbacks are no longer executed inline on request path.
- Stats now enforce key caps to avoid unbounded memory growth.
- Go module requires Go 1.26.
- Replaced deprecated
io/ioutilwithos(ReadDir,ReadFile).
- Updated docs links to
docs/layout.
- YAML-based message catalog loading by language.
- Context-based language resolution with fallback chain.
- Runtime message loading for system codes (
9000-9999). - Template support: positional, plural, localized number/date.
- Error wrapping with short/long localized messages.
- Concurrency-safe read/write behavior.
- Runtime reload and stats snapshot helpers.
- Race-safe implementation validated with
go test -race ./.... - Validations for YAML structure and message code constraints.