New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding languages other than English to the text to speech block in app lab and game lab #35077
Conversation
I was curious what the experiment flag was, so I went and looked it up. Here it is in case anyone else is curious: |
@@ -32,6 +33,19 @@ const dropletConfig = { | |||
0: () => getAssetDropdown('audio') | |||
}, | |||
assetTooltip: {0: chooseAsset.bind(null, 'audio')} | |||
}, | |||
playSpeech: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to hide this block behind an experiment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's behind an experiment in applab and gamelab and it needs to be added to a lab's specific dropletConfig to show up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
@@ -32,6 +32,10 @@ def self.table | |||
table.select(:unique_language_s, :locale_s).where("locale_s = '#{locale}'").first[:unique_language_s] | |||
end | |||
|
|||
cached def self.get_native_name_by_locale(locale) | |||
table.select(:native_name_s, :locale_s).where("locale_s = '#{locale}'").to_a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this method error if we pass in an invalid locale
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, it just returns empty.
p 'hello world' | ||
p Languages.get_native_name_by_locale('fake language') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: remove stray logging (but thank you for testing this! 😄 )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
really great work, jillian! left a last comment about a stray logging statement, but after that's fixed, this is good to merge 🎉
This adds support for languages other than English for the text to speech block. The languages that are offered are the intersection of languages that have both male and female voices offered by Azure and are supported by Code.org. The default is still the female English (US) voice.
Here's the full list: 2 dialects of English (US and UK), 2 dialects of Spanish (Latin America and Spain), French, German, Hindi, Italian, Japanese, Portuguese, Russian, and 2 dialects of Chinese (Simplified and Traditional).
This is currently behind the experiment text-to-speech-block, see here
Future work
In the future, we will add profanity filtering and a character limit for the block.
Links
Testing story
I think the tests in the earlier PR are sufficient but let me know if there's something else we should be testing.
Reviewer Checklist: