feat(i18n): add regional English variants with en_GB as default

- Rename en.json to en_GB.json (British English)
- Add en_US.json with American spellings (color, analyze, etc.)
- Add en_AU.json for Australian English
- Set BritishEnglish as the bundle default language

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Snider 2026-01-30 02:48:36 +00:00
parent e8e48127c2
commit 2252d6bda1
4 changed files with 2562 additions and 5 deletions

View file

@ -75,7 +75,7 @@ func New() (*Service, error) {
// NewWithFS creates a new i18n service loading locales from the given filesystem.
// This allows the GUI to provide its own locale files.
func NewWithFS(fsys fs.FS, dir string) (*Service, error) {
bundle := i18n.NewBundle(language.English)
bundle := i18n.NewBundle(language.BritishEnglish)
bundle.RegisterUnmarshalFunc("json", json.Unmarshal)
availableLangs, err := loadLocalesFromFS(bundle, fsys, dir)
@ -86,14 +86,14 @@ func NewWithFS(fsys fs.FS, dir string) (*Service, error) {
s := &Service{
bundle: bundle,
availableLangs: availableLangs,
currentLang: "en",
currentLang: "en-GB",
}
// Try to detect system language
if detected, err := detectLanguage(availableLangs); err == nil && detected != "" {
_ = s.SetLanguage(detected)
} else {
_ = s.SetLanguage("en")
_ = s.SetLanguage("en-GB")
}
return s, nil
@ -105,9 +105,9 @@ func NewWithBundle(bundle *i18n.Bundle, langs []language.Tag) *Service {
s := &Service{
bundle: bundle,
availableLangs: langs,
currentLang: "en",
currentLang: "en-GB",
}
_ = s.SetLanguage("en")
_ = s.SetLanguage("en-GB")
return s
}

1352
pkg/i18n/locales/en_GB.json Normal file

File diff suppressed because it is too large Load diff

1205
pkg/i18n/locales/en_US.json Normal file

File diff suppressed because it is too large Load diff