test(i18n): compare the {{…}} variables of each key between fr.json and en.json (#480) #490

Merged
maximus merged 3 commits from issue-480-i18n-interpolation-guard into main 2026-10-24 18:10:12 +00:00

3 commits

Author SHA1 Message Date
le king fu
bb3e98c344 test(i18n): say how the variable guard reads nesting and unescaped forms (#480)
All checks were successful
PR Check — Frontend / frontend (pull_request) Successful in 2m13s
Neither locale file uses $t(…) nesting or the unescaped {{- …}} form
yet. The header of the guard now says what would happen if one came:
a nested key is not compared, and {{- name}} reads as the token
"- name", a gap against {{name}}. Comments only.

Resolves #480

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 20:16:58 -04:00
le king fu
fe91add0d4 docs(review): the i18n guard also compares the {{…}} variables of each key (#480)
All checks were successful
PR Check — Frontend / frontend (pull_request) Successful in 2m15s
REVIEW.md said the guard of src/i18n/locales.keys.test.ts compares only
the keys of both locale files; it now also fails on a key whose {{…}}
variables differ between them, format option included. The i18n zone
rule names the variables next to the keys, and the « Faux t » pitfall
keeps its blind spots: a text left in the other language passes, the
code is never read, so a key the code calls that neither file declares
escapes the guard, and so does a variable both files write alike that
the call does not pass. The « Niveaux » section is untouched.

Resolves #480

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 20:11:11 -04:00
le king fu
16060f94d5 test(i18n): compare the {{…}} variables of each key between fr.json and en.json (#480)
The guard of #453 held both locale files to one set of keys but never
read the values: a key writing {{count}} in fr.json and {{n}} in en.json
passed it and showed a raw {{n}} in one language.

For every leaf both files hold, variablesOf reads the {{…}} tokens as
i18next does (format options included, without the whitespace i18next
ignores) and variableGaps lists every key whose token sets differ, with
the tokens of each side. A canary reads import.rootFiles.message_one
(count, folder, names) and the formatted token of
onboarding.card.transactions.uncategorized (filter, lowercase) in both
files. Measured on main ff8738b: 1743 common leaves, 117 with variables,
zero gap, so no exception list.

The leaf walk is shared with nodesOf, so a path compared for its
variables is a path compared for its key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 20:05:46 -04:00