Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
e437c64
Update hello-world.md
PPPDUD Oct 16, 2025
05989b4
Update hello-world.js
PPPDUD Oct 16, 2025
33408f0
Merge pull request #1 from PPPDUD/patch-3
PPPDUD Oct 16, 2025
0a833c5
Update hello-world.md
PPPDUD Oct 16, 2025
2e14020
Update async.js
PPPDUD Oct 16, 2025
a070364
Update strict-equality.js
PPPDUD Oct 16, 2025
4b7a75e
Update when-space-key-pressed.js
PPPDUD Oct 16, 2025
7bc38a5
Update when-key-pressed.js
PPPDUD Oct 16, 2025
c58dba4
Update when-key-pressed-restart.js
PPPDUD Oct 16, 2025
d0b6a3f
Update broadcast-5.js
PPPDUD Oct 16, 2025
dcbdec5
Update when.js
PPPDUD Oct 16, 2025
99837f5
Update strings-1.js
PPPDUD Oct 16, 2025
aa56db1
Update strings-2.js
PPPDUD Oct 16, 2025
f6d7f6e
Update hello-world-unsandboxed.js
PPPDUD Oct 16, 2025
ec745b1
Update turbo-mode.js
PPPDUD Oct 16, 2025
58bb838
Update block-utility-examples.js
PPPDUD Oct 16, 2025
d455ca7
Update color.js
PPPDUD Oct 16, 2025
25da082
Update hello-docs.js
PPPDUD Oct 16, 2025
feef543
Update unmonitorable.js
PPPDUD Oct 16, 2025
2de6080
Update cast.js
PPPDUD Oct 16, 2025
09e36cb
Update hidden-1.js
PPPDUD Oct 16, 2025
6a2215b
Update hidden-2.js
PPPDUD Oct 16, 2025
5773ca2
Update filter.js
PPPDUD Oct 16, 2025
9f6bb36
Update icons.js
PPPDUD Oct 16, 2025
b2fa57a
Update inline-images.js
PPPDUD Oct 16, 2025
77ef3a4
Update separators.js
PPPDUD Oct 16, 2025
522b8f7
Update terminal.js
PPPDUD Oct 16, 2025
983a501
Update compatibility.md
PPPDUD Oct 16, 2025
b52449e
Update timer-reimplementation.js
PPPDUD Oct 16, 2025
fddf95a
Update wrapping-up.md
PPPDUD Oct 16, 2025
b17273c
Merge branch 'TurboWarp:master' into patch-2
PPPDUD Oct 17, 2025
f42d826
Update assorted-apis.md
PPPDUD Oct 17, 2025
ff00303
Update wrapping-up.md
PPPDUD Oct 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/development/extensions/assorted-apis.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ While the block's shape will look similar to "stop this script" and "stop all",

<ExtensionCode title="terminal">{require("!raw-loader!@site/static/example-extensions/terminal.js")}</ExtensionCode>

## Translations
Use the `Scratch.translate()` API to translate text for use in block text and extension names. This is NOT the same as the Translate extension from Scratch; `Scratch.translate()` does not use the Internet and exclusively uses man-made translations.

`Scratch.translate()` is not intended for translating user input and will leave most user-generated text untranslated.

