feat: add language fallback handler for Kokoro TTS#124
Open
udaykumarreddykasaram07-eng wants to merge 2 commits intosugarlabs:mainfrom
Open
feat: add language fallback handler for Kokoro TTS#124udaykumarreddykasaram07-eng wants to merge 2 commits intosugarlabs:mainfrom
udaykumarreddykasaram07-eng wants to merge 2 commits intosugarlabs:mainfrom
Conversation
PR sugarlabs#24 contained an invalid SVG that GitHub cannot render. This provides a valid, properly structured SVG icon that: - Renders correctly in all SVG viewers - Uses Sugar orange color palette - Adds AI speech bubble to distinguish from original Speak - Adds sound waves to represent TTS voice synthesis Closes #2
Adds utils/language_fallback.py with: - resolve_lang_code(): maps ISO codes, names, or Kokoro codes to valid Kokoro lang_codes with graceful English fallback - get_supported_languages(): returns all supported languages - is_non_latin_script(): flags languages needing G2P preprocessing (Hindi, Japanese, Chinese) before passing to KPipeline Prevents silent crashes when unsupported language codes are passed to KPipeline. Adds proper logging when fallback occurs. Relates to GSoC 2026 Speak-AI Multilingual Support proposal.
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.
Adds
utils/language_fallback.pyto safely handle language codes for Kokoro TTS.What this fixes:
How to test:
python3 -c "from utils.language_fallback import resolve_lang_code; print(resolve_lang_code('hi'))"
Output: ('h', True)
python3 -c "from utils.language_fallback import resolve_lang_code; print(resolve_lang_code('xyz'))"
Output: ('a', False) + warning log
Relates to GSoC 2026 Speak-AI Multilingual Support proposal.