Feat/french language support - #81
Open
AliAhmed-004 wants to merge 3 commits into
Open
Conversation
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>
Author
|
These are the audios generated by the flow: fr_1_greeting.mp3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add French language support (TTS + STT)
Adds French (
fr) as a conversation-only, LTR language, following the sameconfig 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.js—fr(Français), LTR, not RTLlanguage-prompts.js— natural French Rumi personagamma-languages.config.js— French lesson-plan / presentation outputlanguage-config.js— French coaching reflective-questionssystem-messages.js— French for all 11 canned messagesutils/language-detector.js— French/languageoverride commands (Latin-script,so explicit commands + Soniox trust rather than a Unicode rule)
Voice — TTS
tts-voices.js+constants.js—frroutes to ElevenLabseleven_v3; defaultsto the shared multilingual voice, override with
ELEVENLABS_VOICE_ID_FR; OpenAItts-1remains the automatic fallbackVoice — STT
audio.service.js—fradded to the Soniox multi-language auto-detect hints(consolidated the duplicated inline list into
SONIOX_AUTODETECT_HINTS)language-detector.service.js—fradded toSONIOX_TRUSTED_LANGUAGESDB + config
017_add_french_language.sql— no-op-safepreferred_languageCHECK update.env.template—ELEVENLABS_VOICE_ID_FR+ French picker examplesBug fix (general, not French-only)
While wiring STT I found that when Soniox returns language only per-token (v3/v5,
top-level
languageis null), the code fell back to a rule-based text detectorthat can't read Latin-script languages — it mislabeled French as
en/es, whichwould 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'sown 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-tokenlanguage derivation (incl. region-strip + null fallback), and
frtrustVerified live end-to-end
eleven_v3; transcription + back-translationby an independent model confirmed correct, intelligible French
fridentified on3/3 clips, transcripts accurate
French identified 3/3, transcripts round-trip to the seed (punctuation aside)
Not included (intentionally deferred, same as the Indian suite)
en/uronly)