Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

translating jacdac + arcade #112

Merged
merged 6 commits into from
Dec 12, 2024
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/makecode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ jobs:
- run: cd tools/microbit-oob && makecode
- run: cd tools/microbit-jukebox && makecode
- run: cd tools/farm-beats && makecode
- run: ./test-others.sh
# - run: ./test-others.sh
- run: ./copy-release-files.sh
- name: Upload release files
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
with:
name: release-files
path: dist/
Expand Down
21 changes: 21 additions & 0 deletions gamepad/_locales/de/jacdac-gamepad-jsdoc-strings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"jacdac.GamepadEvent.ButtonsChanged": "Argument: buttons Buttons (uint32_t). Wird immer dann ausgelöst, wenn sich der Zustand der Tasten ändert.\n* ```\nconst [buttons] = jdunpack<[jacdac.GamepadButtons]>(buf, \"u32\")\n```",
"jacdac.GamepadEventPack.ButtonsChanged": "Packformat für 'buttons_changed' Daten.",
"jacdac.GamepadReg.ButtonsAvailable": "Konstante Tasten (uint32_t). Gibt eine Bitmaske der Tasten an, die auf dem Gamepad montiert sind.\nWenn die `links`/`hoch`/`rechts`/`runter` Tasten hier als verfügbar markiert sind, ist das Gamepad digital.\nSelbst wenn sie als nicht verfügbar markiert sind, werden sie dennoch basierend auf dem analogen Gamepad simuliert.\n* ```\nconst [buttonsAvailable] = jdunpack<[jacdac.GamepadButtons]>(buf, \"u32\")\n```",
"jacdac.GamepadReg.Direction": "Wenn das Gamepad analog ist, sollten die Richtungstasten basierend auf der Gamepad-Position \"simuliert\" werden\n(`links` ist `{ x = -1, y = 0 }`, `hoch` ist `{ x = 0, y = -1}`).\nWenn das Gamepad digital ist, dann wird jede Richtung entweder als `-1`, `0` oder `1` gelesen (in fester Darstellung).\nDie primäre Taste auf dem Gamepad ist `A`.\n* ```\nconst [buttons, x, y] = jdunpack<[jacdac.GamepadButtons, number, number]>(buf, \"u32 i1.15 i1.15\")\n```",
"jacdac.GamepadReg.Variant": "Konstante Variant (uint8_t). Der Typ des physischen Gamepads.\n* ```\nconst [variant] = jdunpack<[jacdac.GamepadVariant]>(buf, \"u8\")\n```",
"jacdac.GamepadRegPack.ButtonsAvailable": "Packformat für 'buttons_available' Daten.",
"jacdac.GamepadRegPack.Direction": "Packformat für 'direction' Daten.",
"jacdac.GamepadRegPack.Variant": "Packformat für 'variant' Daten.",
"modules": "Jacdac-Module",
"modules.GamepadClient": "Ein zweiachsiger Richtungs-Joystick",
"modules.GamepadClient.buttons": "Wenn der Joystick analog ist, sollten die Richtungstasten basierend auf der Joystick-Position \"simuliert\" werden\n(`Left` ist `{ x = -1, y = 0 }`, `Up` ist `{ x = 0, y = -1}`).\nWenn der Joystick digital ist, dann wird jede Richtung entweder als `-1`, `0` oder `1` gelesen (in fester Darstellung).\nDie primäre Taste auf dem Joystick ist `A`.",
"modules.GamepadClient.buttonsAvailable": "Gibt eine Bitmaske der Tasten an, die auf dem Joystick montiert sind.\nWenn die `Left`/`Up`/`Right`/`Down` Tasten hier als verfügbar markiert sind, ist der Joystick digital.\nSelbst wenn sie als nicht verfügbar markiert sind, werden sie dennoch basierend auf dem analogen Joystick simuliert.",
"modules.GamepadClient.isButtonDown": "Gibt an, ob die Taste (oder Kombination) gedrückt ist.",
"modules.GamepadClient.isButtonDown|param|button": "@returns true, wenn ausgewählte Tasten gedrückt sind",
"modules.GamepadClient.onButtonsChanged": "Wird immer dann ausgelöst, wenn sich der Zustand der Tasten ändert.",
"modules.GamepadClient.onEvent": "Code registrieren, der ausgeführt wird, wenn ein Ereignis ausgelöst wird",
"modules.GamepadClient.variant": "Der Typ des physischen Joysticks.",
"modules.GamepadClient.x": "Wenn der Joystick analog ist, sollten die Richtungstasten basierend auf der Joystick-Position \"simuliert\" werden\n(`links` ist `{ x = -1, y = 0 }`, `hoch` ist `{ x = 0, y = -1}`).\nWenn der Joystick digital ist, dann wird jede Richtung entweder als `-1`, `0` oder `1` gelesen (in fester Darstellung).\nDie primäre Taste auf dem Joystick ist `A`.",
"modules.GamepadClient.y": "Wenn der Joystick analog ist, sollten die Richtungstasten basierend auf der Joystick-Position \"simuliert\" werden\n(`links` ist `{ x = -1, y = 0 }`, `hoch` ist `{ x = 0, y = -1}`).\nWenn der Joystick digital ist, dann wird jede Richtung entweder als `-1`, `0` oder `1` gelesen (in fester Darstellung).\nDie primäre Taste auf dem Joystick ist `A`."
}
32 changes: 32 additions & 0 deletions gamepad/_locales/de/jacdac-gamepad-strings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"jacdac.GamepadButtons.A|block": "A",
"jacdac.GamepadButtons.B|block": "B",
"jacdac.GamepadButtons.Down|block": "runter",
"jacdac.GamepadButtons.Exit|block": "beenden",
"jacdac.GamepadButtons.Left|block": "links",
"jacdac.GamepadButtons.Menu|block": "Menü",
"jacdac.GamepadButtons.Reset|block": "zurücksetzen",
"jacdac.GamepadButtons.Right|block": "rechts",
"jacdac.GamepadButtons.Select|block": "auswählen",
"jacdac.GamepadButtons.Up|block": "hoch",
"jacdac.GamepadButtons.X|block": "X",
"jacdac.GamepadButtons.Y|block": "Y",
"jacdac.GamepadEvent.ButtonsChanged": "Argument: Buttons (uint32_t). Wird immer ausgegeben, wenn sich der Zustand der Tasten ändert.\n* ```\nconst [buttons] = jdunpack<[jacdac.GamepadButtons]>(buf, \"u32\")\n```",
"jacdac.GamepadEvent.ButtonsChanged|block": "Taste geändert",
"jacdac.GamepadReg.ButtonsAvailable": "Konstante Tasten (uint32_t). Zeigt eine Bitmaske der Tasten an, die auf dem Gamepad angebracht sind.\nWenn die `links`/`hoch`/`rechts`/`runter`-Tasten hier als verfügbar markiert sind, ist das Gamepad digital.\nSelbst wenn sie als nicht verfügbar markiert sind, werden sie dennoch basierend auf dem analogen Gamepad simuliert.\n* ```\nconst [buttonsAvailable] = jdunpack<[jacdac.GamepadButtons]>(buf, \"u32\")\n```",
"jacdac.GamepadReg.Direction": "Wenn das Gamepad analog ist, sollten die Richtungstasten basierend auf der Gamepad-Position \"simuliert\" werden\n(`Links` ist `{ x = -1, y = 0 }`, `hoch` ist `{ x = 0, y = -1 }`).\nWenn das Gamepad digital ist, wird jede Richtung entweder als `-1`, `0` oder `1` gelesen (in fester Darstellung).\nDie Primärtaste des Gamepads ist `A`.\n* ```\nconst [buttons, x, y] = jdunpack<[jacdac.GamepadButtons, number, number]>(buf, \"u32 i1.15 i1.15\")\n```",
"jacdac.GamepadReg.Variant": "Konstante Variante (uint8_t). Der Typ des physischen Gamepads.\n* ```\nconst [variant] = jdunpack<[jacdac.GamepadVariant]>(buf, \"u8\")\n```",
"jacdac.GamepadVariant.ArcadeBall|block": "Arcade-Kugel",
"jacdac.GamepadVariant.ArcadeStick|block": "Arcade-Stick",
"jacdac.GamepadVariant.Gamepad|block": "Gamepad",
"jacdac.GamepadVariant.Thumb|block": "Daumen",
"modules.GamepadClient.isButtonDown|block": "%joystick ist Taste $button unten",
"modules.GamepadClient.onEvent|block": "wenn %gamepad %event",
"modules.GamepadClient.x|block": "%joystick x",
"modules.GamepadClient.y|block": "%joystick y",
"modules.gamepad1|block": "Gamepad1",
"modules|block": "Module",
"{id:category}Jacdac": "Jacdac",
"{id:category}Modules": "Module",
"{id:group}Button": "Taste"
}
21 changes: 21 additions & 0 deletions gamepad/_locales/jacdac-gamepad-jsdoc-strings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"jacdac.GamepadEvent.ButtonsChanged": "Argument: buttons Buttons (uint32_t). Emitted whenever the state of buttons changes.\n* ```\nconst [buttons] = jdunpack<[jacdac.GamepadButtons]>(buf, \"u32\")\n```",
"jacdac.GamepadEventPack.ButtonsChanged": "Pack format for 'buttons_changed' data.",
"jacdac.GamepadReg.ButtonsAvailable": "Constant Buttons (uint32_t). Indicates a bitmask of the buttons that are mounted on the gamepad.\nIf the `Left`/`Up`/`Right`/`Down` buttons are marked as available here, the gamepad is digital.\nEven when marked as not available, they will still be simulated based on the analog gamepad.\n* ```\nconst [buttonsAvailable] = jdunpack<[jacdac.GamepadButtons]>(buf, \"u32\")\n```",
"jacdac.GamepadReg.Direction": "If the gamepad is analog, the directional buttons should be \"simulated\", based on gamepad position\n(`Left` is `{ x = -1, y = 0 }`, `Up` is `{ x = 0, y = -1}`).\nIf the gamepad is digital, then each direction will read as either `-1`, `0`, or `1` (in fixed representation).\nThe primary button on the gamepad is `A`.\n* ```\nconst [buttons, x, y] = jdunpack<[jacdac.GamepadButtons, number, number]>(buf, \"u32 i1.15 i1.15\")\n```",
"jacdac.GamepadReg.Variant": "Constant Variant (uint8_t). The type of physical gamepad.\n* ```\nconst [variant] = jdunpack<[jacdac.GamepadVariant]>(buf, \"u8\")\n```",
"jacdac.GamepadRegPack.ButtonsAvailable": "Pack format for 'buttons_available' data.",
"jacdac.GamepadRegPack.Direction": "Pack format for 'direction' data.",
"jacdac.GamepadRegPack.Variant": "Pack format for 'variant' data.",
"modules": "Jacdac modules",
"modules.GamepadClient": "A two axis directional joystick",
"modules.GamepadClient.buttons": "If the joystick is analog, the directional buttons should be \"simulated\", based on joystick position\n(`Left` is `{ x = -1, y = 0 }`, `Up` is `{ x = 0, y = -1}`).\nIf the joystick is digital, then each direction will read as either `-1`, `0`, or `1` (in fixed representation).\nThe primary button on the joystick is `A`.",
"modules.GamepadClient.buttonsAvailable": "Indicates a bitmask of the buttons that are mounted on the joystick.\nIf the `Left`/`Up`/`Right`/`Down` buttons are marked as available here, the joystick is digital.\nEven when marked as not available, they will still be simulated based on the analog joystick.",
"modules.GamepadClient.isButtonDown": "Indicates if the button (or combination of) is down.",
"modules.GamepadClient.isButtonDown|param|button": "@returns true if selected buttons are down",
"modules.GamepadClient.onButtonsChanged": "Emitted whenever the state of buttons changes.",
"modules.GamepadClient.onEvent": "Register code to run when an event is raised",
"modules.GamepadClient.variant": "The type of physical joystick.",
"modules.GamepadClient.x": "If the joystick is analog, the directional buttons should be \"simulated\", based on joystick position\n(`Left` is `{ x = -1, y = 0 }`, `Up` is `{ x = 0, y = -1}`).\nIf the joystick is digital, then each direction will read as either `-1`, `0`, or `1` (in fixed representation).\nThe primary button on the joystick is `A`.",
"modules.GamepadClient.y": "If the joystick is analog, the directional buttons should be \"simulated\", based on joystick position\n(`Left` is `{ x = -1, y = 0 }`, `Up` is `{ x = 0, y = -1}`).\nIf the joystick is digital, then each direction will read as either `-1`, `0`, or `1` (in fixed representation).\nThe primary button on the joystick is `A`."
}
32 changes: 32 additions & 0 deletions gamepad/_locales/jacdac-gamepad-strings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"jacdac.GamepadButtons.A|block": "a",
"jacdac.GamepadButtons.B|block": "b",
"jacdac.GamepadButtons.Down|block": "down",
"jacdac.GamepadButtons.Exit|block": "exit",
"jacdac.GamepadButtons.Left|block": "left",
"jacdac.GamepadButtons.Menu|block": "menu",
"jacdac.GamepadButtons.Reset|block": "reset",
"jacdac.GamepadButtons.Right|block": "right",
"jacdac.GamepadButtons.Select|block": "select",
"jacdac.GamepadButtons.Up|block": "up",
"jacdac.GamepadButtons.X|block": "x",
"jacdac.GamepadButtons.Y|block": "y",
"jacdac.GamepadEvent.ButtonsChanged": "Argument: buttons Buttons (uint32_t). Emitted whenever the state of buttons changes.\n* ```\nconst [buttons] = jdunpack<[jacdac.GamepadButtons]>(buf, \"u32\")\n```",
"jacdac.GamepadEvent.ButtonsChanged|block": "buttons changed",
"jacdac.GamepadReg.ButtonsAvailable": "Constant Buttons (uint32_t). Indicates a bitmask of the buttons that are mounted on the gamepad.\nIf the `Left`/`Up`/`Right`/`Down` buttons are marked as available here, the gamepad is digital.\nEven when marked as not available, they will still be simulated based on the analog gamepad.\n* ```\nconst [buttonsAvailable] = jdunpack<[jacdac.GamepadButtons]>(buf, \"u32\")\n```",
"jacdac.GamepadReg.Direction": "If the gamepad is analog, the directional buttons should be \"simulated\", based on gamepad position\n(`Left` is `{ x = -1, y = 0 }`, `Up` is `{ x = 0, y = -1}`).\nIf the gamepad is digital, then each direction will read as either `-1`, `0`, or `1` (in fixed representation).\nThe primary button on the gamepad is `A`.\n* ```\nconst [buttons, x, y] = jdunpack<[jacdac.GamepadButtons, number, number]>(buf, \"u32 i1.15 i1.15\")\n```",
"jacdac.GamepadReg.Variant": "Constant Variant (uint8_t). The type of physical gamepad.\n* ```\nconst [variant] = jdunpack<[jacdac.GamepadVariant]>(buf, \"u8\")\n```",
"jacdac.GamepadVariant.ArcadeBall|block": "arcade ball",
"jacdac.GamepadVariant.ArcadeStick|block": "arcade stick",
"jacdac.GamepadVariant.Gamepad|block": "gamepad",
"jacdac.GamepadVariant.Thumb|block": "thumb",
"modules.GamepadClient.isButtonDown|block": "%joystick is button $button down",
"modules.GamepadClient.onEvent|block": "on %gamepad %event",
"modules.GamepadClient.x|block": "%joystick x",
"modules.GamepadClient.y|block": "%joystick y",
"modules.gamepad1|block": "gamepad1",
"modules|block": "modules",
"{id:category}Jacdac": "Jacdac",
"{id:category}Modules": "Modules",
"{id:group}Button": "Button"
}
20 changes: 13 additions & 7 deletions gen-locs.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import "zx/globals"
import { run } from "genaiscript/api"

