@menapo/vi18n 0.0.0-stage → 0.1.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/LICENSE +49 -0
- package/README.md +110 -2
- package/dist/apply-Bre-lY9J.js +228 -0
- package/dist/captured-Bj8bO6vd.js +1034 -0
- package/dist/check-D34P-S--.js +1 -0
- package/dist/check-DyrAbv73.js +201 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +41 -0
- package/dist/codec-DuvU2VQy.js +207 -0
- package/dist/collect-Cx4_SKOe.js +13 -0
- package/dist/collisions-CfpZU8e4.js +217 -0
- package/dist/compile-B5Mz6WJm.js +245 -0
- package/dist/compile-Cc97JaW2.js +2502 -0
- package/dist/concurrency-C9UUWuDC.js +96 -0
- package/dist/concurrency-DONL7t4V.js +1 -0
- package/dist/config.d.ts +21 -0
- package/dist/config.js +39 -0
- package/dist/dir-zw6bGMKQ.js +290 -0
- package/dist/duplicates-yuRljQ6h.js +185 -0
- package/dist/engine-B7p40M__.js +531 -0
- package/dist/engine.d.ts +43 -0
- package/dist/engine.js +1241 -0
- package/dist/exclude-Du-Zd_qI.js +26 -0
- package/dist/export-DGsMbcTZ.js +103 -0
- package/dist/extract-Dujlsgnk.js +298 -0
- package/dist/formats-KPIg-08V.js +781 -0
- package/dist/i18next-CrUnKFfh.js +1596 -0
- package/dist/i18next-Rgo-v9l0.js +1 -0
- package/dist/import-Cwdhcywt.js +225 -0
- package/dist/index.d.ts +156 -0
- package/dist/index.js +239 -0
- package/dist/init-BecCTvKi.js +792 -0
- package/dist/library-D5CWvTQs.js +1882 -0
- package/dist/lingui--PcOOYry.js +833 -0
- package/dist/lint.d.ts +105 -0
- package/dist/lint.js +971 -0
- package/dist/load-CQRz4PpM.js +2950 -0
- package/dist/load-gW-oJt1Q.js +747 -0
- package/dist/locales-DX4MOBFE.js +827 -0
- package/dist/lsp-Cq1Nuu-Q.js +31 -0
- package/dist/match-BGr8EXB3.js +89 -0
- package/dist/mcp-Cf0T7qPW.js +28 -0
- package/dist/merge-driver-CpiiSVIc.js +422 -0
- package/dist/messages-Cxa-5tR0.js +166 -0
- package/dist/migrate-CntqvrW4.js +1 -0
- package/dist/migrate-dPgq9uzy.js +1484 -0
- package/dist/openai-CTaMDcl-.js +346 -0
- package/dist/output-DsaHKHEt.js +164 -0
- package/dist/parse.d.ts +62 -0
- package/dist/parse.js +156 -0
- package/dist/pipeline-C7g11THL.js +2031 -0
- package/dist/pipeline-wxS0SApG.js +1 -0
- package/dist/project-Dwx7iPm6.js +381 -0
- package/dist/project-pXipT8iG.js +1046 -0
- package/dist/pseudo-DRv30iN5.js +145 -0
- package/dist/raw-C4Y6vyGY.js +4708 -0
- package/dist/react-intl-CaBVwJ9u.js +519 -0
- package/dist/restore-Btq66Tid.js +175 -0
- package/dist/rewrite-CiTRAICl.js +803 -0
- package/dist/rich-DCUKl5HM.js +97 -0
- package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/run-DYD_VXKy.js +694 -0
- package/dist/runtime-DTMmliT1.js +64 -0
- package/dist/scan-worker.d.ts +62 -0
- package/dist/scan-worker.js +1 -0
- package/dist/scoped-BMYpSthj.js +44 -0
- package/dist/server-BDkykMjb.js +11823 -0
- package/dist/server-qv3mz70d.js +10485 -0
- package/dist/server.d.ts +169 -0
- package/dist/server.js +1234 -0
- package/dist/sitemap-DV3o8QD7.js +159 -0
- package/dist/sources-D19czDSA.js +2242 -0
- package/dist/status-DZArW5aE.js +149 -0
- package/dist/stdio-CVaJfxA7.js +29 -0
- package/dist/stdio-FPOKQAgu.js +95 -0
- package/dist/sync-CcVzger_.js +658 -0
- package/dist/t-DC-c9zE5.js +454 -0
- package/dist/test.d.ts +116 -0
- package/dist/test.js +319 -0
- package/dist/translate-DZR3MkSA.js +299 -0
- package/dist/ts-BaU5yOf0.js +4863 -0
- package/dist/types-CgUCkFU1.d.ts +707 -0
- package/dist/types-D3QGM8XO.js +146 -0
- package/dist/types-DsdWBG0b.d.ts +558 -0
- package/dist/types-DtvQ7UdD.js +1948 -0
- package/dist/types-wSh9fCBY.js +11 -0
- package/dist/units-CQ5Q99RC.js +150 -0
- package/dist/url-CRfCOhUI.js +172 -0
- package/dist/url-CsBkRaJy.js +225 -0
- package/dist/validate-BxpupdAf.js +2615 -0
- package/dist/validate-D6DJepZv.js +365 -0
- package/dist/version-BlyLGlOa.js +28 -0
- package/dist/vite-scan-B_YW4X_a.js +242 -0
- package/dist/vite.d.ts +34 -0
- package/dist/vite.js +7558 -0
- package/dist/vue-i18n-CEMnpv7k.js +651 -0
- package/dist/which-C6PFI1Dm.js +116 -0
- package/dist/worker-84U6uYB3.js +1656 -0
- package/package.json +97 -3
- package/schemas/catalog.json +57 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { C as usableTranslation, S as entryKey } from "./library-D5CWvTQs.js";
|
|
2
|
+
import { r as resolveDuplicates, t as duplicateDiagnostics } from "./duplicates-yuRljQ6h.js";
|
|
3
|
+
import { i as rootRelative } from "./output-DsaHKHEt.js";
|
|
4
|
+
import { createRequire } from "node:module";
|
|
5
|
+
//#region \0rolldown/runtime.js
|
|
6
|
+
var __create = Object.create;
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
10
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
+
var __esmMin = (fn, res, err) => () => {
|
|
13
|
+
if (err) throw err[0];
|
|
14
|
+
try {
|
|
15
|
+
return fn && (res = fn(fn = 0)), res;
|
|
16
|
+
} catch (e) {
|
|
17
|
+
throw err = [e], e;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
|
|
21
|
+
var __exportAll = (all, no_symbols) => {
|
|
22
|
+
let target = {};
|
|
23
|
+
for (var name in all) __defProp(target, name, {
|
|
24
|
+
get: all[name],
|
|
25
|
+
enumerable: true
|
|
26
|
+
});
|
|
27
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
28
|
+
return target;
|
|
29
|
+
};
|
|
30
|
+
var __copyProps = (to, from, except, desc) => {
|
|
31
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
32
|
+
key = keys[i];
|
|
33
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
34
|
+
get: ((k) => from[k]).bind(null, key),
|
|
35
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
return to;
|
|
39
|
+
};
|
|
40
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
41
|
+
value: mod,
|
|
42
|
+
enumerable: true
|
|
43
|
+
}) : target, mod));
|
|
44
|
+
var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
45
|
+
var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/cli/messages.ts
|
|
48
|
+
/**
|
|
49
|
+
* One message across every locale (INTERNALS §2.17): its source, where the
|
|
50
|
+
* code uses it, and each locale's own entry with the state
|
|
51
|
+
* `usableTranslation` gives it. The read model the language server's
|
|
52
|
+
* hovers, diagnostics and definitions and the MCP server's translation tools
|
|
53
|
+
* share, built like `status` and `check` build theirs (a locale's own entry,
|
|
54
|
+
* no fallbacks), so every surface reports one state for one entry.
|
|
55
|
+
*/
|
|
56
|
+
function indexCatalog(project, locale, path, catalog, hash) {
|
|
57
|
+
const { config, codec, layout } = project;
|
|
58
|
+
const file = rootRelative(config.root, path);
|
|
59
|
+
const index = {
|
|
60
|
+
locale,
|
|
61
|
+
path,
|
|
62
|
+
file,
|
|
63
|
+
hash,
|
|
64
|
+
catalog,
|
|
65
|
+
entries: /* @__PURE__ */ new Map(),
|
|
66
|
+
schemeMismatch: false,
|
|
67
|
+
diagnostics: []
|
|
68
|
+
};
|
|
69
|
+
if (catalog === null) return index;
|
|
70
|
+
const resolved = resolveDuplicates(catalog, codec);
|
|
71
|
+
index.diagnostics = duplicateDiagnostics(resolved.duplicates, file);
|
|
72
|
+
for (const entry of resolved.catalog.entries) {
|
|
73
|
+
const key = entryKey(entry, layout, codec);
|
|
74
|
+
if (key !== null && !index.entries.has(key)) index.entries.set(key, entry);
|
|
75
|
+
}
|
|
76
|
+
index.schemeMismatch = layout !== "source" && catalog.header.idScheme !== null && catalog.header.idScheme !== codec.idScheme;
|
|
77
|
+
return index;
|
|
78
|
+
}
|
|
79
|
+
/** Every configured locale's index, the source locale first. */
|
|
80
|
+
function indexCatalogs(project, set) {
|
|
81
|
+
const indexes = /* @__PURE__ */ new Map();
|
|
82
|
+
for (const locale of localeOrder(project)) {
|
|
83
|
+
const loaded = set.get(locale);
|
|
84
|
+
if (loaded === void 0) continue;
|
|
85
|
+
indexes.set(locale, indexCatalog(project, locale, loaded.path, loaded.catalog, loaded.hash));
|
|
86
|
+
}
|
|
87
|
+
return indexes;
|
|
88
|
+
}
|
|
89
|
+
/** The source locale, then the others in config order. */
|
|
90
|
+
function localeOrder(project) {
|
|
91
|
+
const { config } = project;
|
|
92
|
+
return [config.sourceLocale, ...config.locales.filter((l) => l !== config.sourceLocale)];
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* One locale's own entry for a message: the source locale shows the source,
|
|
96
|
+
* a target locale the state `usableTranslation` decides (`scheme-mismatch`
|
|
97
|
+
* and `no-entry` as `ownStatus` decides them).
|
|
98
|
+
*/
|
|
99
|
+
function localeView(project, index, identity) {
|
|
100
|
+
const { config, codec, layout } = project;
|
|
101
|
+
const entry = index.entries.get(identity.id);
|
|
102
|
+
const view = {
|
|
103
|
+
locale: index.locale,
|
|
104
|
+
state: "missing",
|
|
105
|
+
text: null,
|
|
106
|
+
fuzzy: entry?.fuzzy ?? false,
|
|
107
|
+
file: index.file,
|
|
108
|
+
line: entry !== void 0 && entry.line > 0 ? entry.line : null,
|
|
109
|
+
diagnostics: []
|
|
110
|
+
};
|
|
111
|
+
if (index.locale === config.sourceLocale) {
|
|
112
|
+
view.state = "source";
|
|
113
|
+
view.text = identity.canonical;
|
|
114
|
+
return view;
|
|
115
|
+
}
|
|
116
|
+
if (index.schemeMismatch && (layout === "id" || !identity.manual)) {
|
|
117
|
+
view.reason = "scheme-mismatch";
|
|
118
|
+
return view;
|
|
119
|
+
}
|
|
120
|
+
if (entry === void 0) {
|
|
121
|
+
view.reason = "no-entry";
|
|
122
|
+
return view;
|
|
123
|
+
}
|
|
124
|
+
if (entry.translation !== "") view.text = entry.translation;
|
|
125
|
+
const usable = usableTranslation(entry, layout, identity, codec, index.locale);
|
|
126
|
+
if (usable.ok) {
|
|
127
|
+
view.state = entry.state === "ai" ? "ai" : "translated";
|
|
128
|
+
return view;
|
|
129
|
+
}
|
|
130
|
+
view.reason = usable.reason;
|
|
131
|
+
for (const diagnostic of usable.diagnostics) view.diagnostics.push({
|
|
132
|
+
...diagnostic,
|
|
133
|
+
file: index.file
|
|
134
|
+
});
|
|
135
|
+
return view;
|
|
136
|
+
}
|
|
137
|
+
/** A message with every locale's view; `extracted` adds the code's notes and call sites. */
|
|
138
|
+
function messageView(project, indexes, identity, extracted) {
|
|
139
|
+
const { config } = project;
|
|
140
|
+
let contexts = extracted?.contexts.slice() ?? [];
|
|
141
|
+
let maxLength = extracted?.maxLength ?? null;
|
|
142
|
+
if (extracted === void 0) for (const index of indexes.values()) {
|
|
143
|
+
const entry = index.entries.get(identity.id);
|
|
144
|
+
if (entry === void 0) continue;
|
|
145
|
+
contexts = entry.contexts.slice();
|
|
146
|
+
maxLength = entry.maxLength;
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
149
|
+
const locales = [];
|
|
150
|
+
for (const locale of localeOrder(project)) {
|
|
151
|
+
const index = indexes.get(locale);
|
|
152
|
+
if (index !== void 0) locales.push(localeView(project, index, identity));
|
|
153
|
+
}
|
|
154
|
+
return {
|
|
155
|
+
id: identity.id,
|
|
156
|
+
manual: identity.manual,
|
|
157
|
+
source: identity.canonical,
|
|
158
|
+
contexts,
|
|
159
|
+
maxLength,
|
|
160
|
+
keep: config.extraction.keep.includes(identity.id),
|
|
161
|
+
locations: extracted?.locations.map((l) => ({ ...l })) ?? [],
|
|
162
|
+
locales
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
//#endregion
|
|
166
|
+
export { __commonJSMin as a, __require as c, messageView as i, __toCommonJS as l, indexCatalogs as n, __esmMin as o, localeView as r, __exportAll as s, indexCatalog as t, __toESM as u };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { c as migrate } from "./migrate-dPgq9uzy.js";
|