Skip to content

Commit

Permalink
Translate some more extensions (#1463)
Browse files Browse the repository at this point in the history
  • Loading branch information
GarboMuffin authored May 12, 2024
1 parent bb18bf2 commit 6a057b5
Show file tree
Hide file tree
Showing 4 changed files with 131 additions and 44 deletions.
2 changes: 1 addition & 1 deletion extensions/CST1229/images.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
getInfo() {
return {
id: "images",
name: "Images",
name: Scratch.translate("Images"),
blocks: [
{
opcode: "getImage",
Expand Down
38 changes: 30 additions & 8 deletions extensions/bitwise.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
getInfo() {
return {
id: "Bitwise",
name: "Bitwise",
name: Scratch.translate("Bitwise"),

color1: "#17cde6",

Expand All @@ -42,7 +42,7 @@
{
opcode: "isNumberBits",
blockType: Scratch.BlockType.BOOLEAN,
text: "is [CENTRAL] binary?",
text: Scratch.translate("is [CENTRAL] binary?"),
arguments: {
CENTRAL: {
type: Scratch.ArgumentType.NUMBER,
Expand All @@ -54,7 +54,10 @@
{
opcode: "toNumberBits",
blockType: Scratch.BlockType.REPORTER,
text: "[CENTRAL] to binary",
text: Scratch.translate({
default: "[CENTRAL] to binary",
description: "Blocks that converts number to binary",
}),
arguments: {
CENTRAL: {
type: Scratch.ArgumentType.NUMBER,
Expand All @@ -65,7 +68,10 @@
{
opcode: "ofNumberBits",
blockType: Scratch.BlockType.REPORTER,
text: "[CENTRAL] to number",
text: Scratch.translate({
default: "[CENTRAL] to number",
description: "Block that converts binary to number",
}),
arguments: {
CENTRAL: {
type: Scratch.ArgumentType.NUMBER,
Expand Down Expand Up @@ -153,7 +159,11 @@
{
opcode: "bitwiseAnd",
blockType: Scratch.BlockType.REPORTER,
text: "[LEFT] and [RIGHT]",
text: Scratch.translate({
default: "[LEFT] and [RIGHT]",
description:
"Block that does bitwise and (reports number with bits set only where both numbers had that bit)",
}),
arguments: {
LEFT: {
type: Scratch.ArgumentType.NUMBER,
Expand All @@ -168,7 +178,11 @@
{
opcode: "bitwiseOr",
blockType: Scratch.BlockType.REPORTER,
text: "[LEFT] or [RIGHT]",
text: Scratch.translate({
default: "[LEFT] or [RIGHT]",
description:
"Block that does bitwise or (reports number with bits set where either number had that bit)",
}),
arguments: {
LEFT: {
type: Scratch.ArgumentType.NUMBER,
Expand All @@ -183,7 +197,11 @@
{
opcode: "bitwiseXor",
blockType: Scratch.BlockType.REPORTER,
text: "[LEFT] xor [RIGHT]",
text: Scratch.translate({
default: "[LEFT] xor [RIGHT]",
description:
"Block that does bitwise eXclusive OR. (reports number with bits set only where exactly one of the numbers had that bit)",
}),
arguments: {
LEFT: {
type: Scratch.ArgumentType.NUMBER,
Expand All @@ -198,7 +216,11 @@
{
opcode: "bitwiseNot",
blockType: Scratch.BlockType.REPORTER,
text: "not [CENTRAL]",
text: Scratch.translate({
default: "not [CENTRAL]",
description:
"Block that does a bitwise not. (flips all the bits in a number)",
}),
arguments: {
CENTRAL: {
type: Scratch.ArgumentType.NUMBER,
Expand Down
96 changes: 73 additions & 23 deletions extensions/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,39 +24,58 @@
_initCaseMenu() {
return [
{
text: "lowercase",
text: Scratch.translate({
default: "lowercase",
description: "If your language has lowercase, style it accordingly",
}),
value: CaseParam.LOWERCASE,
},
{
text: "UPPERCASE",
text: Scratch.translate({
default: "UPPERCASE",
description: "If your language has uppercase, style it accordingly",
}),
value: CaseParam.UPPERCASE,
},
{
text: "Title Case",
text: Scratch.translate({
default: "Title Case",
description:
"If your language has Title Case, style it accordingly. 'Abc' is title case and exactly title case but 'ABC' is only title case.",
}),
value: CaseParam.TITLECASE,
},
{
text: "Exactly Title Case",
text: Scratch.translate({
default: "Exactly Title Case",
description:
"If your language has Title Case, style it accordingly. 'Abc' is title case and exactly title case but 'ABC' is only title case.",
}),
value: CaseParam.EXACTTITLECASE,
},
{
text: "MiXeD CaSe",
text: Scratch.translate({
default: "MiXeD CaSe",
description:
"If your language has mixed case, style it accordingly",
}),
value: CaseParam.MIXEDCASE,
},
];
}

getInfo() {
return {
// id "text" could conflict with Scratch Lab's Animated Text
// for mods which implement it or if it ever comes out
// id "text" would conflict with Scratch Lab's Animated Text (lab/text.js)
id: "strings",
name: "Text",
name: Scratch.translate("Text"),
blocks: [
{
opcode: "letters_of",
blockType: Scratch.BlockType.REPORTER,
text: "letters [LETTER1] to [LETTER2] of [STRING]",
text: Scratch.translate(
"letters [LETTER1] to [LETTER2] of [STRING]"
),
arguments: {
LETTER1: {
type: Scratch.ArgumentType.NUMBER,
Expand All @@ -75,7 +94,7 @@
{
opcode: "split",
blockType: Scratch.BlockType.REPORTER,
text: "item [ITEM] of [STRING] split by [SPLIT]",
text: Scratch.translate("item [ITEM] of [STRING] split by [SPLIT]"),
arguments: {
ITEM: {
type: Scratch.ArgumentType.NUMBER,
Expand All @@ -94,7 +113,11 @@
{
opcode: "count",
blockType: Scratch.BlockType.REPORTER,
text: "count [SUBSTRING] in [STRING]",
text: Scratch.translate({
default: "count [SUBSTRING] in [STRING]",
description:
"Counts how many time [SUBSTRING] appears in [STRING]",
}),
arguments: {
SUBSTRING: {
type: Scratch.ArgumentType.STRING,
Expand All @@ -109,7 +132,10 @@
{
opcode: "indexof",
blockType: Scratch.BlockType.REPORTER,
text: "index of [SUBSTRING] in [STRING]",
text: Scratch.translate({
default: "index of [SUBSTRING] in [STRING]",
description: "Reports where [SUBSTRING] appears in [STRING]",
}),
arguments: {
SUBSTRING: {
type: Scratch.ArgumentType.STRING,
Expand All @@ -127,7 +153,9 @@
{
opcode: "replace",
blockType: Scratch.BlockType.REPORTER,
text: "replace [SUBSTRING] in [STRING] with [REPLACE]",
text: Scratch.translate(
"replace [SUBSTRING] in [STRING] with [REPLACE]"
),
arguments: {
SUBSTRING: {
type: Scratch.ArgumentType.STRING,
Expand All @@ -146,7 +174,7 @@
{
opcode: "repeat",
blockType: Scratch.BlockType.REPORTER,
text: "repeat [STRING] [REPEAT] times",
text: Scratch.translate("repeat [STRING] [REPEAT] times"),
arguments: {
STRING: {
type: Scratch.ArgumentType.STRING,
Expand All @@ -164,7 +192,7 @@
{
opcode: "unicodeof",
blockType: Scratch.BlockType.REPORTER,
text: "unicode of [STRING]",
text: Scratch.translate("unicode of [STRING]"),
arguments: {
STRING: {
type: Scratch.ArgumentType.STRING,
Expand All @@ -175,7 +203,7 @@
{
opcode: "unicodefrom",
blockType: Scratch.BlockType.REPORTER,
text: "unicode [NUM] as letter",
text: Scratch.translate("unicode [NUM] as letter"),
arguments: {
NUM: {
type: Scratch.ArgumentType.NUMBER,
Expand All @@ -188,7 +216,9 @@
{
opcode: "replaceRegex",
blockType: Scratch.BlockType.REPORTER,
text: "replace regex /[REGEX]/[FLAGS] in [STRING] with [REPLACE]",
text: Scratch.translate(
"replace regex /[REGEX]/[FLAGS] in [STRING] with [REPLACE]"
),
arguments: {
REGEX: {
type: Scratch.ArgumentType.STRING,
Expand All @@ -211,7 +241,12 @@
{
opcode: "matchRegex",
blockType: Scratch.BlockType.REPORTER,
text: "item [ITEM] of [STRING] matched by regex /[REGEX]/[FLAGS]",
text: Scratch.translate({
default:
"item [ITEM] of [STRING] matched by regex /[REGEX]/[FLAGS]",
description:
"/[REGEX]/ is supposed to match the syntax that some actual programming languages used for regular expressions.",
}),
arguments: {
ITEM: {
type: Scratch.ArgumentType.NUMBER,
Expand All @@ -234,7 +269,11 @@
{
opcode: "countRegex",
blockType: Scratch.BlockType.REPORTER,
text: "count regex /[REGEX]/[FLAGS] in [STRING]",
text: Scratch.translate({
default: "count regex /[REGEX]/[FLAGS] in [STRING]",
description:
"/[REGEX]/ is supposed to match the syntax that some actual programming languages used for regular expressions.",
}),
arguments: {
STRING: {
type: Scratch.ArgumentType.STRING,
Expand All @@ -253,7 +292,11 @@
{
opcode: "testRegex",
blockType: Scratch.BlockType.BOOLEAN,
text: "[STRING] matches regex /[REGEX]/[FLAGS]?",
text: Scratch.translate({
default: "[STRING] matches regex /[REGEX]/[FLAGS]?",
description:
"/[REGEX]/ is supposed to match the syntax that some actual programming languages used for regular expressions.",
}),
arguments: {
STRING: {
type: Scratch.ArgumentType.STRING,
Expand All @@ -275,7 +318,7 @@
{
opcode: "identical",
blockType: Scratch.BlockType.BOOLEAN,
text: "is [OPERAND1] identical to [OPERAND2]?",
text: Scratch.translate("is [OPERAND1] identical to [OPERAND2]?"),
arguments: {
OPERAND1: {
type: Scratch.ArgumentType.STRING,
Expand All @@ -293,7 +336,10 @@
{
opcode: "isCase",
blockType: Scratch.BlockType.BOOLEAN,
text: "is [STRING] [TEXTCASE]?",
text: Scratch.translate({
default: "is [STRING] [TEXTCASE]?",
description: "Example block context: <is [hello] [lowercase] ?>",
}),
arguments: {
STRING: {
type: Scratch.ArgumentType.STRING,
Expand All @@ -309,7 +355,11 @@
{
opcode: "toCase",
blockType: Scratch.BlockType.REPORTER,
text: "convert [STRING] to [TEXTCASE]",
text: Scratch.translate({
default: "convert [STRING] to [TEXTCASE]",
description:
"Example block context: (convert [HELLO] to [lowercase])",
}),
arguments: {
STRING: {
type: Scratch.ArgumentType.STRING,
Expand Down
Loading

0 comments on commit 6a057b5

Please sign in to comment.