Skip to content

Commit b7bd04c

Browse files
committed
fix up translation
1 parent d2483a0 commit b7bd04c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

scripts/lochex.mjs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
import fetch from "node-fetch"
99
import { execSync } from "child_process"
1010
import process from "process"
11+
import { fail } from "assert"
1112

1213
const tooltips = JSON.parse(
1314
readFileSync("./locales/tooltips.json", { encoding: "utf-8" })
@@ -81,17 +82,24 @@ for (const lang of languages.filter(l => l !== "pxt")) {
8182
.filter(k => !translations[k])
8283
.forEach(k => (translations[k] = tooltips[k]))
8384

85+
const entries = {}
86+
8487
const tooltip2tid = `
8588
export function tooltip2tid(id: string): number {
8689
let tid: number = undefined
87-
if (!id) return id
90+
if (!id) return tid
8891
${Object.keys(translations)
8992
// don't emit sample names in hardware
9093
.filter(k => !/^N/.test(k))
9194
// only Tids
9295
.filter(k => /T\d+/.test(k))
9396
.map(k => {
9497
const tid = parseInt(k.slice(1))
98+
if (entries[translations[k]]) {
99+
console.log(
100+
`ERROR: already have entry for ${translations[k]}`
101+
)
102+
}
95103
return ` else if (id === "${translations[k]}") tid = ${tid};`
96104
})
97105
.join("\n")}
@@ -130,7 +138,7 @@ ${Object.keys(translations)
130138
)
131139
// build hex
132140
console.log(` build hw`)
133-
exec("makecode --hw n3", { shell: true })
141+
exec("makecode", { shell: true })
134142
copyFileSync(
135143
"./built/n3/binary.hex",
136144
`./assets/hex/microcode-${lang.toLowerCase()}.hex`

0 commit comments

Comments
 (0)