diff options
| author | historia <historiavg@proton.me> | 2026-08-27 15:53:22 -0400 |
|---|---|---|
| committer | historia <historiavg@proton.me> | 2026-08-27 15:53:22 -0400 |
| commit | 2252a0e4ae86fcc71a58af99d63750adab54cabd (patch) | |
| tree | 489a5e5d2124a831be31a69ee740ec4c260661e1 /app/converter/clients/languages.py | |
| parent | 5b98993b13dafe9a85495e4c68ad9b42863ef2bf (diff) | |
| download | tts-audiobook-generator-2252a0e4ae86fcc71a58af99d63750adab54cabd.tar.gz | |
feat: menu for language options
Diffstat (limited to 'app/converter/clients/languages.py')
| -rw-r--r-- | app/converter/clients/languages.py | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/app/converter/clients/languages.py b/app/converter/clients/languages.py index 079dead..c73dc7c 100644 --- a/app/converter/clients/languages.py +++ b/app/converter/clients/languages.py @@ -4,14 +4,18 @@ from typing import Optional # Languages the Qwen3-TTS demo accepts as display names (its API silently # falls back to "Auto" for anything else, so unknown names are rejected -# before a run starts instead of mispronouncing a whole book). +# before a run starts instead of mispronouncing a whole book). Arabic, +# Hindi and Vietnamese come from the audio.cpp WebUI language menus +# (MagpieTTS / IndexTTS2); on Qwen they degrade to Auto. TTS_LANGUAGES = ( "Auto", "Chinese", "English", "German", "Italian", "Portuguese", - "Spanish", "Japanese", "Korean", "French", "Russian", + "Spanish", "Japanese", "Korean", "French", "Russian", "Arabic", + "Hindi", "Vietnamese", ) # Short aliases accepted on the command line (ISO 639-1 codes and common -# shorthands), mapped to the display names above. +# shorthands), mapped to the display names above. The Arabic regional +# variants collapse to plain Arabic. TTS_LANGUAGE_ALIASES = { "zh": "Chinese", "en": "English", @@ -23,11 +27,17 @@ TTS_LANGUAGE_ALIASES = { "ko": "Korean", "fr": "French", "ru": "Russian", + "ar": "Arabic", + "hi": "Hindi", + "vi": "Vietnamese", "zh-cn": "Chinese", "zh-tw": "Chinese", "pt-br": "Portuguese", "en-us": "English", "en-gb": "English", + "ar-ae": "Arabic", + "ar-msa": "Arabic", + "ar-sa": "Arabic", } # Qwen display names -> ISO 639-1 codes, for audio.cpp families whose @@ -45,8 +55,22 @@ LANGUAGE_ISO_CODES = { "Korean": "ko", "French": "fr", "Russian": "ru", + "Arabic": "ar", + "Hindi": "hi", + "Vietnamese": "vi", } +# Static selection-list order for the TUI Language menus (Settings and +# Generate audiobooks): the languages of audio.cpp's WebUI language menus +# (MagpieTTS + IndexTTS2) plus the shared display names, with common +# languages near the top. A static list — new audio.cpp menu languages +# need this tuple updated by hand. +LANGUAGE_CHOICES = ( + "English", "Spanish", "Chinese", "French", "German", "Italian", + "Portuguese", "Japanese", "Korean", "Russian", "Arabic", "Hindi", + "Vietnamese", "Auto", +) + def normalize_language(value: Optional[str]) -> str: """Normalize a user-provided language name to a Qwen3-TTS display name. |
