| Translate () to () | |
translate [] to ( v) | |
| Category | Translate |
| Type | Reporter |
| Introduced in | 3.0 |
The Translate () to () block is a Translate Extension block and a reporter block in Scratch 3.0. This block translates a string from the automatically detected language to the chosen language using Google Translate. There are currently 48 languages available via the dropdown provided, but an additional 18 are also available by substituting in a reporter block for the language (for example: (translate () to (join [Albanian][]))).
This block requires an internet connection because it uses the Google Translate API to provide translations.
Uses
- To translate something to another language
when gf clicked say (translate [Hello] to (Dutch v))
- To translate something to the user's Scratch editor language
when gf clicked say (translate [Hello] to (language))
- To create a game that allows several languages in it
when green flag clicked ask [What language should "hello" be translated to?] and wait set [Chosen Language v] to (answer) if <(Chosen Language) = [English]> then say [Hello] for (2) seconds end if <(Chosen Language) = [Dutch]> then say (translate [Hello] to (Dutch v)) for (2) seconds end if <(Chosen Language) = [German]> then say (translate [Hello] to (German v)) for (2) seconds end
- To speak something in a different language
when gf clicked set language to (chosen language) speak (translate [Hello] to (chosen language))
Bad Word Detection
When a user inserts an inappropriate word into the string input and clicks the translate block, the block will not provide a translation, and will instead report an empty string. Some Scratchers have used this as a whitelist for cloud chat projects,[1] but this is not allowed.[2]
References
- ↑ topic:433885
- ↑ dietbacon. (2019-07-11). "We’ve had a lot of discussions about these projects and we’ve concluded that they just aren’t able to work in a way that is safe and appropriate for Scratch. Going forward, we will no longer allow projects that include cloud-based chat functionality on Scratch." post:3622655