Repository navigation
Releases
v0.1.2-alpha.1 — Namespace catalogs and benchmark checks
This pre-release adds namespace-based translation file loading and automated benchmark checks while preserving the existing LoadFS, Define, and translation APIs.
Install
go get github.com/waterkyuu/go-intl@v0.1.2-alpha.1The core module requires Go 1.25 or later. Runnable client examples use a separate module that requires Go 1.27.3 or later.
Translation files grouped by language
Use the new intl.LoadNamespacesFS to load one file per business namespace inside each language directory:
locales/
├── en/
│ ├── auth.json
│ └── common.json
└── fr/
├── auth.json
└── common.json
For example, locales/en/auth.json contains relative keys:
{
"title": "Sign in",
"form": {
"submit": "Submit"
}
}sources, err := intl.LoadNamespacesFS(files, "locales/*/*.json")Here, files is an fs.FS, such as embed.FS or os.DirFS. The parent directory supplies the language, and the filename supplies the namespace. The example defines auth.title and auth.form.submit; file contents do not need an outer auth object.
Compile the returned sources once with intl.New, then use catalog.Translations("en", "auth") to render relative keys.
- Supports JSON, TOML, YAML/YML, and CSV.
- Preserves nested and dotted keys, empty translations, and per-key language fallback.
- Retains duplicate-key validation and file-specific diagnostics.
- Performs namespace preparation at load time; message lookup and ICU rendering continue to use the existing catalog implementation.
Related: #4.
Benchmark checks in GitHub Actions
The new Benchmarks workflow compares baseline and candidate revisions using all existing core and go-i18n comparison benchmarks.
- Uses the same Go toolchain and runner, alternating revision order over six rounds with
GOMAXPROCS=1. - Allows up to 3% regression in median time by default; manual runs can select 1%, 2%, or 3%.
- Requires median
B/opandallocs/opto match exactly. Any allocation change fails the check. - Rejects removed baseline cases and incomplete measurements, and reports newly added cases.
- Saves raw measurements, environment details, and a comparison report as workflow artifacts and a job summary.
The comparison tool and tests use the Go standard library.
Release candidate benchmark results
The second full performance run passed all 63 checks with the original 3% time limit and exact allocation requirements. BenchmarkTranslation/hello/go-intl measured 77.955 ns/op for the baseline and 78.155 ns/op for the candidate (+0.26%), with 24 B/op and 2 allocs/op for both. Allocation medians matched across all cases.
The first run, on an AMD EPYC 7763 runner, flagged that one case at +4.16%. The rerun used an AMD EPYC 9V74 runner. Both used Linux/amd64 and Go 1.26.0; their absolute timings should not be mixed with local results.
A separate six-round local comparison on Apple M3 Pro, macOS/arm64, and Go 1.27.1 measured the same case at 59.655 → 60.165 ns/op (+0.85%), also retaining 24 B/op and 2 allocs/op. Shared runner hardware varies between executions, so use a fixed environment for long-term performance baselines.
Integrations and documentation
- Adds a Fyne desktop example with a headless view test.
- Adds the go-intl best-practice agent skill and Codex/Claude plugin metadata.
- Updates English and Chinese usage documentation with namespace file examples.
- Expands benchmark documentation and charts with allocated bytes and clearer metric labels.
- Separates core CI checks and adds scheduled Go vulnerability scanning.
Verification
Local verification passed for the release tree:
- Core and benchmark comparison tool race tests,
go vet, build, and lint. - Compilation and vet checks for the go-i18n comparison module.
- Bubble Tea, Fyne, MyGo, and NSGo client tests.
- Documentation site lint, Astro checks, and production build.
v0.1.1
Ordinary message interpolation
Compile ordinary placeholders and their surrounding text in source order. Distinct, adjacent, and repeated placeholders use the same renderer. Values are resolved separately at each occurrence, preserving formatting order.
For example, {sender} invited {recipient} and {name} says hi to {name} both use the compiled interpolation path. Each occurrence reads the current value, including a separate call to String() when applicable. ICU plural, select, date, number, and rich-text operations continue to use the instruction renderer.
Install the release with go get github.com/waterkyuu/go-intl@v0.1.1.
The English and Chinese READMEs include updated charts from these runs. The documentation site and contribution guides are also included in this release.
Translation benchmarks
Apple M3 Pro, darwin/arm64, Go 1.27.1. Medians of six rotating runs per implementation, using one logical CPU and 250 ms per case. Each translation was verified before timing, with prepared arguments and a bound translator or warmed localizer. The ten interpolation cases used single-message English dictionaries. Static lookups and the plural case shared a dictionary with 1,024 static keys, a greeting, and a plural message.
The Go library code in v0.1.1 matches the benchmarked commit 3a145af. The go-i18n revision was 93061b1. Each cell reports ns/op · B/op · allocs/op.
| Case | go-intl v0.1.1 | go-i18n | go-intl speedup (go-i18n time / go-intl time) |
|---|---|---|---|
Bare argument {first} |
27.54 · 8 · 1 | 284.60 · 275 · 7 | 10.33× |
Greeting Hello, {first}! |
52.34 · 24 · 2 | 300.70 · 288 · 7 | 5.75× |
Integer Item {id}. (42) |
88.86 · 24 · 3 | 307.60 · 280 · 7 | 3.46× |
Two arguments {first} {last} |
70.28 · 24 · 2 | 420.15 · 320 · 9 | 5.98× |
Adjacent arguments {first}{last} |
68.54 · 24 · 2 | 410.20 · 320 · 9 | 5.98× |
| 4 distinct arguments | 97.93 · 24 · 2 | 670.65 · 384 · 13 | 6.85× |
| 8 distinct arguments | 156.70 · 40 · 2 | 1,152.50 · 528 · 21 | 7.35× |
| 16 distinct arguments | 257.10 · 136 · 3 | 2,015.50 · 816 · 37 | 7.84× |
| 32 distinct arguments | 470.55 · 264 · 3 | 3,877.00 · 1,520 · 70 | 8.24× |
| Same argument repeated 16 times | 265.55 · 136 · 3 | 2,004.00 · 816 · 37 | 7.55× |
| Static lookup, one hot key | 12.61 · 0 · 0 | 104.95 · 0 · 0 | 8.32× |
| Static lookup, 1,024 spread keys | 15.88 · 0 · 0 | 120.65 · 0 · 0 | 7.60× |
| English plural, count 7 | 89.37 · 16 · 2 | 355.75 · 344 · 8 | 3.98× |
v0.1.1-alpha.1 — Compiled message interpolation
Ordinary message interpolation
Compile ordinary placeholders and their surrounding text in source order. Distinct, adjacent, and repeated placeholders use the same renderer. Values are resolved separately at each occurrence, preserving formatting order.
For example, {sender} invited {recipient} and {name} says hi to {name} both use the compiled interpolation path. Each occurrence reads the current value, including a separate call to String() when applicable. ICU plural, select, date, number, and rich-text operations continue to use the instruction renderer.
Install the preview with go get github.com/waterkyuu/go-intl@v0.1.1-alpha.1.
Translation benchmarks
Apple M3 Pro, darwin/arm64, Go 1.27.1. Medians of six rotating runs per implementation, using one logical CPU and 250 ms per case. Each translation was verified before timing, with prepared arguments and a bound translator or warmed localizer. The ten interpolation cases used single-message English dictionaries. Static lookups and the plural case shared a dictionary with 1,024 static keys, a greeting, and a plural message.
The release commit e0312d0 contains the benchmarked library code from 3a145af. The go-i18n revision was 93061b1. Each cell reports ns/op · B/op · allocs/op.
| Case | go-intl v0.1.1-alpha.1 | go-i18n | go-intl speedup (go-i18n time / go-intl time) |
|---|---|---|---|
Bare argument {first} |
27.54 · 8 · 1 | 284.60 · 275 · 7 | 10.33× |
Greeting Hello, {first}! |
52.34 · 24 · 2 | 300.70 · 288 · 7 | 5.75× |
Integer Item {id}. (42) |
88.86 · 24 · 3 | 307.60 · 280 · 7 | 3.46× |
Two arguments {first} {last} |
70.28 · 24 · 2 | 420.15 · 320 · 9 | 5.98× |
Adjacent arguments {first}{last} |
68.54 · 24 · 2 | 410.20 · 320 · 9 | 5.98× |
| 4 distinct arguments | 97.93 · 24 · 2 | 670.65 · 384 · 13 | 6.85× |
| 8 distinct arguments | 156.70 · 40 · 2 | 1,152.50 · 528 · 21 | 7.35× |
| 16 distinct arguments | 257.10 · 136 · 3 | 2,015.50 · 816 · 37 | 7.84× |
| 32 distinct arguments | 470.55 · 264 · 3 | 3,877.00 · 1,520 · 70 | 8.24× |
| Same argument repeated 16 times | 265.55 · 136 · 3 | 2,004.00 · 816 · 37 | 7.55× |
| Static lookup, one hot key | 12.61 · 0 · 0 | 104.95 · 0 · 0 | 8.32× |
| Static lookup, 1,024 spread keys | 15.88 · 0 · 0 | 120.65 · 0 · 0 | 7.60× |
| English plural, count 7 | 89.37 · 16 · 2 | 355.75 · 344 · 8 | 3.98× |
v0.1.0 — High-performance internationalization for Go
go-intl v0.1.0 delivers 12.9 ns per lookup with zero allocations when repeatedly rendering the same static English message with a bound translator. Cycling through 1,024 distinct keys took 15.8 ns per lookup, also with zero allocations.
| Operation | go-intl (ns/op) | go-i18n (ns/op) | Allocations/op (go-intl / go-i18n) |
|---|---|---|---|
| Repeated static key | 12.9 | 116.8 | 0 / 0 |
| 1,024 rotating static keys | 15.8 | 125.8 | 0 / 0 |
| Greeting with a named argument | 66.2 | 288.2 | 3 / 7 |
English plural rendered as 7 items |
81.2 | 336.5 | 2 / 8 |
These figures are medians of three runs on an Apple M3 Pro with Go 1.27.1 (darwin/arm64). Both libraries reused their translator or localizer and argument maps. Constructing a fresh argument map for each greeting brought go-intl to 180 ns/op. Full benchmarks and methodology
What ships in v0.1.0
- Share one immutable catalog across Bubble Tea, MyGo, NSGo, and HTTP handlers. Select a language with
t := catalog.Translations("fr"), then callt("Inbox.title"). Namespaces are optional. - Define messages in Go or load JSON, TOML, YAML, and CSV. Set the fallback language with the first argument to
intl.New. - Render named arguments, conditional branches, cardinal and ordinal plurals, and rich text. Format numbers, currencies, dates, and times for the selected locale.
- Extract, merge, and check translations with the
go-intlCLI.
Install with Go 1.25 or later
go get github.com/waterkyuu/go-intl@v0.1.0To install the optional CLI, run go install github.com/waterkyuu/go-intl/cmd/go-intl@v0.1.0.