Skip to content

feat: add Catalan (ca) language support as default locale#371

Open
jaumemir wants to merge 1 commit intoTHU-MAIC:mainfrom
jaumemir:feat/i18n-catalan
Open

feat: add Catalan (ca) language support as default locale#371
jaumemir wants to merge 1 commit intoTHU-MAIC:mainfrom
jaumemir:feat/i18n-catalan

Conversation

@jaumemir
Copy link
Copy Markdown

@jaumemir jaumemir commented Apr 4, 2026

Summary

Adds full Catalan (ca) language support to OpenMAIC as the default locale, covering UI labels, course content generation, TTS audio voices, and all language selectors across the application.

Related Issues

Changes

  • lib/i18n/types.ts — Widened Locale type to 'zh-CN' | 'en-US' | 'ca'; set defaultLocale = 'ca'; exported VALID_LOCALES centrally
  • lib/i18n/settings.ts / chat.ts / common.ts / stage.ts / generation.ts — Added full Catalan translation objects (~600+ keys)
  • lib/i18n/index.ts — Registered 'ca' in the translation map and updated getClientTranslation
  • lib/hooks/use-i18n.tsx — Auto-detects Catalan via navigator.language.startsWith('ca'); imports VALID_LOCALES from central source
  • components/header.tsx — Added "CA" locale pill to the language switcher
  • app/page.tsx — Extended FormState.language union; added CA option to the generation language selector; default is 'ca'
  • components/generation/generation-toolbar.tsx — Updated 3-language cycle (zh-CN → en-US → ca → …)
  • components/agent/agent-bar.tsx — Added Catalan TTS preview text ("Benvingut a l'aula d'IA")
  • lib/server/classroom-generation.tsnormalizeLanguage() now handles 'ca'
  • lib/types/generation.ts — All language union types widened to include 'ca'
  • lib/audio/constants.ts — Added ca-ES-AlbaNeural (female) and ca-ES-EnricNeural (male) Azure TTS voices

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • CI/CD or build changes

Verification

Steps to reproduce / test

  1. Open the application — the UI should load in Catalan by default
  2. Navigate to Settings → verify all labels and section titles appear in Catalan
  3. In the course generation form, verify "Català" is pre-selected as the language
  4. Generate a course with language set to Catalan — verify the content is generated in Catalan
  5. Enable TTS with Azure TTS → verify ca-ES-AlbaNeural and ca-ES-EnricNeural appear in the voice list
  6. Switch browser language to en or zh and reload — verify auto-detection switches locale correctly

What you personally verified

  • UI renders correctly in Catalan across all main views (chat, stage, settings, generation toolbar)
  • Language selector cycles correctly between ZH → EN → CA → ZH
  • Browser auto-detection works for ca, en, and zh-CN navigator languages
  • Catalan TTS voices appear in the Azure TTS voice list
  • No TypeScript errors introduced

Evidence

  • CI passes (pnpm check && pnpm lint && npx tsc --noEmit)
  • Manually tested locally
  • Screenshots / recordings attached (if UI changes)

Development

Development realized by Claude Code, under supervision of Author.

- Add 'ca' to Locale type with VALID_LOCALES export; set defaultLocale to 'ca'
- Add Catalan translations (400+ keys) to all 5 i18n modules
- Update language selectors in header and home page (CN/EN/CA dropdown)
- Update generation toolbar to cycle through 3 languages (中文/EN/CA)
- Extend UserRequirements, SceneOutline and pblConfig language unions to include 'ca'
- Update normalizeLanguage, scene-generator and scene-content route for 'ca'
- Add Azure TTS Catalan voices (ca-ES-AlbaNeural, ca-ES-EnricNeural)
- Update TTS preview text with Catalan fallback

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@wyuc
Copy link
Copy Markdown
Contributor

wyuc commented Apr 6, 2026

Hey, thanks for putting this together!

Since this PR was opened, we've refactored the i18n system. Adding a new locale now only needs two changes:

  1. A lib/i18n/locales/<locale>.json file with all translation keys
  2. One line in lib/i18n/locales.ts to register it

See the Translation Guide and #365 (Japanese) for reference.

Could you rebase onto current main and simplify your PR to follow this pattern? The translation strings you've already done are great, it's mainly the wiring that needs updating. Happy to merge once it's aligned.

Also, please keep the default locale as zh-CN. Changing it to ca would break the experience for existing users.

1 similar comment
@wyuc
Copy link
Copy Markdown
Contributor

wyuc commented Apr 6, 2026

Hey, thanks for putting this together!

Since this PR was opened, we've refactored the i18n system. Adding a new locale now only needs two changes:

  1. A lib/i18n/locales/<locale>.json file with all translation keys
  2. One line in lib/i18n/locales.ts to register it

See the Translation Guide and #365 (Japanese) for reference.

Could you rebase onto current main and simplify your PR to follow this pattern? The translation strings you've already done are great, it's mainly the wiring that needs updating. Happy to merge once it's aligned.

Also, please keep the default locale as zh-CN. Changing it to ca would break the experience for existing users.

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.

2 participants