v0.247.0: i18n spike — the dashboard can speak English, Hungarian byte-identical
gates / gates (push) Successful in 19s
gates / gates (push) Successful in 19s
Message bundles (internal/i18n) expanded into templates before parsing, one template set per language. Launcher, /backups, /apps/<slug> and the layout converted; household language setting, POST /settings/language, ?lang= override, report field. Parity test against fixtures captured from unconverted templates; copy gates read templates expanded; new i18n_missing_gate. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
@@ -11,6 +11,9 @@ Exit 1 if any native confirm(/prompt(/alert( call remains in the templates.
|
||||
"""
|
||||
import io, os, re, sys
|
||||
|
||||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
||||
import i18n_bundle # noqa: E402
|
||||
|
||||
ROOTS = [
|
||||
os.path.join("internal", "web", "templates"),
|
||||
os.path.join("internal", "setup", "templates"),
|
||||
@@ -41,10 +44,14 @@ def main():
|
||||
for root in ROOTS:
|
||||
for path in _html_files(root):
|
||||
fn = os.path.relpath(path, root)
|
||||
for lineno, line in enumerate(io.open(path, encoding="utf-8"), 1):
|
||||
if NATIVE.search(line):
|
||||
total += 1
|
||||
print("%s:%d %s" % (fn, lineno, line.strip()[:120].encode('ascii', 'backslashreplace').decode()))
|
||||
# v0.247.0: judge each language's expansion -- JS copy lives in the i18n bundle now.
|
||||
seen = set()
|
||||
for lang in i18n_bundle.LANGS:
|
||||
for lineno, line in enumerate(i18n_bundle.read_template(path, lang).split("\n"), 1):
|
||||
if NATIVE.search(line) and (lineno, line) not in seen:
|
||||
seen.add((lineno, line))
|
||||
total += 1
|
||||
print("%s:%d [%s] %s" % (fn, lineno, lang, line.strip()[:120].encode('ascii', 'backslashreplace').decode()))
|
||||
if total:
|
||||
print("NATIVE CONFIRM GATE FAILED: %d native confirm()/prompt()/alert() call(s) remain" % total)
|
||||
sys.exit(1)
|
||||
|
||||
Reference in New Issue
Block a user