Splitting a template literal invented eight English strings that were not there

check-hardcoded-english judges each quasi of a template literal on its own, which
is correct -- an allow-listed fragment must not drag a whole literal in with it.
But splitting `url(${base}/images/worldmap.svg)` leaves "url(" and
"/images/worldmap.svg)", and `repeat(${n}, minmax(0, 1fr))` leaves "repeat(" and
", minmax(0, 1fr))". The whole string is obviously CSS and the existing CSS shape
matches it; no individual fragment carries a brace or a colon-value pair, so each
one fell through and was reported as user-visible English.

Colon-terminated prefixes failed the same way. The id rule accepts a trailing
hyphen, because `id="country-${code}"` leaves "country-", but a langTree id is
`fam:${x}` / `dial:${x}` and a localStorage key is `pgg-cards-per-row:${profile}`.
Those leave "dial:" and "pgg-cards-per-row:", which no shape described.

Two shapes, both narrow: a CSS function fragment, and a prefix that is one
lowercase token ending at a colon. The fleet total goes 257 to 249 -- five of
mine, three in other owners' plugins -- and every real string still flags, which
I checked in the same breath rather than afterwards: "Search people groups…",
"Show filters", "selected" and "Research map loading…" are all still caught.

Worth saying plainly because the number was about to be routed as work: these
eight were never translation defects. Wrapping "dial:" in t() would have been a
bug, and someone would have done it on the strength of a count.
This commit is contained in:
Doxa Maps 2026-09-29 03:53:57 +00:00
parent 68ce355973
commit 8200c1e7d0

View file

@ -80,6 +80,19 @@ const ALLOW = [
// A trailing separator is allowed because that is the shape of an id PREFIX built by
// interpolation — `id="country-${code}"` leaves the quasi "country-".
test: (s) => s.split(/\s+/).every((tok) => /^[a-z][a-z0-9]*(?:[-_]{1,2}[a-z0-9]*)+$/.test(tok)) },
{ why: 'CSS FUNCTION FRAGMENTS left by splitting a template literal. A quasi is judged alone, so '
+ '`url(${base}/x.svg)` is tested as "url(" and "/x.svg)", and `repeat(${n}, minmax(0, 1fr))` '
+ 'as "repeat(" and ", minmax(0, 1fr))". The WHOLE string is obviously CSS and the existing CSS '
+ 'shape matches it, but no fragment carries a brace or a colon-value pair, so each one fell '
+ 'through and was reported as English. Measured 2026-09-29: this was 3 of my 94 findings.',
test: (s) => /^[a-z-]+\($/.test(s)
|| /^[,)\s]*[a-z-]+\([^)]*\)[,)\s]*$/.test(s)
|| /^[,)\s]+$/.test(s) },
{ why: 'ID PREFIXES ending in a COLON, built by interpolation: `fam:${x}`, `dial:${x}`, and '
+ 'localStorage keys like `pgg-cards-per-row:${profile}`. The hyphen rule below covers a '
+ 'trailing separator but not a colon, so these read as prose. A prefix is not a sentence: '
+ 'it is one lowercase token, no spaces, ending at the separator.',
test: (s) => /^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*:$/.test(s) },
{ why: 'font family names: typeface identifiers, never translated',
test: (s) => /^(Bebas Neue|Poppins|Oswald|Figtree|Segoe UI|Helvetica Neue|Times New Roman)$/.test(s) },
{ why: 'engine/provider tokens and well-known proper nouns that are not prose',