Skip to content

Commit

Permalink
Add translations to NFCWarp, Asset Manager, Cast, JSON (#1329)
Browse files Browse the repository at this point in the history
  • Loading branch information
qxsck authored May 10, 2024
1 parent 02578ec commit 8970083
Show file tree
Hide file tree
Showing 4 changed files with 147 additions and 68 deletions.
2 changes: 1 addition & 1 deletion extensions/Alestore/nfcwarp.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

nfcRead() {
if (!this.supported()) {
return "NFC not supported";
return Scratch.translate("NFC not supported");
}
return new Promise((resolve, reject) => {
const ndef = new NDEFReader();
Expand Down
75 changes: 50 additions & 25 deletions extensions/Lily/Assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
color1: "#5779ca",
color2: "#4e6db6",
color3: "#4661a2",
name: "Asset Manager",
name: Scratch.translate("Asset Manager"),
blocks: [
{
opcode: "addSprite",
blockType: Scratch.BlockType.COMMAND,
text: "add sprite from URL [URL]",
text: Scratch.translate("add sprite from URL [URL]"),
arguments: {
URL: {
type: Scratch.ArgumentType.STRING,
Expand All @@ -44,7 +44,7 @@
{
opcode: "addCostume",
blockType: Scratch.BlockType.COMMAND,
text: "add costume from URL [URL] named [NAME]",
text: Scratch.translate("add costume from URL [URL] named [NAME]"),
arguments: {
URL: {
type: Scratch.ArgumentType.STRING,
Expand All @@ -58,7 +58,7 @@
{
opcode: "addSound",
blockType: Scratch.BlockType.COMMAND,
text: "add sound from URL [URL] named [NAME]",
text: Scratch.translate("add sound from URL [URL] named [NAME]"),
arguments: {
URL: {
type: Scratch.ArgumentType.STRING,
Expand All @@ -73,7 +73,7 @@
{
opcode: "renameSprite",
blockType: Scratch.BlockType.COMMAND,
text: "rename sprite [TARGET] to [NAME]",
text: Scratch.translate("rename sprite [TARGET] to [NAME]"),
arguments: {
TARGET: {
type: Scratch.ArgumentType.STRING,
Expand All @@ -88,7 +88,7 @@
{
opcode: "renameCostume",
blockType: Scratch.BlockType.COMMAND,
text: "rename costume [COSTUME] to [NAME]",
text: Scratch.translate("rename costume [COSTUME] to [NAME]"),
arguments: {
COSTUME: {
type: Scratch.ArgumentType.COSTUME,
Expand All @@ -102,7 +102,7 @@
{
opcode: "renameSound",
blockType: Scratch.BlockType.COMMAND,
text: "rename sound [SOUND] to [NAME]",
text: Scratch.translate("rename sound [SOUND] to [NAME]"),
arguments: {
SOUND: {
type: Scratch.ArgumentType.SOUND,
Expand All @@ -117,7 +117,7 @@
{
opcode: "deleteSprite",
blockType: Scratch.BlockType.COMMAND,
text: "delete sprite [TARGET]",
text: Scratch.translate("delete sprite [TARGET]"),
arguments: {
TARGET: {
type: Scratch.ArgumentType.STRING,
Expand All @@ -132,7 +132,7 @@
{
opcode: "deleteCostume",
blockType: Scratch.BlockType.COMMAND,
text: "delete costume [COSTUME]",
text: Scratch.translate("delete costume [COSTUME]"),
arguments: {
COSTUME: {
type: Scratch.ArgumentType.COSTUME,
Expand All @@ -146,7 +146,7 @@
{
opcode: "deleteSound",
blockType: Scratch.BlockType.COMMAND,
text: "delete sound [SOUND]",
text: Scratch.translate("delete sound [SOUND]"),
arguments: {
SOUND: {
type: Scratch.ArgumentType.SOUND,
Expand All @@ -161,28 +161,30 @@
{
opcode: "getAllSprites",
blockType: Scratch.BlockType.REPORTER,
text: "all sprites",
text: Scratch.translate("all sprites"),
},
{
opcode: "getAllCostumes",
blockType: Scratch.BlockType.REPORTER,
text: "all costumes",
text: Scratch.translate("all costumes"),
},
{
opcode: "getAllSounds",
blockType: Scratch.BlockType.REPORTER,
text: "all sounds",
text: Scratch.translate("all sounds"),
},
{
opcode: "getSpriteName",
blockType: Scratch.BlockType.REPORTER,
text: "sprite name",
text: Scratch.translate("sprite name"),
},
"---",
{
opcode: "reorderCostume",
blockType: Scratch.BlockType.COMMAND,
text: "reorder costume # [INDEX1] to index [INDEX2]",
text: Scratch.translate(
"reorder costume # [INDEX1] to index [INDEX2]"
),
arguments: {
INDEX1: {
type: Scratch.ArgumentType.NUMBER,
Expand All @@ -197,7 +199,9 @@
{
opcode: "reorderSound",
blockType: Scratch.BlockType.COMMAND,
text: "reorder sound # [INDEX1] to index [INDEX2]",
text: Scratch.translate(
"reorder sound # [INDEX1] to index [INDEX2]"
),
arguments: {
INDEX1: {
type: Scratch.ArgumentType.NUMBER,
Expand All @@ -213,7 +217,7 @@
{
opcode: "getSoundData",
blockType: Scratch.BlockType.REPORTER,
text: "[ATTRIBUTE] of [SOUND]",
text: Scratch.translate("[ATTRIBUTE] of [SOUND]"),
arguments: {
ATTRIBUTE: {
type: Scratch.ArgumentType.STRING,
Expand All @@ -227,7 +231,7 @@
{
opcode: "getCostumeData",
blockType: Scratch.BlockType.REPORTER,
text: "[ATTRIBUTE] of [COSTUME]",
text: Scratch.translate("[ATTRIBUTE] of [COSTUME]"),
arguments: {
ATTRIBUTE: {
type: Scratch.ArgumentType.STRING,
Expand All @@ -242,7 +246,7 @@
{
opcode: "getCostumeAtIndex",
blockType: Scratch.BlockType.REPORTER,
text: "name of costume # [INDEX]",
text: Scratch.translate("name of costume # [INDEX]"),
arguments: {
INDEX: {
type: Scratch.ArgumentType.NUMBER,
Expand All @@ -253,7 +257,7 @@
{
opcode: "getSoundAtIndex",
blockType: Scratch.BlockType.REPORTER,
text: "name of sound # [INDEX]",
text: Scratch.translate("name of sound # [INDEX]"),
arguments: {
INDEX: {
type: Scratch.ArgumentType.NUMBER,
Expand All @@ -265,7 +269,7 @@
{
opcode: "openProject",
blockType: Scratch.BlockType.COMMAND,
text: "open project from URL [URL]",
text: Scratch.translate("open project from URL [URL]"),
arguments: {
URL: {
type: Scratch.ArgumentType.STRING,
Expand All @@ -275,13 +279,13 @@
{
opcode: "getProjectJSON",
blockType: Scratch.BlockType.REPORTER,
text: "project JSON",
text: Scratch.translate("project JSON"),
},
"---",
{
opcode: "loadExtension",
blockType: Scratch.BlockType.COMMAND,
text: "load extension from URL [URL]",
text: Scratch.translate("load extension from URL [URL]"),
arguments: {
URL: {
type: Scratch.ArgumentType.STRING,
Expand All @@ -293,7 +297,7 @@
{
opcode: "getLoadedExtensions",
blockType: Scratch.BlockType.REPORTER,
text: "loaded extensions",
text: Scratch.translate("loaded extensions"),
},
],
menus: {
Expand All @@ -303,7 +307,28 @@
},
attribute: {
acceptReporters: false,
items: ["index", "dataURI", "format", "header", "asset ID"],
items: [
{
text: Scratch.translate("index"),
value: "index",
},
{
text: Scratch.translate("dataURI"),
value: "dataURI",
},
{
text: Scratch.translate("format"),
value: "format",
},
{
text: Scratch.translate("header"),
value: "header",
},
{
text: Scratch.translate("asset ID"),
value: "asset ID",
},
],
},
},
};
Expand Down
23 changes: 20 additions & 3 deletions extensions/Lily/Cast.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
{
opcode: "toType",
blockType: Scratch.BlockType.REPORTER,
text: "cast [INPUT] to [TYPE]",
text: Scratch.translate("cast [INPUT] to [TYPE]"),
allowDropAnywhere: true,
disableMonitor: true,
arguments: {
Expand All @@ -35,7 +35,7 @@
{
opcode: "typeOf",
blockType: Scratch.BlockType.REPORTER,
text: "type of [INPUT]",
text: Scratch.translate("type of [INPUT]"),
disableMonitor: true,
arguments: {
INPUT: {
Expand All @@ -48,7 +48,24 @@
menus: {
type: {
acceptReporters: true,
items: ["number", "string", "boolean", "default"],
items: [
{
text: Scratch.translate("number"),
value: "number",
},
{
text: Scratch.translate("string"),
value: "string",
},
{
text: Scratch.translate("boolean"),
value: "boolean",
},
{
text: Scratch.translate("default"),
value: "default",
},
],
},
},
};
Expand Down
Loading

0 comments on commit 8970083

Please sign in to comment.