2 Migration-from-core-go
Virgil edited this page 2026-02-19 14:56:39 +00:00

Migration from core/go pkg/i18n

Context

core/go/pkg/i18n was the original i18n implementation bundled inside the monolith. It has been partially extracted to go-i18n but the extraction is incomplete.

What Migrates vs What Stays

Migrates to go-i18n (already done)

  • Grammar primitives (PastTense, Gerund, Pluralize, Article)
  • Irregular verb/noun databases
  • Handler chain pattern (i18n.* namespace magic)
  • Service + message lookup
  • Subject builder
  • Number/time formatting
  • Plural categories (CLDR)
  • RTL/LTR support

Stays in core/go (to be removed)

  • 34 locale files — bad data, needs full rework, NOT migrated
  • CLI integration wrapper — belongs in core/cli, not go-i18n
  • Completeness validation tool — CLI-specific, not library concern

Key Principle

go-i18n is a grammar engine, not a translation file manager.

Consumers (core/cli, apps) bring their own translation files. go-i18n provides:

  1. Grammar primitives for composing grammatically correct text
  2. Reversal engine for extracting grammar structure
  3. GrammarImprint for privacy-preserving classification
  4. Training data multiplier for augmentation

It does NOT ship, manage, or validate consumer translation files.

Steps to Complete Migration

  1. core/cli imports forge.lthn.ai/core/go-i18n instead of pkg/i18n
  2. core/cli manages its own locale files (fresh, not copied from bad data)
  3. core/go removes pkg/i18n/ entirely
  4. core/go go.work includes go-i18n for local dev