Open
Conversation
…an be parsed by langcodes module.
…des. Handle error by returning the equivalent alpha code.
…an be parsed by langcodes module.
Owner
|
Great. Don't do this yet - this is more a comment for me. I think we need to keep dialect / region info. This is actually tough because it needs reimagining what the final dict looks like but here's an idea def getISOLangCode(dialect: str) -> Tuple[str, str]:
try:
language = str(Language.get(dialect))
except Exception as dialectError:
dialect = dialect.split('-')[0]
language = str(Language.get(dialect))
region = dialect.split('-')[1] if '-' in dialect else ""
return (language, region)
# Example usage
langcode, region = getISOLangCode("en-US")
print(langcode) # Output: 'en'
print(region) # Output: 'US' |
Owner
|
I need to review this but @acerjay can you just dump a output of get_voices when you get a mo to see the difference. My only concern is we are adding another non-optional depdenency and its a big one - of langcodes. So being cautious on this one! |
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.
Unified language code support for most of the TTS engines. #9
Can be modified to convert into alpha code (three character string)