Skip to content

Feat/french language support - #81

Open
AliAhmed-004 wants to merge 3 commits into
Orenda-Project:mainfrom
AliAhmed-004:feat/french-language-support
Open

Feat/french language support#81
AliAhmed-004 wants to merge 3 commits into
Orenda-Project:mainfrom
AliAhmed-004:feat/french-language-support

Conversation

@AliAhmed-004

Copy link
Copy Markdown

Add French language support (TTS + STT)

Adds French (fr) as a conversation-only, LTR language, following the same
config seams as the Indian-language suite (#75). French is exposed globally
deployments opt in via SETTINGS_LANGUAGES / region_features.supported_languages;
no francophone country is hardcoded, so lesson-plan localization uses the existing
region-neutral fallback (French is spoken across France, Canada, Belgium, and
much of West/Central Africa).

What's included

Text + LLM

  • supported-languages.jsfr (Français), LTR, not RTL
  • language-prompts.js — natural French Rumi persona
  • gamma-languages.config.js — French lesson-plan / presentation output
  • language-config.js — French coaching reflective-questions
  • system-messages.js — French for all 11 canned messages
  • utils/language-detector.js — French /language override commands (Latin-script,
    so explicit commands + Soniox trust rather than a Unicode rule)

Voice — TTS

  • tts-voices.js + constants.jsfr routes to ElevenLabs eleven_v3; defaults
    to the shared multilingual voice, override with ELEVENLABS_VOICE_ID_FR; OpenAI
    tts-1 remains the automatic fallback

Voice — STT

  • audio.service.jsfr added to the Soniox multi-language auto-detect hints
    (consolidated the duplicated inline list into SONIOX_AUTODETECT_HINTS)
  • language-detector.service.jsfr added to SONIOX_TRUSTED_LANGUAGES

DB + config

  • 017_add_french_language.sql — no-op-safe preferred_language CHECK update
  • .env.templateELEVENLABS_VOICE_ID_FR + French picker examples

Bug fix (general, not French-only)

While wiring STT I found that when Soniox returns language only per-token (v3/v5,
top-level language is null), the code fell back to a rule-based text detector
that can't read Latin-script languages — it mislabeled French as en/es, which
would make the bot reply to a French voice note in the wrong language. Fixed at the
root: new AudioService._languageFromTokens() derives the language from Soniox's
own per-token IDs before the text fallback. This is strictly more reliable for
every language, not just French.

Testing

  • tests/language/french-language.test.js — TTS/config surfaces (persona, gamma,
    system messages, voice routing, override commands, region-neutral localization)
  • tests/language/french-stt.test.js — Soniox auto-detect hints, per-token
    language derivation (incl. region-strip + null fallback), and fr trust
  • Full suite: 1491/1491 passing, 144 suites, all conformance guards green

Verified live end-to-end

  • TTS — generated French audio via eleven_v3; transcription + back-translation
    by an independent model confirmed correct, intelligible French
  • STT — fed the audio back through the real Soniox path: fr identified on
    3/3 clips, transcripts accurate
  • Full voice loop — seed text → TTS → audio → STT → transcript → TTS → audio:
    French identified 3/3, transcripts round-trip to the seed (punctuation aside)

Not included (intentionally deferred, same as the Indian suite)

  • Reading-assessment WCPM/LCPM norms (still en/ur only)
  • A hardcoded francophone region/currency (left to per-deployment config)

AliAhmed-004 and others added 3 commits August 5, 2026 13:36
Pre-PR review cleanups on the French STT work:
- Move _languageFromTokens above transcribeWithLanguagePreference so each
  method keeps its own JSDoc (the helper had split the latter's docblock off).
- Note French (distinct phonology), not just Brahmic scripts, in the
  SONIOX_TRUSTED_LANGUAGES rationale.

No behaviour change. Suite: 1491/1491.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@AliAhmed-004

Copy link
Copy Markdown
Author

These are the audios generated by the flow:

fr_1_greeting.mp3
fr_2_lesson_ready.mp3
fr_3_encouragement.mp3

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.

[Feature] Add French language support (fr) for Francophone Africa deployments

1 participant