go/pkg/php/i18n.go
Snider 71e15236e2 feat(i18n): add RegisterLocales for package locale registration
- Add i18n.RegisterLocales(fsys, dir) for packages to register translations
- Locales are automatically loaded when i18n.Init() is called
- Fix gram.word.* loading bug (strings were in wrong switch case)
- Fix loadJSON to merge messages instead of replacing
- Add common.* keys to base locale (labels, flags, progress, etc.)
- Add pkg/php/locales with PHP-specific translations
- pkg/php/i18n.go registers locales via init()

This enables the idiomatic pattern where packages register their
locale files and they're automatically loaded by the i18n system.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 20:51:32 +00:00

16 lines
285 B
Go

// Package php provides PHP/Laravel development tools.
package php
import (
"embed"
"github.com/host-uk/core/pkg/i18n"
)
//go:embed locales/*.json
var localeFS embed.FS
func init() {
// Register PHP translations with the i18n system
i18n.RegisterLocales(localeFS, "locales")
}