#!/usr/bin/env node /* * User-visible English the extraction pass cannot see. * * `i18n:coverage` reads JSX text, and reported 100% while the calendar's * Day/Week/Month/Agenda buttons rendered English in all nine languages. It was * not wrong about what it measured -- those labels were never JSX text. They * were built from an expression, and so was every toast argument, every * `confirmDialog({ title })`, and every `Could not save: ${err}`. * * A string reaches a reader translated if either is true: * * 1. it is wrapped where it is written -- t(), tc(), tNode(), plural() * 2. it is a catalogue key, translated somewhere else * * The second case is a real convention here, not a loophole: constant tables * hold English and the render site calls `t(s.label)`. What this refuses is a * string that is neither -- one no catalogue has a key for, which therefore * cannot be translated at all, however many languages ship. */ /* * The parser, not the compiler. * * TypeScript 7 is the native port: its package ships a `tsc` shim over a Go * binary and nothing else, so `typescript` now exports `version` and * `versionMajorMinor` and no compiler API at all. Every `ts.createSourceFile` * in this directory started throwing "Cannot read properties of undefined * (reading 'Latest')" the day the bump landed, and nothing noticed, because no * workflow runs these. * * `typescript-ast` is an npm alias for the last TypeScript that carries the JS * API (see package.json). It parses; `typescript` still type-checks and builds. * Two entries, two jobs -- not a version someone forgot to remove. */ import ts from "typescript-ast"; import { readFileSync, globSync } from "node:fs"; /* Where a string literal in this position is shown to somebody. */ const UI_PROPS = new Set([ "title", "message", "label", "confirmLabel", "cancelLabel", "ariaLabel", "placeholder", "hint", "occurrenceLabel", "occurrenceHint", "seriesLabel", "seriesHint", ]); /* * A JSX attribute is shown whether it lands on an element or on a component: * `` renders its label as given, exactly as * `