Skip to content

fix: ElevenLabs language mapping — fetch /v1/models for full language coverage#52

Merged
OwenMcGirr merged 2 commits into
mainfrom
fix/51-elevenlabs-language-mapping
Apr 12, 2026
Merged

fix: ElevenLabs language mapping — fetch /v1/models for full language coverage#52
OwenMcGirr merged 2 commits into
mainfrom
fix/51-elevenlabs-language-mapping

Conversation

@OwenMcGirr
Copy link
Copy Markdown
Collaborator

Closes #51

Problem

_mapVoicesToUnified used voice.labels?.accent (e.g. "american", "british") as the bcp47 language code. These are accent strings, not BCP-47 codes, so the language filter never matched anything. Additionally, multilingual voices (v2, turbo, flash) support 30+ languages but were only tagged with a single accent.

Fix

Fetch /v1/models in parallel with /v1/voices. Each model exposes a languages: [{ language_id, name }] array. Cross-reference each voice's high_quality_base_model_ids with the model map to build the full union of supported languages, deduplicated.

  • language_id ("en", "es") used as bcp47
  • name ("English", "Spanish") used as display
  • Voices with no model associations fall back to [{ bcp47: "en", ... }]
  • Models with can_do_text_to_speech: false are excluded

Test plan

  • 4 new unit tests in __tests__/elevenlabs-language-mapping.test.ts — all pass
  • Full suite: 441 tests pass, 0 new failures
  • npm run build — clean

…erage (#51)

- Add _getVoicesWithModels() helper that fetches /v1/models in parallel
  with /v1/voices and resolves each voice's supported languages from its
  high_quality_base_model_ids
- Deduplicate languages across multiple models per voice
- Fall back to English for voices with no model associations
- Update _mapVoicesToUnified to use resolved languages instead of
  labels.accent (which was a non-BCP-47 accent string, not a language code)
@OwenMcGirr OwenMcGirr merged commit 109c300 into main Apr 12, 2026
6 checks passed
@OwenMcGirr OwenMcGirr deleted the fix/51-elevenlabs-language-mapping branch April 12, 2026 14:09
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.

fix: ElevenLabs language mapping — accent label is not a BCP-47 code and multilingual voices list only one language

1 participant