locale-keysmith 0.3.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -11,7 +11,7 @@ source language, and checks which keys your code still uses. It can then sort th
11
11
  delete unused keys, and fill in missing translations with Google Translate.
12
12
 
13
13
  - **Audit:** one `health` command reports missing, extra, unused, duplicate and empty keys,
14
- type mismatches and unsorted files.
14
+ type mismatches, broken placeholders, missing files and unsorted files.
15
15
  - **Clean up:** `sort` and `remove-unused` rewrite files while keeping their indentation, line
16
16
  endings and YAML comments.
17
17
  - **Translate:** fill missing keys via Google Translate, with `{{placeholders}}`, ICU messages
@@ -59,16 +59,17 @@ a config file (see [Configuration](#configuration)).
59
59
  The examples use `npx locale-keysmith <command>`; with pnpm or yarn, `pnpm exec` or `yarn`
60
60
  work the same way.
61
61
 
62
- | Command | What it does |
63
- | -------------------------- | ------------------------------------------------------------------------ |
64
- | `init` | Write a starter `locale-keysmith.config.json` for this project. |
65
- | `scan` | List the locale files that were found, with their inferred locale. |
66
- | `health` | Run every check below plus extra keys, empty values and type mismatches. |
67
- | `missing` | List keys present in the source locale but missing from the others. |
68
- | `unused` | List source-locale keys that no source file references. |
69
- | `sort` | Sort every locale file's keys alphabetically (nested too). |
70
- | `remove-unused` | Delete unused keys from every locale file. |
71
- | `translate --to <locales>` | Fill missing keys in target locales via Google Translate. |
62
+ | Command | What it does |
63
+ | --------------- | -------------------------------------------------------------------------------------- |
64
+ | `init` | Write a starter `locale-keysmith.config.json` for this project. |
65
+ | `scan` | List the locale files that were found, with their inferred locale. |
66
+ | `health` | Run every check below plus extra keys, empty values, type mismatches and placeholders. |
67
+ | `missing` | List keys present in the source locale but missing from the others. |
68
+ | `unused` | List source-locale keys that no source file references. |
69
+ | `why <key>` | Show where and how a key is used. |
70
+ | `sort` | Sort every locale file's keys alphabetically (nested too). |
71
+ | `remove-unused` | Delete unused keys from every locale file. |
72
+ | `translate` | Fill missing keys in target locales via Google Translate. |
72
73
 
73
74
  ### `init`
74
75
 
@@ -125,15 +126,21 @@ unused draft.placeholder
125
126
  7 issues found.
126
127
  ```
127
128
 
128
- | Issue | Meaning |
129
- | --------------- | ----------------------------------------------------------------------------- |
130
- | `unsorted` | The file's keys are not in alphabetical order (fix with `sort --write`). |
131
- | `duplicate` | The file defines a key twice, e.g. `"nav.home"` and `"nav": { "home" }`. |
132
- | `missing` | A key from the source locale is absent in this locale. |
133
- | `extra` | This locale has a key the source locale does not (often a leftover). |
134
- | `empty` | The value is an empty or whitespace-only string, or `null`. |
135
- | `type-mismatch` | The key holds a different kind of value than in the source (text vs. object). |
136
- | `unused` | No source file references the key. |
129
+ | Issue | Meaning |
130
+ | --------------- | ---------------------------------------------------------------------------------------------------------------------------- |
131
+ | `unsorted` | The file's keys are not in alphabetical order (fix with `sort --write`). |
132
+ | `duplicate` | A key is written twice: `"nav.home"` and `"nav": { "home" }`, or twice in one object. |
133
+ | `missing-file` | A locale listed in `locales` has no file for this set of translations. |
134
+ | `missing` | A key from the source locale is absent in this locale. |
135
+ | `extra` | This locale has a key the source locale does not (often a leftover). |
136
+ | `empty` | The value is an empty or whitespace-only string, or `null`. |
137
+ | `type-mismatch` | The key holds a different kind of value than in the source (text vs. object, text vs. number), however either file nests it. |
138
+ | `placeholder` | The translation lost, misspelled or added a placeholder such as `{{name}}`, `{count}`, `<0>` or `$t(key)`. |
139
+ | `unused` | No source file references the key. |
140
+
141
+ Placeholders are compared regardless of order and spacing. The text inside an ICU message is
142
+ not compared, since it is translated, and `{{count}}` may differ between plural forms ("One
143
+ item" / "{{count}} items").
137
144
 
138
145
  It exits with a non-zero status when any issue is found, so it can gate CI. When everything
139
146
  is fine it prints `All locale files are healthy.` and exits `0`. Keys matching `ignoreKeys`
@@ -147,6 +154,10 @@ npx locale-keysmith missing
147
154
 
148
155
  Lists, per non-source locale, the keys that exist in the source locale but are absent.
149
156
 
157
+ With `locales` in the config, it also lists translation files that do not exist at all, such
158
+ as a `de/checkout.json` that was never created or was deleted. Without it, only files that
159
+ exist are compared.
160
+
150
161
  Plural keys follow each language's plural rules, as i18next does: English `item_one` /
151
162
  `item_other` means Polish needs `item_one`, `item_few`, `item_many` and `item_other`, while
152
163
  Japanese only needs `item_other`. Neither is reported as missing or extra for doing so, and
@@ -161,6 +172,27 @@ npx locale-keysmith unused
161
172
  Lists source-locale keys that are never referenced in your source files. See
162
173
  [Key usage detection](#key-usage-detection) for exactly what counts as "referenced".
163
174
 
175
+ ### `why`
176
+
177
+ ```bash
178
+ npx locale-keysmith why cart.item_one
179
+ npx locale-keysmith why account:title # only the account namespace
180
+ ```
181
+
182
+ Shows what keeps a key alive, so you can check what `unused` and `remove-unused` will do:
183
+
184
+ ```text
185
+ cart.item_one (src/locales/en.json)
186
+ a plural or context form of "cart.item":
187
+ src/components/Cart.tsx:12
188
+ read as part of "cart":
189
+ src/pages/Checkout.tsx:40
190
+ ```
191
+
192
+ Each reason lists the source lines, or the translations that nest the key with `$t()`. A
193
+ key nothing uses is reported as `not used` and the command exits 1. `--json` prints the same
194
+ as data.
195
+
164
196
  ### `sort`
165
197
 
166
198
  ```bash
@@ -180,7 +212,11 @@ npx locale-keysmith remove-unused --write # delete unused keys and re-sort
180
212
  ```
181
213
 
182
214
  Removes unused keys from **every** locale file (not just the source), then re-sorts them.
183
- It lists every key it removes; without `--write` it only lists the keys that would be removed.
215
+ When a whole plural family is unused, the forms only other languages have (Polish
216
+ `item_few`, `item_many`) are removed with it.
217
+ It lists every key it removes and how many keys each file loses; without `--write` it lists
218
+ exactly what `--write` would do, and nothing is written until every change is worked out.
219
+ `--dry-run` and `--write` cannot be combined.
184
220
 
185
221
  > **Warning:** `--write` deletes translations. Commit your work first and read the list it prints: a key
186
222
  > that your code builds entirely at runtime cannot be detected (see
@@ -196,11 +232,12 @@ npx locale-keysmith translate --from en --to de,fr --write
196
232
 
197
233
  Translates the source locale's missing keys into each target locale using the Google
198
234
  Translate API. A target locale that has no file yet is created next to the source file. Keys
199
- matching `ignoreKeys` are not translated.
235
+ matching `ignoreKeys` are not translated, including plural forms such as `*_few`. Without
236
+ `--to`, it translates into every locale listed in `locales` in the config.
200
237
 
201
238
  | Option | Default | Description |
202
239
  | ----------------- | ----------------------- | ----------------------------------------------- |
203
- | `--to <locales>` | — | Comma-separated target locales (required). |
240
+ | `--to <locales>` | `locales` (config) | Comma-separated target locales. |
204
241
  | `--from <locale>` | `sourceLocale` (config) | Source locale to translate from. |
205
242
  | `--write` | off | Write results to disk (otherwise preview only). |
206
243
 
@@ -213,6 +250,11 @@ never in the URL.
213
250
  with a warning rather than written broken. (The text inside an ICU message is kept as is.)
214
251
  - **Progress is saved.** If a request fails midway, the keys translated so far are written
215
252
  before the error is reported, so rerunning only translates what is left.
253
+ - **Existing translations are never replaced.** A key is written with the same layout as in
254
+ the source (a dotted `"cart.title"` key stays dotted). When the target already holds
255
+ something else in its place, such as text where the source has nested keys, the key is
256
+ skipped with a warning. If a target file exists but is not among the scanned locale
257
+ files, or cannot be written, the command stops before sending anything.
216
258
  - Keys are sent in batches of up to 100 strings per request.
217
259
 
218
260
  #### Getting an API key
@@ -256,8 +298,8 @@ Exit codes:
256
298
  | Code | Meaning |
257
299
  | ---- | --------------------------------------------------------------------------------- |
258
300
  | `0` | Nothing to report. |
259
- | `1` | `missing`, `unused` or `health` found something. |
260
- | `2` | The command itself failed (invalid config, unreadable locale file, API error...). |
301
+ | `1` | `missing`, `unused` or `health` found something, or `why` found no use. |
302
+ | `2` | The command itself failed (invalid option or config, unreadable file, API error). |
261
303
 
262
304
  `scan`, `missing`, `unused` and `health` accept `--json` and print a machine-readable
263
305
  result on stdout (warnings go to stderr, so stdout always parses):
@@ -301,25 +343,32 @@ set either explicitly, which overrides the derived globs:
301
343
  "roots": ["src"],
302
344
  "translationFiles": ["src/locales/*.{json,yml,yaml}", "public/locales/**/*.{json,yml,yaml}"],
303
345
  "src": ["src/**/*.{ts,tsx,js,jsx,vue}"],
304
- "ignoreKeys": ["debug.*"]
346
+ "ignoreKeys": ["debug.*"],
347
+ "locales": ["en", "de", "fr"]
305
348
  }
306
349
  ```
307
350
 
308
351
  ### Fields and defaults
309
352
 
310
- | Field | Default | Purpose |
311
- | ------------------ | --------------------------------------------------------- | ----------------------------------------------------- |
312
- | `sourceLocale` | `"en"` | Locale treated as the source of truth. |
313
- | `roots` | `["src"]` | Folders to scan for locale files and source usage. |
314
- | `translationFiles` | `<root>/**/*.{json,yml,yaml}` per root | Globs for locale files (overrides the derived globs). |
315
- | `src` | `<root>/**/*.{ts,tsx,js,jsx,mjs,cjs,vue,svelte}` per root | Globs for source files (overrides the derived globs). |
316
- | `ignoreKeys` | `[]` | Key patterns excluded from audits (`*` wildcard). |
353
+ | Field | Default | Purpose |
354
+ | ------------------ | --------------------------------------------------------- | ------------------------------------------------------- |
355
+ | `sourceLocale` | `"en"` | Locale treated as the source of truth. |
356
+ | `roots` | `["src"]` | Folders to scan for locale files and source usage. |
357
+ | `translationFiles` | `<root>/**/*.{json,yml,yaml}` per root | Globs for locale files (overrides the derived globs). |
358
+ | `src` | `<root>/**/*.{ts,tsx,js,jsx,mjs,cjs,vue,svelte}` per root | Globs for source files (overrides the derived globs). |
359
+ | `ignoreKeys` | `[]` | Key patterns excluded from audits (`*` wildcard). |
360
+ | `locales` | `[]` | Locales every set of translations must have a file for. |
317
361
 
318
362
  The config is checked before any command runs. Wrong types (`"roots": "src"` instead of
319
363
  `["src"]`), a `sourceLocale` that is not a locale code, and unknown fields (with a "did you
320
364
  mean" hint for typos) are all reported together.
321
365
 
322
- `node_modules`, `dist`, and `.next` are always ignored.
366
+ `node_modules`, `dist`, and `.next` are always ignored. A linked locale file is used only
367
+ when it points inside the project, linked folders are not entered, and no command writes
368
+ outside the project directory.
369
+
370
+ Writes replace a file in one step and keep its permissions. A file that changed on disk
371
+ since the command read it is left alone and the command fails, so rerun it.
323
372
 
324
373
  ### How locale files are recognised
325
374
 
@@ -349,6 +398,8 @@ referenced indirectly. All of these are detected:
349
398
  t("app.title"); // direct call (also i18n.t / $t / translate)
350
399
  <Trans i18nKey="banner.welcome" />; // JSX i18nKey prop
351
400
  t(online ? "status.online" : "status.offline"); // ternary branches
401
+ t(["error.specific", "error.generic"]); // fallback keys
402
+ t(($) => $.menu.title); // selector function
352
403
 
353
404
  const priorityKey = { low: "priority.low", high: "priority.high" };
354
405
  t(priorityKey[level]); // value from a lookup object
@@ -364,12 +415,21 @@ runtime:
364
415
  ```ts
365
416
  t("cart.item", { count }); // cart.item_one, cart.item_other, cart.item_zero, ... are used
366
417
  t("friend.greeting", { context }); // friend.greeting_male, friend.greeting_female, ... are used
367
- t("common:common.title"); // namespaced: common.title is used
418
+ t("common:common.title"); // namespaced: common.title in the common namespace is used
419
+ t("menu", { returnObjects: true }); // every key under menu is used
420
+ t("steps.0"); // the steps array is used
368
421
 
369
422
  const { t } = useTranslation("translation", { keyPrefix: "settings" });
370
423
  t("title"); // keyPrefix: settings.title is used (also getFixedT(lng, ns, "settings"))
371
424
  ```
372
425
 
426
+ Translations can use other keys through i18next nesting, as in `"title": "$t(brand) app"`.
427
+ A key referenced that way from any locale file is used too.
428
+
429
+ A namespaced reference only counts for its own namespace: with `public/locales/en/account.json`
430
+ and `public/locales/en/home.json`, `t("account:title")` keeps `title` in `account.json` but
431
+ not in `home.json`. A reference without a namespace counts for every namespace.
432
+
373
433
  In a file that sets a `keyPrefix`, every key is counted both with and without the prefix,
374
434
  since another `t` in the same file may not use it. A `keyPrefix` built at runtime cannot be
375
435
  resolved, so keep its keys out of `remove-unused` with `ignoreKeys`.
@@ -385,6 +445,9 @@ t("errors." + code); // every key under errors. is used
385
445
  A key computed entirely at runtime (`t(keyFromServer)`) leaves no trace in the source, so it
386
446
  is reported as unused. Add such keys to `ignoreKeys`.
387
447
 
448
+ If the `src` globs match no file at all, every key would look unused. `unused` and
449
+ `health` then print a warning, and `remove-unused` stops without removing anything.
450
+
388
451
  ## Contributing
389
452
 
390
453
  Bug reports and pull requests are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for the
package/dist/checks.d.ts CHANGED
@@ -1,28 +1,82 @@
1
- import type { LocaleFile, LocaleObject } from "./types.js";
1
+ import type { LocaleFile, LocaleLintConfig, LocaleObject } from "./types.js";
2
+ import type { KeyUsage } from "./usage.js";
2
3
  export interface TypeMismatch {
3
4
  key: string;
4
5
  /** Value kind in the source file: string, number, boolean, null, array or object. */
5
6
  source: string;
6
7
  target: string;
7
8
  }
9
+ export type HealthIssueType = "unsorted" | "duplicate" | "missing-file" | "missing" | "extra" | "empty" | "type-mismatch" | "placeholder" | "unused";
10
+ export interface HealthIssue {
11
+ type: HealthIssueType;
12
+ file: LocaleFile;
13
+ key?: string;
14
+ /** For type mismatches: what the key holds in the source and in this file. */
15
+ kinds?: {
16
+ source: string;
17
+ target: string;
18
+ };
19
+ /** For placeholder issues: placeholders of the source text this file lacks, and extra ones. */
20
+ placeholders?: {
21
+ missing: string[];
22
+ unexpected: string[];
23
+ };
24
+ }
25
+ export interface PlaceholderMismatch {
26
+ key: string;
27
+ missing: string[];
28
+ unexpected: string[];
29
+ }
30
+ /** Every issue `health` reports for groups of a source file and its translations. */
31
+ export declare function healthIssues(groups: Array<{
32
+ source: LocaleFile;
33
+ targets: LocaleFile[];
34
+ }>, { ignoreKeys, locales }: Pick<LocaleLintConfig, "ignoreKeys" | "locales">, usage: KeyUsage): HealthIssue[];
35
+ /**
36
+ * The files a group lacks for the required `locales`, as empty locale files at the path each
37
+ * would have (`locales/de/checkout.json` next to `locales/en/checkout.json`).
38
+ */
39
+ export declare function absentLocaleFiles({ source, targets }: {
40
+ source: LocaleFile;
41
+ targets: LocaleFile[];
42
+ }, locales: string[]): LocaleFile[];
43
+ /** Source keys no code or translation reads, judged within the file's own namespace. */
44
+ export declare function unusedKeys(source: LocaleFile, ignoreKeys: string[], usage: KeyUsage): string[];
8
45
  /**
9
46
  * The keys a target locale should contain: the source keys, with plural forms adjusted to
10
47
  * the target language. English `item_one`/`item_other` becomes `item_one`/`item_few`/
11
48
  * `item_many`/`item_other` for Polish and just `item_other` for Japanese.
12
49
  */
13
50
  export declare function expectedKeys(sourceKeys: string[], targetLocale: string): string[];
14
- export declare function missingKeys(sourceKeys: string[], target: LocaleFile): string[];
51
+ /**
52
+ * `keys` plus every plural form of the complete plural families among them, so removing
53
+ * English `item_one`/`item_other` also removes Polish `item_few` and `item_many`.
54
+ */
55
+ export declare function withPluralForms(keys: string[]): string[];
56
+ /** Expected keys the target lacks. Ignore patterns apply to the target's own plural forms too. */
57
+ export declare function missingKeys(sourceKeys: string[], target: LocaleFile, ignoreKeys?: string[]): string[];
15
58
  /** Keys in the target that the source does not have (allowing for the target's plural forms). */
16
59
  export declare function extraKeys(sourceKeys: string[], target: LocaleFile): string[];
17
60
  /**
18
61
  * Keys written more than once in a file. `{ "a.b": "x", "a": { "b": "y" } }` defines `a.b`
19
- * twice, and i18next only ever reads one of the two values.
62
+ * twice, and i18next only ever reads one of the two values. A key repeated in one JSON object
63
+ * never reaches `data` (the parser keeps the last), so it comes from `duplicateMembers`.
20
64
  */
21
65
  export declare function duplicateKeys(file: LocaleFile): string[];
22
66
  /** Keys whose value is an empty or whitespace-only string, or null. */
23
67
  export declare function emptyValueKeys(file: LocaleFile): string[];
24
- /** Keys that hold a different kind of value in the target than in the source. */
25
- export declare function typeMismatches(source: LocaleObject, target: LocaleObject, prefix?: string): TypeMismatch[];
68
+ /**
69
+ * Keys that hold a different kind of value in the target than in the source. Keys are compared
70
+ * as i18next reads them, so `{ "a.b": "x" }` and `{ "a": { "b": 1 } }` are the same key.
71
+ */
72
+ export declare function typeMismatches(source: LocaleObject, target: LocaleObject): TypeMismatch[];
73
+ /**
74
+ * Translations whose placeholders differ from the source text's: `{{name}}` dropped or
75
+ * misspelled, a `<0>` tag lost, a `$t()` added. A plural form is compared with the same form
76
+ * in the source, or with `_other` when the source language lacks it; `{{count}}` may come and
77
+ * go between plural forms ("One item" / "{{count}} items").
78
+ */
79
+ export declare function placeholderMismatches(source: LocaleObject, target: LocaleObject): PlaceholderMismatch[];
26
80
  /**
27
81
  * For a plural form the source language does not have (Polish `_few` from English), the
28
82
  * source text to translate from: the `_other` form, which i18next treats as the general one.
package/dist/checks.js CHANGED
@@ -1,7 +1,84 @@
1
- import { flattenKeys } from "./keys.js";
1
+ import { filterIgnoredKeys, flattenKeys, getValueByPath, isSorted, leafEntries } from "./keys.js";
2
+ import { localeFilePath, parseLocalePath } from "./locale-path.js";
3
+ import { findPlaceholders, normalizePlaceholder } from "./placeholders.js";
4
+ import { isKeyUsed, usageInNamespace } from "./usage.js";
2
5
  // i18next plural keys: `item_one`, `item_other`, and ordinals like `place_ordinal_two`.
3
6
  const pluralKey = /^(.+?)_(ordinal_)?(zero|one|two|few|many|other)$/;
4
7
  const pluralCategories = ["zero", "one", "two", "few", "many", "other"];
8
+ // Plural categories per locale and cardinal/ordinal type; Intl.PluralRules is slow to build.
9
+ const categoryCache = new Map();
10
+ /** Every issue `health` reports for groups of a source file and its translations. */
11
+ export function healthIssues(groups, { ignoreKeys, locales }, usage) {
12
+ const issues = [];
13
+ const keep = (keys) => filterIgnoredKeys(keys, ignoreKeys);
14
+ for (const group of groups) {
15
+ for (const file of absentLocaleFiles(group, locales)) {
16
+ issues.push({ type: "missing-file", file });
17
+ }
18
+ }
19
+ for (const file of groups.flatMap((group) => [group.source, ...group.targets])) {
20
+ if (!isSorted(file.data)) {
21
+ issues.push({ type: "unsorted", file });
22
+ }
23
+ for (const key of keep(duplicateKeys(file))) {
24
+ issues.push({ type: "duplicate", file, key });
25
+ }
26
+ }
27
+ for (const { source, targets } of groups) {
28
+ const sourceKeys = keep(flattenKeys(source.data));
29
+ for (const key of keep(emptyValueKeys(source))) {
30
+ issues.push({ type: "empty", file: source, key });
31
+ }
32
+ for (const file of targets) {
33
+ const mismatches = typeMismatches(source.data, file.data).filter((mismatch) => keep([mismatch.key]).length > 0);
34
+ // A key with the wrong shape would also show up as missing/extra keys below it; report it once.
35
+ const underMismatch = (key) => mismatches.some((mismatch) => key === mismatch.key || key.startsWith(`${mismatch.key}.`));
36
+ const expected = expectedKeys(sourceKeys, file.locale);
37
+ const present = flattenKeys(file.data);
38
+ for (const mismatch of mismatches) {
39
+ issues.push({ type: "type-mismatch", file, key: mismatch.key, kinds: mismatch });
40
+ }
41
+ for (const key of missingFrom(expected, present, ignoreKeys).filter((key) => !underMismatch(key))) {
42
+ issues.push({ type: "missing", file, key });
43
+ }
44
+ for (const key of keep(extraIn(present, expected, sourceKeys)).filter((key) => !underMismatch(key))) {
45
+ issues.push({ type: "extra", file, key });
46
+ }
47
+ for (const key of keep(emptyValueKeys(file))) {
48
+ issues.push({ type: "empty", file, key });
49
+ }
50
+ for (const { key, ...placeholders } of placeholderMismatches(source.data, file.data)) {
51
+ if (keep([key]).length > 0) {
52
+ issues.push({ type: "placeholder", file, key, placeholders });
53
+ }
54
+ }
55
+ }
56
+ for (const key of unusedKeys(source, ignoreKeys, usage)) {
57
+ issues.push({ type: "unused", file: source, key });
58
+ }
59
+ }
60
+ return issues;
61
+ }
62
+ /**
63
+ * The files a group lacks for the required `locales`, as empty locale files at the path each
64
+ * would have (`locales/de/checkout.json` next to `locales/en/checkout.json`).
65
+ */
66
+ export function absentLocaleFiles({ source, targets }, locales) {
67
+ const present = new Set([source, ...targets].map((file) => file.locale));
68
+ return locales
69
+ .filter((locale) => !present.has(locale))
70
+ .map((locale) => ({
71
+ path: localeFilePath(source.path, locale),
72
+ locale,
73
+ format: source.format,
74
+ data: {}
75
+ }));
76
+ }
77
+ /** Source keys no code or translation reads, judged within the file's own namespace. */
78
+ export function unusedKeys(source, ignoreKeys, usage) {
79
+ const scoped = usageInNamespace(usage, parseLocalePath(source.path)?.namespace);
80
+ return filterIgnoredKeys(flattenKeys(source.data), ignoreKeys).filter((key) => !isKeyUsed(key, scoped));
81
+ }
5
82
  /**
6
83
  * The keys a target locale should contain: the source keys, with plural forms adjusted to
7
84
  * the target language. English `item_one`/`item_other` becomes `item_one`/`item_few`/
@@ -28,15 +105,39 @@ export function expectedKeys(sourceKeys, targetLocale) {
28
105
  }
29
106
  return expected;
30
107
  }
31
- export function missingKeys(sourceKeys, target) {
32
- const present = new Set(flattenKeys(target.data));
33
- return expectedKeys(sourceKeys, target.locale).filter((key) => !present.has(key));
108
+ /**
109
+ * `keys` plus every plural form of the complete plural families among them, so removing
110
+ * English `item_one`/`item_other` also removes Polish `item_few` and `item_many`.
111
+ */
112
+ export function withPluralForms(keys) {
113
+ const available = new Set(keys);
114
+ const result = new Set(keys);
115
+ for (const key of keys) {
116
+ const plural = parsePluralKey(key, available);
117
+ if (plural) {
118
+ for (const category of pluralCategories) {
119
+ result.add(`${plural.stem}${category}`);
120
+ }
121
+ }
122
+ }
123
+ return [...result];
124
+ }
125
+ /** Expected keys the target lacks. Ignore patterns apply to the target's own plural forms too. */
126
+ export function missingKeys(sourceKeys, target, ignoreKeys = []) {
127
+ return missingFrom(expectedKeys(sourceKeys, target.locale), flattenKeys(target.data), ignoreKeys);
34
128
  }
35
129
  /** Keys in the target that the source does not have (allowing for the target's plural forms). */
36
130
  export function extraKeys(sourceKeys, target) {
37
- const expected = new Set(expectedKeys(sourceKeys, target.locale));
131
+ return extraIn(flattenKeys(target.data), expectedKeys(sourceKeys, target.locale), sourceKeys);
132
+ }
133
+ function missingFrom(expected, present, ignoreKeys) {
134
+ const has = new Set(present);
135
+ return filterIgnoredKeys(expected, ignoreKeys).filter((key) => !has.has(key));
136
+ }
137
+ function extraIn(present, expectedKeys, sourceKeys) {
138
+ const expected = new Set(expectedKeys);
38
139
  const available = new Set(sourceKeys);
39
- return flattenKeys(target.data).filter((key) => {
140
+ return present.filter((key) => {
40
141
  if (expected.has(key)) {
41
142
  return false;
42
143
  }
@@ -47,11 +148,12 @@ export function extraKeys(sourceKeys, target) {
47
148
  }
48
149
  /**
49
150
  * Keys written more than once in a file. `{ "a.b": "x", "a": { "b": "y" } }` defines `a.b`
50
- * twice, and i18next only ever reads one of the two values.
151
+ * twice, and i18next only ever reads one of the two values. A key repeated in one JSON object
152
+ * never reaches `data` (the parser keeps the last), so it comes from `duplicateMembers`.
51
153
  */
52
154
  export function duplicateKeys(file) {
53
155
  const seen = new Set();
54
- const duplicates = new Set();
156
+ const duplicates = new Set(file.duplicateMembers);
55
157
  for (const [key] of leafEntries(file.data)) {
56
158
  (seen.has(key) ? duplicates : seen).add(key);
57
159
  }
@@ -63,22 +165,74 @@ export function emptyValueKeys(file) {
63
165
  .filter(([, value]) => value === null || (typeof value === "string" && value.trim() === ""))
64
166
  .map(([key]) => key);
65
167
  }
66
- /** Keys that hold a different kind of value in the target than in the source. */
67
- export function typeMismatches(source, target, prefix = "") {
68
- return Object.entries(source).flatMap(([key, sourceValue]) => {
69
- if (!Object.hasOwn(target, key)) {
70
- return [];
71
- }
72
- const path = prefix ? `${prefix}.${key}` : key;
73
- const targetValue = target[key];
74
- const sourceKind = kindOf(sourceValue);
75
- const targetKind = kindOf(targetValue);
76
- if (sourceKind !== targetKind) {
77
- return [{ key: path, source: sourceKind, target: targetKind }];
78
- }
79
- return sourceKind === "object"
80
- ? typeMismatches(sourceValue, targetValue, path)
81
- : [];
168
+ /**
169
+ * Keys that hold a different kind of value in the target than in the source. Keys are compared
170
+ * as i18next reads them, so `{ "a.b": "x" }` and `{ "a": { "b": 1 } }` are the same key.
171
+ */
172
+ export function typeMismatches(source, target) {
173
+ const found = new Map();
174
+ for (const [key, sourceValue] of leafEntries(source)) {
175
+ const targetValue = getValueByPath(target, key);
176
+ if (targetValue !== undefined) {
177
+ if (kindOf(sourceValue) !== kindOf(targetValue)) {
178
+ found.set(key, { key, source: kindOf(sourceValue), target: kindOf(targetValue) });
179
+ }
180
+ continue;
181
+ }
182
+ // Nested keys in the source where the target holds a single value.
183
+ const segments = key.split(".");
184
+ for (let size = 1; size < segments.length; size += 1) {
185
+ const path = segments.slice(0, size).join(".");
186
+ const above = getValueByPath(target, path);
187
+ if (above !== undefined &&
188
+ kindOf(above) !== "object" &&
189
+ kindOf(getValueByPath(source, path)) === "object") {
190
+ found.set(path, { key: path, source: "object", target: kindOf(above) });
191
+ break;
192
+ }
193
+ }
194
+ }
195
+ return [...found.values()];
196
+ }
197
+ /**
198
+ * Translations whose placeholders differ from the source text's: `{{name}}` dropped or
199
+ * misspelled, a `<0>` tag lost, a `$t()` added. A plural form is compared with the same form
200
+ * in the source, or with `_other` when the source language lacks it; `{{count}}` may come and
201
+ * go between plural forms ("One item" / "{{count}} items").
202
+ */
203
+ export function placeholderMismatches(source, target) {
204
+ const mismatches = [];
205
+ for (const [key, text] of leafEntries(target)) {
206
+ const fallback = pluralFallbackKey(key);
207
+ const sourceText = getValueByPath(source, key) ?? (fallback && getValueByPath(source, fallback));
208
+ if (typeof text !== "string" || text.trim() === "" || typeof sourceText !== "string") {
209
+ continue;
210
+ }
211
+ const plural = fallback !== undefined || pluralKey.test(key);
212
+ const expected = comparablePlaceholders(sourceText, plural);
213
+ const actual = comparablePlaceholders(text, plural);
214
+ const missing = multisetDifference(expected, actual);
215
+ const unexpected = multisetDifference(actual, expected);
216
+ if (missing.length > 0 || unexpected.length > 0) {
217
+ mismatches.push({ key, missing, unexpected });
218
+ }
219
+ }
220
+ return mismatches;
221
+ }
222
+ function comparablePlaceholders(text, plural) {
223
+ return findPlaceholders(text)
224
+ .map(normalizePlaceholder)
225
+ .filter((placeholder) => !(plural && placeholder === "{{count}}"));
226
+ }
227
+ function multisetDifference(from, remove) {
228
+ const left = [...remove];
229
+ return from.filter((item) => {
230
+ const index = left.indexOf(item);
231
+ if (index === -1) {
232
+ return true;
233
+ }
234
+ left.splice(index, 1);
235
+ return false;
82
236
  });
83
237
  }
84
238
  /**
@@ -102,21 +256,21 @@ function parsePluralKey(key, available) {
102
256
  function categoriesFor(locale, ordinal) {
103
257
  const tag = locale.replaceAll("_", "-");
104
258
  const type = ordinal ? "ordinal" : "cardinal";
105
- try {
106
- if (Intl.PluralRules.supportedLocalesOf(tag).length > 0) {
107
- return new Set(new Intl.PluralRules(tag, { type }).resolvedOptions().pluralCategories);
259
+ const cacheKey = `${tag} ${type}`;
260
+ let categories = categoryCache.get(cacheKey);
261
+ if (!categories) {
262
+ categories = new Set(pluralCategories);
263
+ try {
264
+ if (Intl.PluralRules.supportedLocalesOf(tag).length > 0) {
265
+ categories = new Set(new Intl.PluralRules(tag, { type }).resolvedOptions().pluralCategories);
266
+ }
108
267
  }
268
+ catch {
269
+ // Not a valid tag: keep every form.
270
+ }
271
+ categoryCache.set(cacheKey, categories);
109
272
  }
110
- catch {
111
- // Not a valid tag: fall through and keep every form.
112
- }
113
- return new Set(pluralCategories);
114
- }
115
- function leafEntries(value, prefix = "") {
116
- return Object.entries(value).flatMap(([key, child]) => {
117
- const path = prefix ? `${prefix}.${key}` : key;
118
- return kindOf(child) === "object" ? leafEntries(child, path) : [[path, child]];
119
- });
273
+ return categories;
120
274
  }
121
275
  function kindOf(value) {
122
276
  if (value === null) {
@@ -1 +1 @@
1
- {"version":3,"file":"checks.js","sourceRoot":"","sources":["../src/checks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAGrC,wFAAwF;AACxF,MAAM,SAAS,GAAG,kDAAkD,CAAC;AACrE,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AASxE;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,UAAoB,EAAE,YAAoB;IACrE,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;IACtC,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;IACnC,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,cAAc,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;QAE9C,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,QAAQ,CAAC,I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