Web requests in vanilla Scratch 3.0
- Create a certificate. Name it
server.crtwith the key file namedserver.key. - Install the
requirements.txtdependencies - Simply add
127.0.0.1 translate-service.scratch.mit.eduto your hosts file (on windows -untested on linuxLinux works too - untested on macOS) - Run
server.py - Add a security exception for
translate-service.scratch.mit.eduin your browser; the certificate is self-signed, and therefore, insecure
When the translate feature is used in Scratch, It sends an HTTP GET request to translate-service.scratch.mit.edu.

Route the translate-service.scratch.mit.edu to localhost in the Hosts File.

Create a custom script to interpret the text and language to make a web request.

- Import the
translateextension to the project. - Translate text in the following format:
https://example.com|body
^^ ^^
URL Body
If applicable;
Don't include
if not used
- To one of these languages:
| Language | Method | Uses Body? |
|---|---|---|
| Amharic | GET | No |
| Arabic | POST | Yes |
| Azerbaijani | PUT | Yes |
| Basque | DELETE | No |
| Bulgarian | PATCH | Yes |
| Catalan | OPTIONS | No |
- The response will be in this format:
status|filetype|body
^^ ^^ ^^
Status Filetype Body
code h = Html (text/html)
c = Css (text/css)
t = plainText (text/plain)
i = Image (base64 encoded) (image/*)
d = Data (lowercase hex encoded) (*/*)
n = Network header (application/http)
j = Json (application/json)
x = Xml (*/xml)
- Translate text in the following format:
wss://example.com|data
^^ ^^
URL Data to send
- Language is irrelevant.
- The response will be in this format:
response
^^
Server response