If you want to help translate text from your extension, [click here](https://docs.turbowarp.org/translate).

## Next steps

Next, let's see [how to make blocks like "when I receive" or "when timer greater than".](./hats)
4 changes: 2 additions & 2 deletions docs/development/extensions/compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Instead, create a new block and mark the old one as `hideFromPalette: true`. The
{
blockType: Scratch.BlockType.REPORTER,
id: "oldBlock",
text: "old [INPUT1]",
text: Scratch.translate("old [INPUT1]"),
arguments: {
INPUT1: { /* ... */ }
},
Expand All @@ -114,7 +114,7 @@ Instead, create a new block and mark the old one as `hideFromPalette: true`. The
{
blockType: Scratch.BlockType.REPORTER,
opcode: "newBlock",
text: "new [INPUT1] [INPUT2]",
text: Scratch.translate("new [INPUT1] [INPUT2]"),
arguments: {
INPUT1: { /* ... */ },
INPUT2: { /* ... */ }
Expand Down
4 changes: 2 additions & 2 deletions docs/development/extensions/hello-world.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ Make sure to always call register() exactly once. If you don't call it, your ext
getInfo() {
return {
id: 'helloworld',
name: 'It works!',
name: Scratch.translate('It works!'),
blocks: [
{
opcode: 'hello',
blockType: Scratch.BlockType.REPORTER,
text: 'Hello, world!'
text: Scratch.translate('Hello, world!')
}
]
};
Expand Down
8 changes: 4 additions & 4 deletions static/example-extensions/async.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ class AsyncExtension {
getInfo() {
return {
id: 'asyncexample',
name: 'Async Blocks',
name: Scratch.translate('Async Blocks'),
blocks: [
{
opcode: 'wait',
text: 'wait [TIME] seconds',
text: Scratch.translate('wait [TIME] seconds'),
blockType: Scratch.BlockType.COMMAND,
arguments: {
TIME: {
Expand All @@ -17,7 +17,7 @@ class AsyncExtension {
},
{
opcode: 'fetch',
text: 'fetch [URL]',
text: Scratch.translate('fetch [URL]'),
blockType: Scratch.BlockType.REPORTER,
arguments: {
URL: {
Expand Down Expand Up @@ -54,4 +54,4 @@ class AsyncExtension {
}
// highlight-end
}
Scratch.extensions.register(new AsyncExtension());
Scratch.extensions.register(new AsyncExtension());
10 changes: 5 additions & 5 deletions static/example-extensions/cast.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ class CastingExample {
getInfo() {
return {
id: 'castexample',
name: 'Casting Example',
name: Scratch.translate('Casting Example'),
blocks: [
{
opcode: 'toNumber',
blockType: Scratch.BlockType.REPORTER,
text: 'convert [INPUT] to number',
text: Scratch.translate('convert [INPUT] to number'),
arguments: {
INPUT: {
type: Scratch.ArgumentType.STRING,
Expand All @@ -20,7 +20,7 @@ class CastingExample {
// treatment in JS, it seems a bit dangerous to use
opcode: 'castToString',
blockType: Scratch.BlockType.REPORTER,
text: 'convert [INPUT] to string',
text: Scratch.translate('convert [INPUT] to string'),
arguments: {
INPUT: {
type: Scratch.ArgumentType.STRING,
Expand All @@ -31,7 +31,7 @@ class CastingExample {
{
opcode: 'toBoolean',
blockType: Scratch.BlockType.BOOLEAN,
text: 'convert [INPUT] to boolean',
text: Scratch.translate('convert [INPUT] to boolean'),
arguments: {
INPUT: {
type: Scratch.ArgumentType.STRING,
Expand All @@ -42,7 +42,7 @@ class CastingExample {
{
opcode: 'compare',
blockType: Scratch.BlockType.REPORTER,
text: 'compare [A] to [B]',
text: Scratch.translate('compare [A] to [B]'),
arguments: {
A: {
type: Scratch.ArgumentType.STRING,
Expand Down
2 changes: 1 addition & 1 deletion static/example-extensions/color.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ColorExample {
{
opcode: 'reporter',
blockType: Scratch.BlockType.REPORTER,
text: 'string [STRING] boolean [BOOLEAN] menu [MENU] field [FIELD]',
text: Scratch.translate('string [STRING] boolean [BOOLEAN] menu [MENU] field [FIELD]'),
arguments: {
STRING: {
type: Scratch.ArgumentType.STRING,
Expand Down
10 changes: 5 additions & 5 deletions static/example-extensions/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,31 @@ class FilterExample {
getInfo() {
return {
id: 'filterexample',
name: 'Filter Example',
name: Scratch.translate('Filter Example'),
blocks: [
{
opcode: 'all',
blockType: Scratch.BlockType.COMMAND,
text: 'available in ALL targets',
text: Scratch.translate('available in ALL targets'),
},
{
opcode: 'sprites',
blockType: Scratch.BlockType.COMMAND,
text: 'available in ONLY sprites',
text: Scratch.translate('available in ONLY sprites'),
// highlight-next-line
filter: [Scratch.TargetType.SPRITE]
},
{
opcode: 'stage',
blockType: Scratch.BlockType.COMMAND,
text: 'available in ONLY the stage',
text: Scratch.translate('available in ONLY the stage'),
// highlight-next-line
filter: [Scratch.TargetType.STAGE]
},
{
opcode: 'none',
blockType: Scratch.BlockType.COMMAND,
text: 'available in NEITHER sprites or the stage',
text: Scratch.translate('available in NEITHER sprites or the stage'),
// highlight-start
// NOTE: Use hideFromPalette instead of filter: []
filter: []
Expand Down
4 changes: 2 additions & 2 deletions static/example-extensions/hello-docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ class HelloDocs {
getInfo() {
return {
id: 'hellodocs',
name: 'Hello Docs!',
name: Scratch.translate('Hello Docs!'),
// highlight-next-line
docsURI: 'https://docs.turbowarp.org/development/extensions/docsURI-demo',
blocks: [
{
opcode: 'hello',
blockType: Scratch.BlockType.REPORTER,
text: 'Hello!'
text: Scratch.translate('Hello!')
}
]
};
Expand Down
4 changes: 2 additions & 2 deletions static/example-extensions/hello-world.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ class HelloWorld {
getInfo() {
return {
id: 'helloworld',
name: 'It works!',
name: Scratch.translate('It works!'),
blocks: [
{
opcode: 'hello',
blockType: Scratch.BlockType.REPORTER,
text: 'Hello!'
text: Scratch.translate('Hello!')
}
]
};
Expand Down
4 changes: 2 additions & 2 deletions static/example-extensions/hidden-1.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ class HideFromPaletteExample {
getInfo() {
return {
id: 'hidefrompaletteexample',
name: 'hideFromPalette Example',
name: Scratch.translate('hideFromPalette Example'),
blocks: [
{
opcode: 'hidden',
blockType: Scratch.BlockType.REPORTER,
text: 'example block (visible)'
text: Scratch.translate('example block (visible)')
},
]
};
Expand Down
4 changes: 2 additions & 2 deletions static/example-extensions/hidden-2.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ class HideFromPaletteExample {
getInfo() {
return {
id: 'hidefrompaletteexample',
name: 'hideFromPalette Example',
name: Scratch.translate('hideFromPalette Example'),
blocks: [
{
opcode: 'hidden',
blockType: Scratch.BlockType.REPORTER,
text: 'example block (hidden)',
text: Scratch.translate('example block (hidden)'),
hideFromPalette: true
},
]
Expand Down
6 changes: 3 additions & 3 deletions static/example-extensions/icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class IconsExample {
getInfo() {
return {
id: 'iconsexample',
name: 'Icons Example',
name: Scratch.translate('Icons Example'),
// highlight-start
menuIconURI: blocksIcon,
blockIconURI: dangoIcon,
Expand All @@ -20,7 +20,7 @@ class IconsExample {
{
opcode: 'defaultIcon',
blockType: Scratch.BlockType.REPORTER,
text: 'reporter with default icon [INPUT]',
text: Scratch.translate('reporter with default icon [INPUT]'),
arguments: {
INPUT: {
type: Scratch.ArgumentType.STRING,
Expand All @@ -31,7 +31,7 @@ class IconsExample {
{
opcode: 'overriddenIcon',
blockType: Scratch.BlockType.COMMAND,
text: 'command with overridden icon [INPUT]',
text: Scratch.translate('command with overridden icon [INPUT]'),
// highlight-next-line
blockIconURI: colorIcon,
arguments: {
Expand Down
6 changes: 3 additions & 3 deletions static/example-extensions/inline-images.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ class InlineImagesExample {
getInfo() {
return {
id: 'inlineimagesexample',
name: 'Inline Images Example',
name: Scratch.translate('Inline Images Example'),
blocks: [
{
opcode: 'reporter',
blockType: Scratch.BlockType.REPORTER,
// highlight-start
text: 'some text [IMAGE] more text',
text: Scratch.translate('some text [IMAGE] more text'),
arguments: {
IMAGE: {
type: Scratch.ArgumentType.IMAGE,
Expand All @@ -28,7 +28,7 @@ class InlineImagesExample {
blockType: Scratch.BlockType.COMMAND,
blockIconURI: colorIcon,
// highlight-start
text: 'some text [IMAGE] more text',
text: Scratch.translate('some text [IMAGE] more text'),
arguments: {
IMAGE: {
type: Scratch.ArgumentType.IMAGE,
Expand Down
10 changes: 5 additions & 5 deletions static/example-extensions/separators.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,31 @@ class SeparatorExample {
getInfo() {
return {
id: 'separatorexample',
name: 'Separator Example',
name: Scratch.translate('Separator Example'),
blocks: [
{
opcode: 'block1',
blockType: Scratch.BlockType.COMMAND,
text: 'group 1'
text: Scratch.translate('group 1')
},
{
opcode: 'block2',
blockType: Scratch.BlockType.COMMAND,
text: 'also group 1',
text: Scratch.translate('also group 1'),
},
// highlight-next-line
'---',
{
opcode: 'block3',
blockType: Scratch.BlockType.COMMAND,
text: 'group 2'
text: Scratch.translate('group 2')
},
// highlight-next-line
'---',
{
opcode: 'block4',
blockType: Scratch.BlockType.COMMAND,
text: 'group 3',
text: Scratch.translate('group 3'),
},
]
};
Expand Down
4 changes: 2 additions & 2 deletions static/example-extensions/strict-equality.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ class StrictEqualityExtension {
getInfo() {
return {
id: 'strictequalityexample',
name: 'Strict Equality',
name: Scratch.translate('Strict Equality'),
blocks: [
// highlight-start
{
opcode: 'strictlyEquals',
blockType: Scratch.BlockType.BOOLEAN,
text: '[ONE] strictly equals [TWO]',
text: Scratch.translate('[ONE] strictly equals [TWO]'),
arguments: {
ONE: {
type: Scratch.ArgumentType.STRING
Expand Down
4 changes: 2 additions & 2 deletions static/example-extensions/strings-1.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ class Strings1 {
getInfo() {
return {
id: 'strings1example',
name: 'Encoding',
name: Scratch.translate('Encoding'),
blocks: [
{
opcode: 'convert',
blockType: Scratch.BlockType.REPORTER,
text: 'convert [TEXT] to [FORMAT]',
text: Scratch.translate('convert [TEXT] to [FORMAT]'),
arguments: {
TEXT: {
type: Scratch.ArgumentType.STRING,
Expand Down
4 changes: 2 additions & 2 deletions static/example-extensions/strings-2.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ class Strings2 {
getInfo() {
return {
id: 'strings2example',
name: 'Encoding',
name: Scratch.translate('Encoding'),
blocks: [
{
opcode: 'convert',
blockType: Scratch.BlockType.REPORTER,
text: 'convert [TEXT] to [FORMAT]',
text: Scratch.translate('convert [TEXT] to [FORMAT]'),
arguments: {
TEXT: {
type: Scratch.ArgumentType.STRING,
Expand Down
4 changes: 2 additions & 2 deletions static/example-extensions/terminal.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ class TerminalExample {
getInfo() {
return {
id: 'terminalexample',
name: 'Terminal Example',
name: Scratch.translate('Terminal Example'),
blocks: [
{
opcode: 'terminalBlock',
blockType: Scratch.BlockType.COMMAND,
// highlight-next-line
isTerminal: true,
text: 'you can not connect another block under this one!'
text: Scratch.translate('you can not connect another block under this one!')
}
]
};
Expand Down
Loading