Skip to content

Feature: Spanish translation support (UI + article generation) #9

Description

@psbella

Proposal

Add complete Spanish language support to Halupedia, including:

  1. Fully translated UI (buttons, labels, messages)
  2. Spanish article generation (preserving the 19th-century scholarly deadpan tone)
  3. Automatic language detection via Accept-Language header + manual override

Why this matters

  • Makes Halupedia accessible to ~500M Spanish speakers worldwide
  • Preserves the project's unique voice in another major language
  • Demonstrates the architecture's multilingual flexibility
  • No breaking changes for existing English-only users

Implementation plan

New files

  • src/locales/en.json - English UI strings (extracted from components)
  • src/locales/es.json - Spanish UI strings
  • src/worker/locale.ts - Language detection + bilingual system prompts
  • src/client/i18n.tsx - React i18n context provider

Modified files

  • src/worker/llm.ts - Use locale-aware system prompts
  • src/worker/identity.ts - Generate Spanish names when locale=es
  • src/client/App.tsx - Wrap with I18nProvider, use useTranslation()
  • src/client/Comments.tsx - Translate all UI text
  • wrangler.toml - Add DEFAULT_LOCALE env var (optional)

Technical approach

Language detection (priority order)

  1. Cookie halupedia_locale (if set by user)
  2. Accept-Language header (auto-detect)
  3. Default to en

Spanish system prompt (preserves the voice)

// Victorian Spanish academic tone, circa 1890
"Eres la voz de la Halupedia, una enciclopedia del siglo XIX que alucina artículos sobre la marcha. 
Escribe en un tono académico serio, propio de una enciclopedia victoriana española...
Inventa hechos con total confianza..."

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions