Snider
e11b6dc2cf
feat(i18n): add CountString and fix FormalityString return type
...
- Add CountString() to return count as string
- Fix FormalityString() to return string instead of Formality type
- Both Int and String getters now available for count field
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 17:56:56 +00:00
Snider
9645cea7d6
refactor(i18n): standardise code patterns and naming
...
- Add nil safety to chainable Subject methods (Count, Gender, In, Formal, Informal, Formality)
- Rename getters to use return type suffix pattern:
- CountValue → CountInt
- GenderValue → GenderString
- Location → LocationString
- NounValue → NounString
- FormalityValue → FormalityString
- Fix comment style for plural rule functions to follow Go doc conventions
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 17:53:11 +00:00
Snider
1c7ff0511b
refactor(i18n): rename getters to idiomatic Go and add tests
...
Rename Subject getters from GetX() to idiomatic Go naming:
- GetCount → CountValue
- GetGender → GenderValue
- GetLocation → Location
- GetNoun → NounValue
- GetFormality → FormalityValue
Add comprehensive tests for checks.go and mutate.go functions
that will be useful for future CLDR plural category support.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 17:44:22 +00:00
Snider
e4b2675d99
refactor(i18n): merge compose_intents_test.go into compose_test.go
...
Consolidate all compose-related tests into a single file for better
organisation. The grammar composition tests that verify intent templates
now live alongside the Subject tests.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 16:57:47 +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
46f6d4c5fe
feat(i18n): add Phase 4 extended language support
...
Fluent Intent Builder API:
- I("core.delete").For(S("file", path)).Question()
- I("core.delete").With(subject).Compose()
- Convenience methods: Question(), Success(), Failure(), Meta(), IsDangerous()
Formality Levels (for Sie/du, vous/tu languages):
- FormalityNeutral, FormalityInformal, FormalityFormal constants
- Subject.Formal(), Subject.Informal(), Subject.Formality()
- Service.SetFormality(), Service.Formality()
- Package-level SetFormality()
CLDR Plural Categories:
- PluralZero, PluralOne, PluralTwo, PluralFew, PluralMany, PluralOther
- Language-specific plural rules: English, German, French, Spanish, Russian, Polish, Arabic, Chinese, Japanese, Korean
- Message.ForCategory() for proper plural selection
- Service.PluralCategory() for getting category by count
RTL Text Direction Support:
- TextDirection type (DirLTR, DirRTL)
- IsRTLLanguage() for language detection
- Service.Direction(), Service.IsRTL()
- Package-level Direction(), IsRTL()
GrammaticalGender type:
- GenderNeuter, GenderMasculine, GenderFeminine, GenderCommon
- For future gender agreement in gendered languages
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 12:55:41 +00:00
Snider
fa6d62e385
feat(i18n): add debug mode and NewSubject alias
...
- Add SetDebug()/Debug() methods for showing key prefixes in output
- Debug mode shows: "[cli.success] Success" instead of "Success"
- Add NewSubject() as alias for S() for readability
- Both T() and C() respect debug mode
Debug mode is useful for:
- Identifying which translation keys are used where
- Verifying correct key usage during development
- QA testing of translation coverage
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 12:47:28 +00:00
Snider
f85064a954
feat(i18n): implement semantic i18n system with grammar engine
...
Add semantic intent system for natural language CLI interactions:
- Mode system (Normal/Strict/Collect) for missing key handling
- Subject type with fluent builder for typed subjects
- Composed type with Question/Confirm/Success/Failure forms
- 30+ core.* intents (delete, create, commit, push, etc.)
- Grammar engine: verb conjugation, noun pluralization, articles
- Template functions: title, lower, upper, past, plural, article
- Enhanced CLI: Confirm with options, Question, Choose functions
- Collect mode handler for QA testing
Usage:
i18n.T("core.delete", i18n.S("file", "config.yaml"))
result := i18n.C("core.delete", subject)
cli.ConfirmIntent("core.delete", subject)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 12:29:44 +00:00