Open rbozan opened 5 months ago
Thanks,
Two letter language codes are used throughout all synthesis and recognition operations, I believe.
The error message makes it look like the language isn't supported. I should change it to also test if the language format is supported first, though maybe adding support for the three letter codes immediately could be a more thorough solution.
Currently, the error message itself actually does correctly parse spa
as Spanish, because of this method:
export function languageCodeToName(languageCode: string) {
const languageNames = new Intl.DisplayNames(['en'], { type: 'language' })
let translatedLanguageName: string | undefined
try {
translatedLanguageName = languageNames.of(languageCode)
} catch (e) {
}
return translatedLanguageName || 'Unknown'
}
This translation make it look like it understands what the language is, but it's currently only used for the error message itself.
Also, adding support for full language names like french
has also been on my task list for a while.
I'll need to find some way to normalize all language codes or names to the two letter ISO 639-1 ones, and their extensions, like pt-br
.
There's a small issue regarding the error message when supplying ISO 639-2 codes to
Echogarden.recognize
as such:This returns
While supplying 'es' works fine
So I have to supply ISO 639-1 language codes, not ISO 639-2. But the message indicates that Spanish is not supported at all.