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 a connection to the Internet, because it uses the Google Translate API to do so.
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 generally not output the word. Some Scratchers have used this as a alternative to a whitelist of allowed phrases for cloud chat projects[1], however it is not allowed[citation needed] as users can still send phrases that break the Community Guidelines by adding extra characters to bypass the translator's filter.