|
8 | 8 | import fetch from "node-fetch" |
9 | 9 | import { execSync } from "child_process" |
10 | 10 | import process from "process" |
| 11 | +import { fail } from "assert" |
11 | 12 |
|
12 | 13 | const tooltips = JSON.parse( |
13 | 14 | readFileSync("./locales/tooltips.json", { encoding: "utf-8" }) |
@@ -81,17 +82,24 @@ for (const lang of languages.filter(l => l !== "pxt")) { |
81 | 82 | .filter(k => !translations[k]) |
82 | 83 | .forEach(k => (translations[k] = tooltips[k])) |
83 | 84 |
|
| 85 | + const entries = {} |
| 86 | + |
84 | 87 | const tooltip2tid = ` |
85 | 88 | export function tooltip2tid(id: string): number { |
86 | 89 | let tid: number = undefined |
87 | | - if (!id) return id |
| 90 | + if (!id) return tid |
88 | 91 | ${Object.keys(translations) |
89 | 92 | // don't emit sample names in hardware |
90 | 93 | .filter(k => !/^N/.test(k)) |
91 | 94 | // only Tids |
92 | 95 | .filter(k => /T\d+/.test(k)) |
93 | 96 | .map(k => { |
94 | 97 | const tid = parseInt(k.slice(1)) |
| 98 | + if (entries[translations[k]]) { |
| 99 | + console.log( |
| 100 | + `ERROR: already have entry for ${translations[k]}` |
| 101 | + ) |
| 102 | + } |
95 | 103 | return ` else if (id === "${translations[k]}") tid = ${tid};` |
96 | 104 | }) |
97 | 105 | .join("\n")} |
@@ -130,7 +138,7 @@ ${Object.keys(translations) |
130 | 138 | ) |
131 | 139 | // build hex |
132 | 140 | console.log(` build hw`) |
133 | | - exec("makecode --hw n3", { shell: true }) |
| 141 | + exec("makecode", { shell: true }) |
134 | 142 | copyFileSync( |
135 | 143 | "./built/n3/binary.hex", |
136 | 144 | `./assets/hex/microcode-${lang.toLowerCase()}.hex` |
|
0 commit comments