#!/usr/bin/env tsx /** * A date or a number is formatted in the profile language (D1111). * * Counted per package, in the admin UI and the UI library: `toLocaleString`, * `toLocaleDateString`, `toLocaleTimeString` and `Intl.*Format` called with no * locale, `undefined`, `[]` or a fixed locale string. Those follow the * browser, or one country, instead of the language the page is shown in. * * The count is pinned per package and may only shrink * (`scripts/i18n/baselines/check-admin-date-locale.json`). * * npx tsx scripts/check-admin-date-locale.ts # judge the tree * npx tsx scripts/check-admin-date-locale.ts --update # lower the pin after a migration */ import { isEntryPoint, productSources, REPO_ROOT, runFence } from './i18n/lib/fence-runner.ts' import { findUnlocalisedFormats } from './i18n/lib/text-fences.ts' function main(): void { const argv = process.argv.slice(2) process.exit( runFence( { name: 'check-admin-date-locale', rule: 'a date or number formatted without the page language; pass the active locale:', findings: findUnlocalisedFormats(productSources(REPO_ROOT)), }, argv, ), ) } if (isEntryPoint(import.meta.url)) main()