How davlet42/ai18n works
i18n-agent is a CLI for managing source and target locale files: it plans translations against a committed lockfile, sends batches through a configurable agent/provider, validates results, and writes targets without overwriting human-owned values. It also imports native locale formats, checks drift and Android structure, and exports web, Android, iOS, TypeScript-key, or bundle outputs. The principal flow is documented in the README and supported by the sync and translation excerpts; unsampled command internals and integrations are not expanded beyond documented relationships.
Main entry points: sync.ts Sync orchestrator · export.ts Export command · android-check.ts Android checks · translate-batch.ts Translation and guards
Components 29
CLI workflows
- CLI entry
src/cli.ts - Project config
src/config.ts - Translate command
src/commands/translate.ts - Import command
src/commands/import.ts - Check command
src/commands/check.ts - Status command
src/commands/status.ts - Report command
src/commands/report.ts
Translation engine
- Sync orchestrator
src/sync.ts - Change planner
src/planner.ts - Ownership lockfile
src/lockfile.ts - Hints and glossary
src/context-glossary.ts - Translation and guards
src/translate-batch.ts - Provider transport
src/translate-provider.ts - Run metrics
src/metrics.ts
Locale formats
- Locale file IO
src/locale-files.ts - Android importer
src/importers/android-xml-import.ts - iOS importer
src/importers/xcstrings-import.ts - Android checks
src/validators/android-check.ts - Plural validation
src/validators/cldr-plural.ts - Placeholder validation
src/validators/placeholder-set.ts - Android markup rules
src/android-markup.ts
Export and delivery
- Export command
src/commands/export.ts - Android resources
src/exporters/android.ts - iOS catalog
src/exporters/xcstrings.ts - Web and TS output
src/exporters/simple.ts - Shared format transforms
src/exporters/transform.ts - Static bundle
src/bundle.ts - Nest delivery module
packages/nest/src/index.ts
Other components
- Project user
Connections 40
- Project user → CLI entry: runs commands
README.md - CLI entry → Translate command: dispatches
- Translate command → Project config: loads settings
src/commands/translate.ts - Translate command → Sync orchestrator: runs sync
src/commands/translate.ts - Sync orchestrator → Change planner: plans changes
src/sync.ts - Sync orchestrator → Locale file IO: reads and writes
src/sync.ts - Sync orchestrator → Ownership lockfile: tracks ownership
src/sync.ts - Sync orchestrator → Hints and glossary: loads guidance
src/sync.ts - Sync orchestrator → Provider transport: creates transport
src/sync.ts - Sync orchestrator → Translation and guards: translates batches
src/sync.ts - Sync orchestrator → Run metrics: records runs
src/sync.ts - Translation and guards → Plural validation: validates plurals
src/translate-batch.ts - Translation and guards → Placeholder validation: validates arguments
src/translate-batch.ts - Translation and guards → Android markup rules: checks markup
src/translate-batch.ts - Plural validation → Shared format transforms: parses ICU
src/validators/cldr-plural.ts - Import command → Project config: loads settings
src/commands/import.ts - Import command → Android importer: imports Android
src/commands/import.ts - Import command → iOS importer: imports iOS
src/commands/import.ts - Android importer → Locale file IO: writes locales
src/importers/android-xml-import.ts - iOS importer → Locale file IO: writes locales
src/importers/xcstrings-import.ts - Check command → Project config: loads settings
src/commands/check.ts - Check command → Android checks: checks Android
src/commands/check.ts - Status command → Android checks: checks structure
src/commands/status.ts - Android checks → Plural validation: validates plurals
src/validators/android-check.ts - Android checks → Placeholder validation: validates format args
src/validators/android-check.ts - Android checks → Android markup rules: validates markup
src/validators/android-check.ts - Report command → Run metrics: reports metrics
- Export command → Project config: loads settings
src/commands/export.ts - Export command → Locale file IO: reads locales
src/commands/export.ts - Export command → Android resources: emits Android
src/commands/export.ts - Export command → iOS catalog: emits catalog
src/commands/export.ts - Export command → Web and TS output: emits web output
src/commands/export.ts - Export command → Static bundle: builds bundle
src/commands/export.ts - Android resources → Shared format transforms: converts placeholders
src/exporters/android.ts - iOS catalog → Shared format transforms: converts placeholders
src/exporters/xcstrings.ts - Project user → Export command: requests export
README.md - Project user → Import command: requests import
README.md - Project user → Check command: checks drift
README.md - Project user → Status command: requests status
README.md - Static bundle → Nest delivery module: serves bundle
README.md