Snider
f10a2b4bdb
refactor(i18n): remove legacy i18n.{format} shortcuts
...
Use i18n.numeric.* namespace consistently:
- i18n.numeric.number
- i18n.numeric.decimal
- i18n.numeric.percent
- i18n.numeric.bytes
- i18n.numeric.ordinal
- i18n.numeric.ago
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 17:34:45 +00:00
Snider
8f977ed635
feat(i18n): add N() helper for numeric formatting
...
N(format, value) wraps T("i18n.numeric.{format}", value).
Supported formats:
- N("number", 1234567) → "1,234,567"
- N("decimal", 1234.5) → "1,234.5"
- N("percent", 0.85) → "85%"
- N("bytes", 1536000) → "1.5 MB"
- N("ordinal", 1) → "1st"
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 17:33:18 +00:00
Snider
650c7b1c5a
refactor(i18n): consolidate types into interfaces.go
...
Move all exported types to interfaces.go for consistent organisation.
Rename interface.go → interfaces.go.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 17:24:24 +00:00
Snider
b04b2a70dc
feat(i18n): implement formality-based message selection
...
Add support for formal/informal translation variants using suffix convention:
- key._formal for formal address (Sie, vous, usted)
- key._informal for informal address (du, tu, tú)
Formality priority: Subject.Formal() > Service.SetFormality() > neutral
Example locale file:
"greeting": "Hello",
"greeting._formal": "Good morning, sir",
"greeting._informal": "Hey there"
Usage:
svc.SetFormality(FormalityFormal)
svc.T("greeting") // "Good morning, sir"
svc.T("greeting", S("user", name).Informal()) // "Hey there"
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 17:13:12 +00:00
Snider
04d8772cba
refactor(i18n): remove C() and move intents to test-only
...
Breaking change: Remove C() semantic intent composition API.
- Remove C() global function and Service.C() method
- Remove IntentBuilder fluent API (I(), For(), Compose(), etc.)
- Move coreIntents from intents.go to intents_test.go (test data only)
- Remove C() from Translator interface
Replace intent-based CLI helpers with grammar composition:
- ConfirmIntent → ConfirmAction(verb, subject)
- ConfirmDangerous → ConfirmDangerousAction(verb, subject)
- QuestionIntent → QuestionAction(verb, subject)
- ChooseIntent → ChooseAction(verb, subject, items)
- ChooseMultiIntent → ChooseMultiAction(verb, subject, items)
The intent definitions now serve purely as test data to verify
the grammar engine can compose identical strings.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 16:50:08 +00:00
Snider
2d1dbcc473
refactor(i18n): extract Service to service.go
...
Move Service struct, methods, constructors, and singleton management
to dedicated file for better code organization.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 14:50:25 +00:00