const target = "microbit"
const targets = ["microbit", "arcade"]
const langs = ["de"]

const libs = (await fs.readdir(".", { withFileTypes: true }))
Expand All @@ -17,15 +18,20 @@ for (const lib of libs) {
if (lib !== ".") cd(lib)
try {
const pkg = fs.readJSONSync("pxt.json")
if (!pkg.supportedTargets?.includes(target)) continue
if (!targets.some(target => pkg.supportedTargets?.includes(target)))
continue
await $`pxt install`
await $`pxt gendocs --locs`
await $`git checkout -- 'pxt.json'`.nothrow()
// update translations as needed
const clijs = `${lib === "." ? "" : "../"}.genaiscript/genaiscript.cjs`
const tool = `${lib === "." ? "" : "../"}genaisrc/loc-strings.genai.js`
for (const lang of langs)
await $`node ${clijs} run ${tool} "_locales/*-strings.json" --apply-edits --vars target=${target} lang=${lang}`.nothrow()
const tool = `${lib === "." ? "" : "../"}genaisrc/loc-strings.genai.mjs`
for (const lang of langs) {
console.log(`generating locs ${lib} for ${lang}`)
$`genaiscript run ${tool} _locales/*-strings.json --vars lang=${lang}`.nothrow()
// await run(tool, files, {
// applyEdits: true,
// varsMap: { lang: lang },
// })
}
// add generated files to pxt.json
let modded = false
const locs = await glob(`_locales/*/*.json`)
Expand Down
5 changes: 0 additions & 5 deletions gen-locs.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
#!/bin/sh

set -e

npm install -g pxt
npm install zx
pxt target microbit
node gen-locs.mjs
4 changes: 4 additions & 0 deletions genaisrc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# auto-generated
genaiscript.d.ts
tsconfig.json
jsconfig.json
Loading
Loading