Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,5 @@ jobs:
with:
artifacts: "build/scratch-arduino-app*.zip"
allowUpdates: true
prerelease: ${{ contains(github.ref_name, 'rc') }}
token: ${{ github.token }}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// const formatMessage = require('../../../../../../scratch-editor/node_modules/format-message');
const BlockType = require('../../../../../../scratch-editor/packages/scratch-vm/src/extension-support/block-type');
const ArgumentType = require('../../../../../../scratch-editor/packages/scratch-vm/src/extension-support/argument-type');
const formatMessage = require('../../../../../../scratch-editor/node_modules/format-message');
const io = require('../socket.io.min.js');

/**
Expand Down Expand Up @@ -34,14 +35,22 @@ class ArduinoBasics {
ArduinoBasics.prototype.getInfo = function () {
return {
id: 'arduinobasics',
name: "Arduino Basics",
name: formatMessage({
id: 'arduino.basics',
defaultMessage: 'Arduino Basics',
description: 'The name of the "Arduino Basics" extension'
}),
menuIconURI: menuIconURI,
blockIconURI: iconURI,
blocks: [
{
opcode: 'matrixDraw',
blockType: BlockType.COMMAND,
text: 'draw [FRAME] on matrix',
text: formatMessage({
id: 'arduino.drawMatrix',
defaultMessage: 'show [FRAME] on matrix',
description: 'Draw the given frame on the LED matrix'
}),
func: 'matrixDraw',
arguments: {
FRAME: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const BlockType = require('../../../../../../scratch-editor/packages/scratch-vm/src/extension-support/block-type');
const ArgumentType = require('../../../../../../scratch-editor/packages/scratch-vm/src/extension-support/argument-type');
const formatMessage = require('../../../../../../scratch-editor/node_modules/format-message');

const io = require('../socket.io.min.js');


Expand Down Expand Up @@ -40,14 +42,22 @@ class ArduinoModulino {
ArduinoModulino.prototype.getInfo = function () {
return {
id: 'arduinomodulino',
name: "Arduino Modulino",
name: formatMessage({
id: 'arduino.modulino',
defaultMessage: 'Arduino Modulino',
description: 'The name of the "Arduino Modulino" extension'
}),
menuIconURI: menuIconURI,
blockIconURI: iconURI,
blocks: [
{
opcode: 'whenModulinoButtonsPressed',
blockType: BlockType.HAT,
text: 'when modulino button [BTN] pressed',
text: formatMessage({
id: 'arduino.modulino.whenPressed',
defaultMessage: 'when modulino button [BTN] pressed',
description: 'When the specified modulino button is pressed'
}),
func: 'whenModulinoButtonsPressed',
arguments: {
BTN: {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"it": {
"arduino.basics": "Arduino Base",
"arduino.drawMatrix": "mostra led [FRAME]",

"arduino.modulino": "Arduino Modulino",
"arduino.modulino.whenPressed": "quando premi il bottone [BTN]"
}
}
20 changes: 20 additions & 0 deletions scratch-arduino-extensions/scripts/patch-gui.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,28 @@ extensions.forEach(extension => {
fs.writeFileSync(scratchVmVirtualMachineFile, vmCode);
process.stdout.write("done\n");
} else process.stdout.write("skip");

});

process.stdout.write("\nAdding translation: ");
const scratchl10nEditorMsgsFile = path.resolve(BaseDir,"../scratch-editor/node_modules/scratch-l10n/locales/editor-msgs.js");
let fileContent = fs.readFileSync(scratchl10nEditorMsgsFile, "utf8");
let match = fileContent.match(/export default (\{.*\});/s);
if (!match) {
throw new Error("Could not find object in file");
}
let obj = eval("(" + match[1] + ")");
fs.copyFileSync(scratchl10nEditorMsgsFile, `${scratchl10nEditorMsgsFile}.orig`);

const patchedMessages = path.resolve(BaseDir,"./scratch-l10n/locales/editor-msgs.json");
let messages = JSON.parse(fs.readFileSync(patchedMessages, "utf8"));
for (let lang in messages) {
process.stdout.write(`\n\t - ${lang}`);
obj[lang] = { ...obj[lang], ...messages[lang] };
}
let updatedContent = "export default " + JSON.stringify(obj, null, 2) + ";";
fs.writeFileSync(scratchl10nEditorMsgsFile, updatedContent);




Expand Down
Loading