Skip to content

feat(i18n): Native multi-language support with --lang flag (EN + ES)#19

Draft
ramsani wants to merge 3 commits into
mainfrom
feature/i18n-native
Draft

feat(i18n): Native multi-language support with --lang flag (EN + ES)#19
ramsani wants to merge 3 commits into
mainfrom
feature/i18n-native

Conversation

@ramsani
Copy link
Copy Markdown
Owner

@ramsani ramsani commented May 16, 2026

feat(i18n): Native i18n — Multi-language Artifact Generation

What

Implements Issue #15 — Native i18n with Spanish + English support.

New files:

  • scripts/i18n-phrases.json — 22 key structural phrases translated to EN and ES
  • scripts/i18n-detect.py — Language detection using character frequency analysis (Spanish accents, common words)
  • tests/test_i18n.py — Validates detection accuracy and phrase coverage

Modified: scripts/deliver-artifact.py

  • Added --lang en|es|auto flag
  • --lang es sets <html lang="es"> in the artifact
  • --lang en sets <html lang="en">
  • --lang auto (default) detects from artifact content
  • Updates artifact <html lang> attribute after generation
  • Records artifact_language in metadata JSON

Why

The docs/LANGUAGE_POLICY.md establishes that user-facing artifact content should match the user's language. Currently this is handled inconsistently. The i18n system makes language a first-class runtime feature:

  • Runtime --lang flag: Force EN or ES output explicitly
  • Automatic detection: Uses character frequency analysis to detect from content
  • Correct <html lang>: Screen readers and search engines get the right language
  • Metadata recording: Artifacts track their own language for re-use decisions

Acceptance Criteria (from #15)

  • deliver-artifact.py --lang es generates artifact with <html lang="es">
  • deliver-artifact.py --lang en generates artifact with <html lang="en">
  • deliver-artifact.py (no flag) detects language automatically from content
  • i18n-phrases.json has 22+ phrases in both en and es
  • audit-artifact.py (unchanged) continues to pass — no regression
  • Artifact metadata includes artifact_language field
  • validate-runtime.sh includes i18n smoke test

Testing

python scripts/i18n-detect.py --help
echo "La arquitectura del sistema" | python scripts/i18n-detect.py
# Expected: es

python scripts/deliver-artifact.py --help | grep lang
# Expected: --lang [en|es|auto]

python tests/test_i18n.py
# All tests pass

Closes #15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🌍 Native i18n: Runtime multi-language support (Spanish + English)

1 participant