You're previewing the student experience. You don't need to complete this lesson — your progress and XP aren't saved.
Scratch Language
Beginner
60 mins
Teacher/Student led
+215 XP
What you need:
Chromebook/Laptop/PC or iPad/Tablet

Translate

In this engaging lesson, you'll learn to build a language translator using Scratch. Follow step-by-step instructions to translate text into various languages and make a sprite speak the translations aloud. Start coding and explore new languages today!

Teacher Class Feed

Load previous activity

    1 - Introduction

    Welcome to our exciting lesson on translating languages! In this lesson, you will learn how to use Scratch to translate text into different languages and make a sprite speak the translation out loud. This is a fun way to learn about different languages and how to use coding to create a mini language translator. Let's get started!


    2 - Create a new project

    Go to the Scratch website and create a new project, you can delete the cat sprite.

    https://scratch.mit.edu/


    3 - Add the Translate extension

    Now, we are going to add a special tool to our project called the Translate extension.

    This extension will help us translate words or sentences from one language to another. It's like having a mini language translator in our project! To add this, look for the button that says 'Extensions' at the bottom left corner of your Scratch screen and click on it. Then, find the 'Translate' extension and click on it to add it to your project.


    4 - Add the Text to Speech extension

    Now, let's add another cool tool to our project, the Text to Speech extension.

    This extension will allow our sprite to speak out loud the translations we make! It's like giving a voice to our sprite. To add this, look for the button that says 'Extensions' at the bottom left corner of your Scratch screen and click on it. Then, find the 'Text to Speech' extension and click on it to add it to your project.


    5 - Add the Kai sprite

    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)

    Once you've added the code, click on the green flag and Kai should go to the middle of the stage area.



    6 - Create 2 variables

    We need the following 2 variables in our project:

    • language - to store what language we want to translate to.
    • translation - to store the translation of what we wanted to translate.

    Create the 2 variables and then uncheck them in the toolbox so that they do not appear in the stage area.



    7 - Upload the Irish flag as a sprite

    First let's translate to Irish. Download the Irish flag that is included with this step, upload it into your project as a sprite and then add the following code to it.

    when green flag clicked set size to (40) % go to x: (-155) y: (130) // the top left

    Click on the green flag and the Irish flag should appear at the top left of the stage area.



    8 - Translate to Irish

    Next add the following code to set the language variable to be 'Irish' when you click the Irish flag and then broadcast a message called 'do translation'. We will program Kai in the next step to receive this message and do the translation.

    Add the following code to the Irish Flag sprite:

    when this sprite clicked set [language v] to [Irish] broadcast (do translation v)


    9 - Do the translation

    Now add the following code to the Kai sprite to do the translation when he receives the message 'do translation'.

    This code works like this: When Kai gets the message 'do translation', he will ask you 'What would you like to translate?'. After you type in your answer, Kai will use the Translate extension to translate your answer into the language you chose. Then, Kai will say the translated text out loud.

    when I receive [do translation v] ask [what would you like to translate?] and wait set [translation v] to (translate (answer) to (language) :: translate) say (translation)

    Now let's test if this all works by doing the following:
    1. Click on the Irish Flag.
    2. Type something in that you would like to translate and press the enter key.
    3. A speech bubble should appear with the translation.


    10 - Speak the translation

    Now we are going to make Kai speak the translation out loud. So, we are adding two new blocks of code here:

    • set language to (language): This block sets the language that Kai will speak in. We are setting it to the language you chose.
    • speak (translation): This block makes Kai speak the translation out loud. 

    Now add the following new code to the Kai sprite to make him speak the translation out loud.

    when I receive [do translation v] set [translation v] to (translate (answer) to (language) :: translate) say (translation) set language to (language) :: tts stack // add this speak (translation) :: tts stack // add this

    Now test your code again. This time as well as the speech bubble, Kai should say the translation out loud.


    11 - Translate to French

    Now let's translate to French. Download the French flag that is included with this step, upload it into your project as a sprite and then add the following code to it.

    when green flag clicked set size to (30) % go to x: (-30) y: (130) // the top middle

    Next add the following code to set the language variable to be 'French' when you click the French flag and then broadcast a message called 'do translation'. We have already programmed Kai to receive this message and do the translation so it should now work for French also.

    when this sprite clicked set [language v] to [French] broadcast (do translation v)

    Test your new code to see if the French translation works!


    12 - Add more languages

    The following are the languages that you can currently translate to in Scratch. Trying adding some more languages to your project from this list (repeat the previous step but with the correct flag and language).

    • Arabic
    • Chinese (Mandarin)
    • Danish
    • Dutch
    • English
    • French
    • German
    • Hindi
    • Icelandic
    • Italian
    • Japanese
    • Korean
    • Norwegian
    • Polish
    • Portuguese (Brazilian)
    • Portuguese
    • Romanian
    • Russian
    • Spanish
    • Spanish (Latin American)
    • Swedish
    • Turkish
    • Welsh


















    13 - Wrap up

    Great job! You've successfully created a language translator using Scratch. Now you can translate text into different languages and make your sprite speak the translation out loud. This is a fun and interactive way to learn about different languages and how to use coding to create useful tools. Keep practicing and exploring more possibilities with Scratch. Happy coding!

    End of lesson
    123learn · Sample lesson

    That was a sample lesson from Digital Creation Lab

    Every lesson in the course is ready to teach like this one. See what else comes with it, and how to order it.

    Copyright Notice
    This lesson is copyright of Coding Ireland 2017 - 2026. Unauthorised use, copying or distribution is not allowed.

    Scratch is developed by the Lifelong Kindergarten Group at the MIT Media Lab. It is available for free at https://scratch.mit.edu
    🍪 Our website uses cookies to make your browsing experience better. By using our website you agree to our use of cookies. Learn more