File tree Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -81,15 +81,23 @@ for (const lang of languages.filter(l => l !== "pxt")) {
8181 . filter ( k => ! translations [ k ] )
8282 . forEach ( k => ( translations [ k ] = tooltips [ k ] ) )
8383
84- // this is for english only (for now)
85- if ( lang == "en" ) {
86- const reverseMap = Object . keys ( tooltips ) . filter ( k => tooltips [ k ] )
87-
88- const tooltip2tid = `
84+ const tooltip2tid = `
8985 export function tooltip2tid(id: string): number {
86+ let tid: number = undefined
87+ if (!id) return id
88+ ${ Object . keys ( translations )
89+ // don't emit sample names in hardware
90+ . filter ( k => ! / ^ N / . test ( k ) )
91+ // only Tids
92+ . filter ( k => / T \d + / . test ( k ) )
93+ . map ( k => {
94+ const tid = parseInt ( k . slice ( 1 ) )
95+ return ` else if (id === "${ translations [ k ] } ") tid = ${ tid } ;`
96+ } )
97+ . join ( "\n" ) }
98+ return tid
9099 }
91100 `
92- }
93101
94102 const ts = `// auto-generated, run 'node scripts/lochex.mjs' to refresh
95103namespace microcode {
@@ -107,6 +115,8 @@ ${Object.keys(translations)
107115 . join ( "\n" ) }
108116 return res
109117 }
118+
119+ ${ tooltip2tid }
110120}`
111121
112122 writeFileSync ( "./tooltips.ts" , ts , { encoding : "utf8" } )
You can’t perform that action at this time.
0 commit comments