@menapo/vi18n 0.1.0 → 0.1.2
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 +14 -14
- package/dist/{apply-Bre-lY9J.js → apply-FAHl1R6T.js} +69 -89
- package/dist/{captured-Bj8bO6vd.js → captured-CTjjDF5o.js} +196 -217
- package/dist/{check-DyrAbv73.js → check-DwFwOB1d.js} +66 -84
- package/dist/cli.js +2 -3
- package/dist/{collect-Cx4_SKOe.js → collect-CYATDjdo.js} +1 -2
- package/dist/collisions-uMTuq36M.js +215 -0
- package/dist/compile-CEvH-6sY.js +240 -0
- package/dist/{compile-Cc97JaW2.js → compile-DqkofbiO.js} +376 -331
- package/dist/concurrency-BCY_4zcr.js +1 -0
- package/dist/concurrency-Dy2ny50V.js +107 -0
- package/dist/config.d.ts +1 -5
- package/dist/config.js +4 -5
- package/dist/{types-D3QGM8XO.js → diagnostics-1onDF6Ua.js} +26 -26
- package/dist/{dir-zw6bGMKQ.js → dir-TGLYuOZb.js} +34 -37
- package/dist/{duplicates-yuRljQ6h.js → duplicates-CsUXRX2J.js} +10 -27
- package/dist/engine-Bf7nVigL.js +556 -0
- package/dist/engine.d.ts +1 -5
- package/dist/engine.js +297 -168
- package/dist/exchange-DYG9RZoT.js +41 -0
- package/dist/{exclude-Du-Zd_qI.js → exclude-vMnm3lqU.js} +2 -3
- package/dist/{export-DGsMbcTZ.js → export-BYq0gfLd.js} +17 -38
- package/dist/{extract-Dujlsgnk.js → extract-CYtuEo8u.js} +114 -82
- package/dist/{formats-KPIg-08V.js → formats-ChV1LVH_.js} +352 -276
- package/dist/fs-ezCMZeDV.js +52 -0
- package/dist/i18next-1waHziMy.js +1 -0
- package/dist/i18next-D66Icz3L.js +1907 -0
- package/dist/{import-Cwdhcywt.js → import-BApbQlmm.js} +81 -75
- package/dist/index.d.ts +1 -13
- package/dist/index.js +14 -16
- package/dist/{init-BecCTvKi.js → init-J7AwwA5e.js} +466 -501
- package/dist/{library-D5CWvTQs.js → library-BfSOBeBd.js} +975 -451
- package/dist/lingui-Ee2farVo.js +902 -0
- package/dist/lint.d.ts +0 -4
- package/dist/lint.js +69 -82
- package/dist/{load-gW-oJt1Q.js → load-BFLLqY8x.js} +272 -147
- package/dist/{load-CQRz4PpM.js → load-CMwhukZ4.js} +1211 -1115
- package/dist/{locales-DX4MOBFE.js → locales-DxLDrx-h.js} +271 -237
- package/dist/{lsp-Cq1Nuu-Q.js → lsp-BC7xDGON.js} +4 -5
- package/dist/{match-BGr8EXB3.js → match-BLDcj610.js} +11 -4
- package/dist/{mcp-Cf0T7qPW.js → mcp-Cka8ywDF.js} +4 -5
- package/dist/{merge-driver-CpiiSVIc.js → merge-driver-B04Apm29.js} +138 -122
- package/dist/migrate-D7TNl6SD.js +2169 -0
- package/dist/migrate-khCY8TE0.js +1 -0
- package/dist/{openai-CTaMDcl-.js → openai-RWw0YlAx.js} +128 -87
- package/dist/{output-DsaHKHEt.js → output-CF9uvk_-.js} +15 -9
- package/dist/parse.d.ts +1 -3
- package/dist/parse.js +7 -8
- package/dist/{pipeline-wxS0SApG.js → pipeline-B30irGMD.js} +1 -1
- package/dist/{pipeline-C7g11THL.js → pipeline-sgl_q_op.js} +387 -359
- package/dist/project-DSzWKU3C.js +544 -0
- package/dist/{pseudo-DRv30iN5.js → pseudo-DNbNNVGP.js} +125 -3
- package/dist/{raw-C4Y6vyGY.js → raw-YsYZMS9n.js} +52 -29
- package/dist/react-intl-tzGIk6G3.js +634 -0
- package/dist/restore-BG_zMpSj.js +199 -0
- package/dist/rewrite-hAcRJwiZ.js +415 -0
- package/dist/{rich-DCUKl5HM.js → rich-ApY1Dm4S.js} +35 -28
- package/dist/rolldown-runtime-C1I3wEg2.js +43 -0
- package/dist/{rolldown-runtime-D7D4PA-g.js → rolldown-runtime-D8jQpDG7.js} +1 -2
- package/dist/run-CFzR3V93.js +647 -0
- package/dist/scan-worker.d.ts +2 -4
- package/dist/scan-worker.js +1 -1
- package/dist/{scoped-BMYpSthj.js → scoped-h3KE8XWW.js} +3 -4
- package/dist/{server-BDkykMjb.js → server-WlxZH0oX.js} +275 -330
- package/dist/{server-qv3mz70d.js → server-ceuzzkal.js} +292 -386
- package/dist/server.d.ts +1 -17
- package/dist/server.js +415 -381
- package/dist/{sitemap-DV3o8QD7.js → sitemap-796jJKUT.js} +21 -33
- package/dist/{sources-D19czDSA.js → sources-DuOdM02f.js} +712 -373
- package/dist/{status-DZArW5aE.js → status-CTH3qI-0.js} +30 -30
- package/dist/{stdio-FPOKQAgu.js → stdio-D9kTzyqB.js} +2 -4
- package/dist/{stdio-CVaJfxA7.js → stdio-FWIVU3P4.js} +1 -2
- package/dist/sync-CpL0Qsgw.js +1352 -0
- package/dist/{t-DC-c9zE5.js → t-gvEXx25s.js} +76 -53
- package/dist/test.d.ts +5 -16
- package/dist/test.js +77 -48
- package/dist/translate-BrfVRkjl.js +336 -0
- package/dist/{ts-BaU5yOf0.js → ts-BX6kwig5.js} +25 -14
- package/dist/{types-DtvQ7UdD.js → types-3kwyaCAm.js} +1 -2
- package/dist/{types-DsdWBG0b.d.ts → types-BaG1LboH.d.ts} +2 -6
- package/dist/{types-CgUCkFU1.d.ts → types-Cy2bPdSg.d.ts} +14 -20
- package/dist/types-Ds_vebja.js +41 -0
- package/dist/{units-CQ5Q99RC.js → units-VVLgQ7x7.js} +7 -16
- package/dist/{url-CRfCOhUI.js → url-Bpc6wLea.js} +24 -11
- package/dist/{url-CsBkRaJy.js → url-D2_VlEeH.js} +25 -12
- package/dist/{validate-D6DJepZv.js → validate-PGgMsasz.js} +3 -5
- package/dist/{validate-BxpupdAf.js → validate-zv4-IZyZ.js} +690 -377
- package/dist/{version-BlyLGlOa.js → version-BFs370Ce.js} +3 -5
- package/dist/{vite-scan-B_YW4X_a.js → vite-scan-DFKSGVE9.js} +87 -92
- package/dist/vite.d.ts +2 -6
- package/dist/vite.js +6482 -6018
- package/dist/vue-i18n-CBmZqHbG.js +806 -0
- package/dist/{which-C6PFI1Dm.js → which-BpyJyBkX.js} +44 -37
- package/dist/{worker-84U6uYB3.js → worker-BjzVqJVO.js} +454 -608
- package/package.json +8 -8
- package/dist/check-D34P-S--.js +0 -1
- package/dist/codec-DuvU2VQy.js +0 -207
- package/dist/collisions-CfpZU8e4.js +0 -217
- package/dist/compile-B5Mz6WJm.js +0 -245
- package/dist/concurrency-C9UUWuDC.js +0 -96
- package/dist/concurrency-DONL7t4V.js +0 -1
- package/dist/engine-B7p40M__.js +0 -531
- package/dist/i18next-CrUnKFfh.js +0 -1596
- package/dist/i18next-Rgo-v9l0.js +0 -1
- package/dist/lingui--PcOOYry.js +0 -833
- package/dist/messages-Cxa-5tR0.js +0 -166
- package/dist/migrate-CntqvrW4.js +0 -1
- package/dist/migrate-dPgq9uzy.js +0 -1484
- package/dist/project-Dwx7iPm6.js +0 -381
- package/dist/project-pXipT8iG.js +0 -1046
- package/dist/react-intl-CaBVwJ9u.js +0 -519
- package/dist/restore-Btq66Tid.js +0 -175
- package/dist/rewrite-CiTRAICl.js +0 -803
- package/dist/run-DYD_VXKy.js +0 -694
- package/dist/runtime-DTMmliT1.js +0 -64
- package/dist/sync-CcVzger_.js +0 -658
- package/dist/translate-DZR3MkSA.js +0 -299
- package/dist/types-wSh9fCBY.js +0 -11
- package/dist/vue-i18n-CEMnpv7k.js +0 -651
package/README.md
CHANGED
|
@@ -74,20 +74,20 @@ Requires Vite 8.3 or a later 8.x and Node 22.18 or newer.
|
|
|
74
74
|
|
|
75
75
|
## Documentation
|
|
76
76
|
|
|
77
|
-
- [Getting started](https://github.com/menapo/
|
|
78
|
-
- [Writing messages](https://github.com/menapo/
|
|
79
|
-
- [Catalogs and the CLI](https://github.com/menapo/
|
|
80
|
-
- [Configuration reference](https://github.com/menapo/
|
|
81
|
-
- [Localized paths, domains and sitemaps](https://github.com/menapo/
|
|
82
|
-
- [Linting](https://github.com/menapo/
|
|
83
|
-
- [Testing](https://github.com/menapo/
|
|
84
|
-
- Recipes: [SPAs](https://github.com/menapo/
|
|
85
|
-
- [Deploying: cache headers per host](https://github.com/menapo/
|
|
86
|
-
- [Migrating from i18next, react-intl, Lingui or vue-i18n](https://github.com/menapo/
|
|
87
|
-
- Design: [PLAN.md](https://github.com/menapo/
|
|
77
|
+
- [Getting started](https://github.com/menapo/kit/blob/main/packages/vi18n/docs/guide/getting-started.md)
|
|
78
|
+
- [Writing messages](https://github.com/menapo/kit/blob/main/packages/vi18n/docs/guide/messages.md): `t`, ICU, `msg`, rich text, `fmt`, the locale API
|
|
79
|
+
- [Catalogs and the CLI](https://github.com/menapo/kit/blob/main/packages/vi18n/docs/guide/catalogs-and-cli.md): `extract`, `check`, `status`, `compile`, `translate`, `export` / `import`, `restore`, `which`, the git merge driver
|
|
80
|
+
- [Configuration reference](https://github.com/menapo/kit/blob/main/packages/vi18n/docs/guide/configuration.md)
|
|
81
|
+
- [Localized paths, domains and sitemaps](https://github.com/menapo/kit/blob/main/packages/vi18n/docs/guide/localized-urls.md)
|
|
82
|
+
- [Linting](https://github.com/menapo/kit/blob/main/packages/vi18n/docs/guide/lint.md): the `@menapo/vi18n/lint` rules
|
|
83
|
+
- [Testing](https://github.com/menapo/kit/blob/main/packages/vi18n/docs/guide/testing.md): `@menapo/vi18n/test` · [Web Workers](https://github.com/menapo/kit/blob/main/packages/vi18n/docs/guide/workers.md) · [Libraries](https://github.com/menapo/kit/blob/main/packages/vi18n/docs/guide/libraries.md)
|
|
84
|
+
- Recipes: [SPAs](https://github.com/menapo/kit/blob/main/packages/vi18n/docs/guide/recipes/spa.md) (React, Preact, Vue, Svelte, Solid, plain JS) · [SvelteKit](https://github.com/menapo/kit/blob/main/packages/vi18n/docs/guide/recipes/sveltekit.md) · [Astro](https://github.com/menapo/kit/blob/main/packages/vi18n/docs/guide/recipes/astro.md) · [TanStack Start](https://github.com/menapo/kit/blob/main/packages/vi18n/docs/guide/recipes/tanstack-start.md) · [React Router](https://github.com/menapo/kit/blob/main/packages/vi18n/docs/guide/recipes/react-router.md) · [Nuxt](https://github.com/menapo/kit/blob/main/packages/vi18n/docs/guide/recipes/nuxt.md) · [SolidStart](https://github.com/menapo/kit/blob/main/packages/vi18n/docs/guide/recipes/solid-start.md) · [Hono and Workers](https://github.com/menapo/kit/blob/main/packages/vi18n/docs/guide/recipes/hono-workers.md)
|
|
85
|
+
- [Deploying: cache headers per host](https://github.com/menapo/kit/blob/main/packages/vi18n/docs/guide/deploy.md) · [Content Security Policy](https://github.com/menapo/kit/blob/main/packages/vi18n/docs/guide/csp.md)
|
|
86
|
+
- [Migrating from i18next, react-intl, Lingui or vue-i18n](https://github.com/menapo/kit/blob/main/packages/vi18n/docs/guide/migrate-from-libraries.md) · [from `@saas/i18n`](https://github.com/menapo/kit/blob/main/packages/vi18n/docs/guide/migrate-from-saas-i18n.md)
|
|
87
|
+
- Design: [PLAN.md](https://github.com/menapo/kit/blob/main/packages/vi18n/docs/PLAN.md)
|
|
88
88
|
|
|
89
89
|
The same pages, with the benchmarks, build as a site from
|
|
90
|
-
[`site/`](https://github.com/menapo/
|
|
90
|
+
[`site/`](https://github.com/menapo/kit/tree/main/site) in the
|
|
91
91
|
repository; `vp run --filter @menapo/site dev` serves it locally.
|
|
92
92
|
|
|
93
93
|
## Entry points
|
|
@@ -99,8 +99,8 @@ repository; `vp run --filter @menapo/site dev` serves it locally.
|
|
|
99
99
|
| `@menapo/vi18n/parse` | Text that is not in your code (a CMS, a database): `parse`, `format`, `onParseError`, for ICU and MessageFormat 2 |
|
|
100
100
|
| `@menapo/vi18n/vite` | The `vi18n()` plugin, and `vi18nTransform()` for Rollup/Rolldown pipelines |
|
|
101
101
|
| `@menapo/vi18n/config` | `defineConfig`, build-time `localizedPaths` and the `openaiCompatible` provider for `vi18n.config.ts` |
|
|
102
|
-
| `@menapo/vi18n/lint` | Lint rules for `vp check`, oxlint or ESLint: untranslated text, dynamic messages, ICU errors with fixes ([guide](https://github.com/menapo/
|
|
103
|
-
| `@menapo/vi18n/test` | Tests in another locale: `createTestI18n`, `loadCatalog`, `setPseudoLocale`, `scanPseudo` ([guide](https://github.com/menapo/
|
|
102
|
+
| `@menapo/vi18n/lint` | Lint rules for `vp check`, oxlint or ESLint: untranslated text, dynamic messages, ICU errors with fixes ([guide](https://github.com/menapo/kit/blob/main/packages/vi18n/docs/guide/lint.md)) |
|
|
103
|
+
| `@menapo/vi18n/test` | Tests in another locale: `createTestI18n`, `loadCatalog`, `setPseudoLocale`, `scanPseudo` ([guide](https://github.com/menapo/kit/blob/main/packages/vi18n/docs/guide/testing.md)) |
|
|
104
104
|
| `vi18n` | The CLI: `init`, `extract`, `check`, `status`, `compile`, `translate`, `migrate`, `sitemap`, `export`, `import`, `restore`, `which`, `merge-driver`, `lsp`, `mcp` |
|
|
105
105
|
|
|
106
106
|
There is no per-framework package: the plugin generates the little glue a
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { r as
|
|
5
|
-
|
|
6
|
-
//#region src/core/exchange/apply.ts
|
|
1
|
+
import { r as resolveDuplicates } from "./duplicates-CsUXRX2J.js";
|
|
2
|
+
import { E as entryKey, j as withSubject, k as translationErrors } from "./library-BfSOBeBd.js";
|
|
3
|
+
import { h as isManualId, p as tryCanonicalize } from "./validate-zv4-IZyZ.js";
|
|
4
|
+
import { r as entrySource } from "./units-VVLgQ7x7.js";
|
|
5
|
+
// src/core/exchange/apply.ts
|
|
7
6
|
/**
|
|
8
7
|
* Applying imported rows and restored entries to a catalog (PLAN §4.3, §4.4,
|
|
9
8
|
* §5.19). Both are pure functions of the catalog they receive, so writers
|
|
@@ -24,29 +23,67 @@ function keyIndex(catalog, codec) {
|
|
|
24
23
|
});
|
|
25
24
|
return index;
|
|
26
25
|
}
|
|
27
|
-
/** The
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
26
|
+
/** The first entry per key after the read-side duplicate pick: what "the current translation" is. */
|
|
27
|
+
function currentEntries(catalog, codec) {
|
|
28
|
+
const current = /* @__PURE__ */ new Map();
|
|
29
|
+
for (const entry of resolveDuplicates(catalog, codec).catalog.entries) {
|
|
30
|
+
const key = entryKey(entry, catalog.layout, codec);
|
|
31
|
+
if (key !== null && !current.has(key)) current.set(key, entry);
|
|
32
|
+
}
|
|
33
|
+
return current;
|
|
34
|
+
}
|
|
35
|
+
/** The entry a row translates, and the canonical source that translation must fit; or why there is none. */
|
|
36
|
+
function matchRecord(record, current, context) {
|
|
37
|
+
const { codec } = context;
|
|
38
|
+
if (record.unsupported !== void 0) return {
|
|
39
|
+
skip: "unsupported",
|
|
40
|
+
id: record.key
|
|
41
|
+
};
|
|
42
|
+
let key = record.key;
|
|
43
|
+
let recordCanonical = null;
|
|
44
|
+
if (record.source !== null) {
|
|
45
|
+
recordCanonical = tryCanonicalize(codec, record.source);
|
|
46
|
+
if (recordCanonical === null) return {
|
|
47
|
+
skip: key === null ? "unknown" : "source-changed",
|
|
48
|
+
id: key
|
|
49
|
+
};
|
|
50
|
+
key ??= codec.label(recordCanonical);
|
|
38
51
|
}
|
|
52
|
+
const entry = key === null ? void 0 : current.get(key);
|
|
53
|
+
if (key === null || entry === void 0) return {
|
|
54
|
+
skip: "unknown",
|
|
55
|
+
id: key
|
|
56
|
+
};
|
|
57
|
+
const source = entrySource(entry, key, context);
|
|
58
|
+
if (source === null) return {
|
|
59
|
+
skip: "no-source",
|
|
60
|
+
id: key
|
|
61
|
+
};
|
|
62
|
+
if (recordCanonical !== null) {
|
|
63
|
+
if (!(context.layout === "id" ? codec.label(recordCanonical) === source.label : recordCanonical === source.canonical)) return {
|
|
64
|
+
skip: "source-changed",
|
|
65
|
+
id: key
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
if (record.label !== null && record.label !== source.label) return {
|
|
69
|
+
skip: "source-changed",
|
|
70
|
+
id: key
|
|
71
|
+
};
|
|
72
|
+
if (recordCanonical === null && record.label === null && isManualId(key)) return {
|
|
73
|
+
skip: "no-source",
|
|
74
|
+
id: key
|
|
75
|
+
};
|
|
76
|
+
return {
|
|
77
|
+
key,
|
|
78
|
+
entry,
|
|
79
|
+
canonical: source.canonical
|
|
80
|
+
};
|
|
39
81
|
}
|
|
40
82
|
function applyImport(input) {
|
|
41
83
|
const { catalog, records, context, locale } = input;
|
|
42
84
|
const { codec } = context;
|
|
43
85
|
const index = keyIndex(catalog, codec);
|
|
44
|
-
const
|
|
45
|
-
const current = /* @__PURE__ */ new Map();
|
|
46
|
-
for (const entry of resolved.entries) {
|
|
47
|
-
const key = entryKey(entry, catalog.layout, codec);
|
|
48
|
-
if (key !== null && !current.has(key)) current.set(key, entry);
|
|
49
|
-
}
|
|
86
|
+
const current = currentEntries(catalog, codec);
|
|
50
87
|
const outcome = {
|
|
51
88
|
catalog,
|
|
52
89
|
changed: [],
|
|
@@ -65,50 +102,14 @@ function applyImport(input) {
|
|
|
65
102
|
});
|
|
66
103
|
};
|
|
67
104
|
for (const record of records) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
let key = record.key;
|
|
73
|
-
let recordCanonical = null;
|
|
74
|
-
if (record.source !== null) {
|
|
75
|
-
recordCanonical = canonicalOrNull(record.source, codec);
|
|
76
|
-
if (recordCanonical === null) {
|
|
77
|
-
skip(record, key === null ? "unknown" : "source-changed", key);
|
|
78
|
-
continue;
|
|
79
|
-
}
|
|
80
|
-
key ??= codec.label(recordCanonical);
|
|
81
|
-
}
|
|
82
|
-
const entry = key === null ? void 0 : current.get(key);
|
|
83
|
-
if (key === null || entry === void 0) {
|
|
84
|
-
skip(record, "unknown", key);
|
|
85
|
-
continue;
|
|
86
|
-
}
|
|
87
|
-
const source = entrySource(entry, key, context);
|
|
88
|
-
if (source === null) {
|
|
89
|
-
skip(record, "no-source", key);
|
|
90
|
-
continue;
|
|
91
|
-
}
|
|
92
|
-
if (recordCanonical !== null) {
|
|
93
|
-
if (!(context.layout === "id" ? codec.label(recordCanonical) === source.label : recordCanonical === source.canonical)) {
|
|
94
|
-
skip(record, "source-changed", key);
|
|
95
|
-
continue;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
if (record.label !== null && record.label !== source.label) {
|
|
99
|
-
skip(record, "source-changed", key);
|
|
100
|
-
continue;
|
|
101
|
-
}
|
|
102
|
-
if (recordCanonical === null && record.label === null && isManualId(key)) {
|
|
103
|
-
skip(record, "no-source", key);
|
|
104
|
-
continue;
|
|
105
|
-
}
|
|
106
|
-
if (record.translation === "") {
|
|
107
|
-
skip(record, "empty", key);
|
|
105
|
+
const match = matchRecord(record, current, context);
|
|
106
|
+
if ("skip" in match) {
|
|
107
|
+
skip(record, match.skip, match.id);
|
|
108
108
|
continue;
|
|
109
109
|
}
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
const { key, entry } = match;
|
|
111
|
+
if (record.translation === "" || record.draft) {
|
|
112
|
+
skip(record, record.translation === "" ? "empty" : "draft", key);
|
|
112
113
|
continue;
|
|
113
114
|
}
|
|
114
115
|
const earlier = taken.get(key);
|
|
@@ -117,20 +118,10 @@ function applyImport(input) {
|
|
|
117
118
|
continue;
|
|
118
119
|
}
|
|
119
120
|
taken.set(key, record.translation);
|
|
120
|
-
const errors = translationErrors(record.translation,
|
|
121
|
+
const errors = translationErrors(record.translation, match.canonical, codec, locale);
|
|
121
122
|
if (errors.length > 0) {
|
|
122
123
|
skip(record, "invalid", key);
|
|
123
|
-
|
|
124
|
-
const located = {
|
|
125
|
-
...diagnostic,
|
|
126
|
-
locale,
|
|
127
|
-
id: key
|
|
128
|
-
};
|
|
129
|
-
delete located.column;
|
|
130
|
-
if (record.line > 0) located.line = record.line;
|
|
131
|
-
else delete located.line;
|
|
132
|
-
outcome.diagnostics.push(located);
|
|
133
|
-
}
|
|
124
|
+
outcome.diagnostics.push(...errors.map((d) => withSubject(d, locale, key, record.line)));
|
|
134
125
|
continue;
|
|
135
126
|
}
|
|
136
127
|
const state = record.state ?? (entry.translation === record.translation ? entry.state : "translated");
|
|
@@ -193,17 +184,7 @@ function applyRestore(input) {
|
|
|
193
184
|
if (found === void 0) return;
|
|
194
185
|
const errors = translationErrors(found.translation, source.canonical, codec, locale);
|
|
195
186
|
if (errors.length > 0) {
|
|
196
|
-
|
|
197
|
-
const located = {
|
|
198
|
-
...diagnostic,
|
|
199
|
-
locale,
|
|
200
|
-
id: key
|
|
201
|
-
};
|
|
202
|
-
delete located.column;
|
|
203
|
-
if (entry.line > 0) located.line = entry.line;
|
|
204
|
-
else delete located.line;
|
|
205
|
-
outcome.diagnostics.push(located);
|
|
206
|
-
}
|
|
187
|
+
outcome.diagnostics.push(...errors.map((d) => withSubject(d, locale, key, entry.line)));
|
|
207
188
|
return;
|
|
208
189
|
}
|
|
209
190
|
entries ??= catalog.entries.slice();
|
|
@@ -224,5 +205,4 @@ function applyRestore(input) {
|
|
|
224
205
|
};
|
|
225
206
|
return outcome;
|
|
226
207
|
}
|
|
227
|
-
//#endregion
|
|
228
208
|
export { applyRestore as n, applyImport as t };
|