Learn how to translate text to different languages in Scratch and have a sprite speak the translation out loud.
We will be coding a project to allow us to translate from English to another language.
Go to the Scratch website and create a new project, you can delete the cat sprite.
https://scratch.mit.edu/projects/
Go to the Scratch website using the link below and click on the 'Create' link in the blue bar at the top.
By default, each new project starts with the cat sprite already added. To delete the cat click on the x in the blue circle beside the cat in the sprite list.
Add the Translate extension to your project.
Scratch Extensions make it possible to connect Scratch projects with external hardware (such as LEGO WeDo or micro:bit), sources of information on the web (such as Google Translate and Amazon Text to Speech), or blocks allowing for more advanced functionality.
When an extension is enabled, its blocks appear in a location with the same name as the extension.
To load an extension, click the icon in the bottom-left hand corner of the screen and select an extension.
Add the Text to Speech extension to your project.
Scratch Extensions make it possible to connect Scratch projects with external hardware (such as LEGO WeDo or micro:bit), sources of information on the web (such as Google Translate and Amazon Text to Speech), or blocks allowing for more advanced functionality.
When an extension is enabled, its blocks appear in a location with the same name as the extension.
To load an extension, click the icon in the bottom-left hand corner of the screen and select an extension.
Add the Kai sprite from the library. We will use this sprite to ask what you want to translate and to say the answer.
Add the following code to the Kai sprite to position him in the centre.
when green flag clicked
go to x: (0) y: (0)
To add a sprite from the sprite library follow these steps:
You can use search box or the filter links (Animals, People, Fantasy etc) to locate your sprite.
We need the following 2 variables in our project:
Create the 2 variables.
In the Variables palette, create a new variable by clicking the 'Make a Variable' button.
Once you click this button a box will appear asking what you want to call your variable. Give it a name that reminds you what you will be using it for. For example, if you wanted to keep track of your score in a game, you would create a variable called 'score'.