diff --git a/extensions/Alestore/nfcwarp.js b/extensions/Alestore/nfcwarp.js index 7b25b877e0..4e559e538a 100644 --- a/extensions/Alestore/nfcwarp.js +++ b/extensions/Alestore/nfcwarp.js @@ -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(); diff --git a/extensions/Lily/Assets.js b/extensions/Lily/Assets.js index 7d2100a5b4..ef96fc1563 100644 --- a/extensions/Lily/Assets.js +++ b/extensions/Lily/Assets.js @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, @@ -293,7 +297,7 @@ { opcode: "getLoadedExtensions", blockType: Scratch.BlockType.REPORTER, - text: "loaded extensions", + text: Scratch.translate("loaded extensions"), }, ], menus: { @@ -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", + }, + ], }, }, }; diff --git a/extensions/Lily/Cast.js b/extensions/Lily/Cast.js index f77bb7341d..2af25c9add 100644 --- a/extensions/Lily/Cast.js +++ b/extensions/Lily/Cast.js @@ -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: { @@ -35,7 +35,7 @@ { opcode: "typeOf", blockType: Scratch.BlockType.REPORTER, - text: "type of [INPUT]", + text: Scratch.translate("type of [INPUT]"), disableMonitor: true, arguments: { INPUT: { @@ -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", + }, + ], }, }, }; diff --git a/extensions/Skyhigh173/json.js b/extensions/Skyhigh173/json.js index 94eb2d9e0b..c529ea3fa5 100644 --- a/extensions/Skyhigh173/json.js +++ b/extensions/Skyhigh173/json.js @@ -27,11 +27,11 @@ name: "JSON", color1: "#3271D0", blocks: [ - makeLabel("General Utils"), + makeLabel(Scratch.translate("General Utils")), { opcode: "json_is_valid", blockType: Scratch.BlockType.BOOLEAN, - text: "is JSON [json] valid?", + text: Scratch.translate("is JSON [json] valid?"), arguments: { json: { type: Scratch.ArgumentType.STRING, @@ -42,7 +42,7 @@ { opcode: "json_is", blockType: Scratch.BlockType.BOOLEAN, - text: "is [json] [types]?", + text: Scratch.translate("is [json] [types]?"), arguments: { json: { type: Scratch.ArgumentType.STRING, @@ -59,7 +59,7 @@ { opcode: "json_get_all", blockType: Scratch.BlockType.REPORTER, - text: "all [Stype] of [json]", + text: Scratch.translate("all [Stype] of [json]"), arguments: { Stype: { type: Scratch.ArgumentType.STRING, @@ -74,7 +74,7 @@ { opcode: "json_new", blockType: Scratch.BlockType.REPORTER, - text: "new [json]", + text: Scratch.translate("new [json]"), arguments: { json: { type: Scratch.ArgumentType.STRING, @@ -87,7 +87,7 @@ { opcode: "json_has_key", blockType: Scratch.BlockType.BOOLEAN, - text: "[json] contains key [key]?", + text: Scratch.translate("[json] contains key [key]?"), arguments: { key: { type: Scratch.ArgumentType.STRING, @@ -102,7 +102,7 @@ { opcode: "json_has_value", blockType: Scratch.BlockType.BOOLEAN, - text: "[json] contains value [value]?", + text: Scratch.translate("[json] contains value [value]?"), arguments: { value: { type: Scratch.ArgumentType.STRING, @@ -117,7 +117,7 @@ { opcode: "json_equal", blockType: Scratch.BlockType.BOOLEAN, - text: "[json1] [equal] [json2]", + text: Scratch.translate("[json1] [equal] [json2]"), arguments: { json1: { type: Scratch.ArgumentType.STRING, @@ -138,7 +138,7 @@ { opcode: "json_jlength", blockType: Scratch.BlockType.REPORTER, - text: "length of json [json]", + text: Scratch.translate("length of json [json]"), arguments: { json: { type: Scratch.ArgumentType.STRING, @@ -149,7 +149,7 @@ { opcode: "json_get", blockType: Scratch.BlockType.REPORTER, - text: "value of [item] in [json]", + text: Scratch.translate("value of [item] in [json]"), arguments: { item: { type: Scratch.ArgumentType.STRING, @@ -164,7 +164,7 @@ { opcode: "json_set", blockType: Scratch.BlockType.REPORTER, - text: "set [item] in [json] to [value]", + text: Scratch.translate("set [item] in [json] to [value]"), arguments: { item: { type: Scratch.ArgumentType.STRING, @@ -183,7 +183,7 @@ { opcode: "json_delete", blockType: Scratch.BlockType.REPORTER, - text: "delete [item] in [json]", + text: Scratch.translate("delete [item] in [json]"), arguments: { item: { type: Scratch.ArgumentType.STRING, @@ -195,11 +195,11 @@ }, }, }, - makeLabel("Array"), + makeLabel(Scratch.translate("Array")), { opcode: "json_length", blockType: Scratch.BlockType.REPORTER, - text: "length of array [json]", + text: Scratch.translate("length of array [json]"), arguments: { json: { type: Scratch.ArgumentType.STRING, @@ -210,7 +210,7 @@ { opcode: "json_array_get", blockType: Scratch.BlockType.REPORTER, - text: "item [item] of array [json]", + text: Scratch.translate("item [item] of array [json]"), arguments: { item: { type: Scratch.ArgumentType.NUMBER, @@ -225,7 +225,7 @@ { opcode: "json_array_push", blockType: Scratch.BlockType.REPORTER, - text: "add [item] to array [json]", + text: Scratch.translate("add [item] to array [json]"), arguments: { item: { type: Scratch.ArgumentType.STRING, @@ -240,7 +240,7 @@ { opcode: "json_array_set", blockType: Scratch.BlockType.REPORTER, - text: "replace item [pos] of [json] with [item]", + text: Scratch.translate("replace item [pos] of [json] with [item]"), arguments: { item: { type: Scratch.ArgumentType.STRING, @@ -259,7 +259,7 @@ { opcode: "json_array_insert", blockType: Scratch.BlockType.REPORTER, - text: "insert [item] at [pos] of array [json]", + text: Scratch.translate("insert [item] at [pos] of array [json]"), arguments: { item: { type: Scratch.ArgumentType.STRING, @@ -279,7 +279,7 @@ { opcode: "json_array_delete", blockType: Scratch.BlockType.REPORTER, - text: "delete item [item] of array [json]", + text: Scratch.translate("delete item [item] of array [json]"), arguments: { item: { type: Scratch.ArgumentType.NUMBER, @@ -294,7 +294,7 @@ { opcode: "json_array_remove_all", blockType: Scratch.BlockType.REPORTER, - text: "delete all [item] in array [json]", + text: Scratch.translate("delete all [item] in array [json]"), arguments: { item: { type: Scratch.ArgumentType.STRING, @@ -310,7 +310,7 @@ { opcode: "json_array_itemH", blockType: Scratch.BlockType.REPORTER, - text: "item # of [item] in array [json]", + text: Scratch.translate("item # of [item] in array [json]"), arguments: { item: { type: Scratch.ArgumentType.STRING, @@ -322,11 +322,11 @@ }, }, }, - makeLabel("Advanced"), + makeLabel(Scratch.translate("Advanced")), { opcode: "json_array_from", blockType: Scratch.BlockType.REPORTER, - text: "array from text [json]", + text: Scratch.translate("array from text [json]"), arguments: { json: { type: Scratch.ArgumentType.STRING, @@ -337,7 +337,7 @@ { opcode: "json_array_fromto", blockType: Scratch.BlockType.REPORTER, - text: "items [item] to [item2] of array [json]", + text: Scratch.translate("items [item] to [item2] of array [json]"), arguments: { json: { type: Scratch.ArgumentType.STRING, @@ -356,7 +356,7 @@ { opcode: "json_array_reverse", blockType: Scratch.BlockType.REPORTER, - text: "reverse array [json]", + text: Scratch.translate("reverse array [json]"), arguments: { json: { type: Scratch.ArgumentType.STRING, @@ -367,7 +367,7 @@ { opcode: "json_array_flat", blockType: Scratch.BlockType.REPORTER, - text: "flat array [json] by depth [depth]", + text: Scratch.translate("flat array [json] by depth [depth]"), arguments: { json: { type: Scratch.ArgumentType.STRING, @@ -382,7 +382,7 @@ { opcode: "json_array_concat", blockType: Scratch.BlockType.REPORTER, - text: "array concat [json] [json2]", + text: Scratch.translate("array concat [json] [json2]"), arguments: { json: { type: Scratch.ArgumentType.STRING, @@ -397,7 +397,9 @@ { opcode: "json_array_filter", blockType: Scratch.BlockType.REPORTER, - text: "get all values with key [key] in array [json]", + text: Scratch.translate( + "get all values with key [key] in array [json]" + ), arguments: { key: { type: Scratch.ArgumentType.STRING, @@ -412,7 +414,7 @@ { opcode: "json_array_setlen", blockType: Scratch.BlockType.REPORTER, - text: "set length of array [json] to [len]", + text: Scratch.translate("set length of array [json] to [len]"), arguments: { json: { type: Scratch.ArgumentType.STRING, @@ -428,7 +430,9 @@ { opcode: "json_array_create", blockType: Scratch.BlockType.REPORTER, - text: "create array by [text] with delimiter [d]", + text: Scratch.translate( + "create array by [text] with delimiter [d]" + ), arguments: { text: { type: Scratch.ArgumentType.STRING, @@ -443,7 +447,9 @@ { opcode: "json_array_join", blockType: Scratch.BlockType.REPORTER, - text: "join string by array [json] with delimiter [d]", + text: Scratch.translate( + "join string by array [json] with delimiter [d]" + ), arguments: { json: { type: Scratch.ArgumentType.STRING, @@ -459,7 +465,7 @@ { opcode: "json_array_sort", blockType: Scratch.BlockType.REPORTER, - text: "sort array [list] in [order] order", + text: Scratch.translate("sort array [list] in [order] order"), disableMonitor: true, arguments: { list: { @@ -473,11 +479,11 @@ }, }, }, - makeLabel("Lists"), + makeLabel(Scratch.translate("Lists")), { opcode: "json_vm_getlist", blockType: Scratch.BlockType.REPORTER, - text: "get list [list] as array", + text: Scratch.translate("get list [list] as array"), arguments: { list: { type: Scratch.ArgumentType.STRING, @@ -488,7 +494,7 @@ { opcode: "json_vm_setlist", blockType: Scratch.BlockType.COMMAND, - text: "set list [list] to [json]", + text: Scratch.translate("set list [list] to [json]"), arguments: { list: { type: Scratch.ArgumentType.STRING, @@ -503,7 +509,20 @@ ], menus: { get_all: { - items: ["keys", "values", "datas"], + items: [ + { + text: Scratch.translate("keys"), + value: "keys", + }, + { + text: Scratch.translate("values"), + value: "values", + }, + { + text: Scratch.translate("datas"), + value: "datas", + }, + ], }, get_list: { acceptReporters: true, @@ -511,15 +530,33 @@ }, types: { acceptReporters: true, - items: ["Object", "Array"], + items: [ + { + text: Scratch.translate("Object"), + value: "Object", + }, + { + text: Scratch.translate("Array"), + value: "Array", + }, + ], }, equal: { acceptReporters: true, items: ["=", "≠"], }, sort_order: { - items: ["ascending", "descending"], acceptReporters: true, + items: [ + { + text: Scratch.translate("ascending"), + value: "ascending", + }, + { + text: Scratch.translate("descending"), + value: "descending", + }, + ], }, }, }; @@ -536,7 +573,7 @@ if (uniqueLists.length === 0) { return [ { - text: "select a list", + text: Scratch.translate("select a list"), value: "select a list", }, ];