diff --git a/scripts/constants.js b/scripts/constants.js index b7fa384..e2d4d86 100644 --- a/scripts/constants.js +++ b/scripts/constants.js @@ -34,7 +34,7 @@ ${locale.maroon} = (128, 50, 50); ${locale.purple} = (150, 100, 220); # Global variables. -${locale.interval} = ${DEFAULT_INTERVAL} +# ${locale.interval} = ${DEFAULT_INTERVAL} # Grid functions. def ${locale.size}(n, m): @@ -43,6 +43,7 @@ def ${locale.size}(n, m): def ${locale.font}(size): grid.font(f"{size}pt") + def ${locale.color}(i, j, col): if callable(col): col = col() grid.bgcolor(i, j, *col) @@ -50,12 +51,14 @@ def ${locale.color}(i, j, col): def ${locale.text}(i, j, text): grid.text(i, j, text) + def ${locale.fill}(col): grid.fill(*col) def ${locale.clear}(): grid.clear() + def ${locale.line}(i, col): grid.line(i, *col) diff --git a/scripts/locale.js b/scripts/locale.js index 1870f3a..97383f6 100644 --- a/scripts/locale.js +++ b/scripts/locale.js @@ -51,7 +51,7 @@ export function addLocale(locale) { let result = ''; for (const key in locale) { if (Object.hasOwnProperty.call(locale, key)) { - result += `${locale[key]} = ${key}\n`; + result += `${locale[key]} = globals().get("${key}", None)\n`; } } return result; diff --git a/scripts/runner.js b/scripts/runner.js index 9009d5b..c6236b1 100644 --- a/scripts/runner.js +++ b/scripts/runner.js @@ -99,7 +99,7 @@ class Runner { // Parse the interval: use the localized variable name. // NOTE: use the code metadata instead. - let interval = this.get('interval', LANG); + let interval = this.get('interval', LANG) || this.get('interval'); if (interval) this.interval = interval; @@ -143,6 +143,7 @@ class Runner { let locale = getLocale(lang); varName = locale[varName]; } + if (!varName) return null; return this.globals ? this.globals.toJs().get(varName) : null; }