Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ jobs:
uses: actions/checkout@v7
with:
submodules: true
# `pnpm check:i18n-drift` (below) compares the locale packs on this
# branch against the packs at its MERGE BASE with the target branch,
# so it needs history — and checkout's default is a depth-1 clone,
# where `git merge-base` has nothing to find. The gate treats an
# unresolvable base as a hard failure rather than a skip, so getting
# this wrong is a red build rather than a silent pass; it is spelled
# out here so it stays that way. Pinned by
# `scripts/__tests__/check-i18n-en-drift.test.ts`.
fetch-depth: 0

- name: Enable Corepack
run: corepack enable
Expand Down Expand Up @@ -93,6 +102,18 @@ jobs:
- name: Verify t() call-site keys exist in the en locale pack
run: pnpm check:i18n-keys

# The step above and `all-locales-key-parity.test.ts` both read KEYS. When
# an `en` VALUE changes and the nine translations do not, every key-shaped
# gate stays green — objectui#3582 and objectui#3625 were eight packs each
# serving a retired sentence, the second one as idiomatic native-script
# translations that no mechanical judgement can distinguish from healthy.
# This gate judges the event instead of the state: `en` changed here, the
# translations must change here too. Needs the install (it parses the
# packs with `typescript`) and the `fetch-depth: 0` above (it diffs
# against the merge base), but nothing built.
- name: Verify changed en strings were followed by the nine translations
run: pnpm check:i18n-drift

# `scripts/` is not a workspace package, so `pnpm type-check` (i.e.
# `turbo run type-check`, which walks package.json `scripts`) structurally
# cannot reach it, and the coverage guard above decides coverage per
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"check:spec-symbols": "node scripts/check-spec-symbol-derivation.mjs",
"check:control-bytes": "node scripts/check-control-bytes.mjs",
"check:i18n-keys": "node scripts/check-i18n-call-site-keys.mjs",
"check:i18n-drift": "node scripts/check-i18n-en-drift.mjs",
"cli": "node packages/cli/dist/cli.js",
"objectui": "node packages/cli/dist/cli.js",
"create-plugin": "node packages/create-plugin/dist/index.js",
Expand Down
18 changes: 18 additions & 0 deletions packages/i18n/src/__tests__/all-locales-key-parity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,24 @@
* "happen to" render.
*
* The only permitted exception is the outbound-message set below.
*
* ## What this test does NOT own
*
* Key sets and placeholder shape, and nothing about what a value SAYS. Two
* sibling gates split the rest, and the boundaries are load-bearing:
*
* - `scripts/check-i18n-call-site-keys.mjs` (objectui#3530) — a key a `t()`
* call site asks for that NO pack defines. Ten packs identically missing it
* is full parity, so this file is green on it by construction.
* - `scripts/check-i18n-en-drift.mjs` (objectui#3650) — when an `en` VALUE
* changes, the nine translations must change in the same PR. This file was
* green through objectui#3582 and objectui#3625, correctly: neither touched
* a key set or a placeholder. Trying to make it red on those would be asking
* a key-set test to judge meaning.
*
* That gate skips any key a pack does not define — including the four
* `OUTBOUND_KEYS` below — precisely because their key sets are this file's
* business, so the two cannot contradict each other on the same fact.
*/
import { describe, it, expect } from 'vitest';
import { builtInLocales } from '../locales';
Expand Down
Loading
Loading