i18next-cli 1.88.1 → 1.90.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 +104 -12
- package/dist/cjs/cli.js +25 -6
- package/dist/cjs/config.js +13 -12
- package/dist/cjs/extractor/core/extractor.js +1 -3
- package/dist/cjs/extractor/core/translation-manager.js +9 -2
- package/dist/cjs/heuristic-config.js +51 -6
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/init.js +8 -11
- package/dist/cjs/instrumenter/core/instrumenter.js +1372 -218
- package/dist/cjs/instrumenter/core/key-generator.js +20 -9
- package/dist/cjs/instrumenter/core/next-files.js +104 -0
- package/dist/cjs/instrumenter/core/string-detector.js +106 -29
- package/dist/cjs/instrumenter/core/transformer.js +165 -83
- package/dist/cjs/localize/agent-prompt.js +5 -2
- package/dist/cjs/localize/detect.js +3 -11
- package/dist/cjs/localize/localize.js +27 -5
- package/dist/cjs/utils/file-utils.js +48 -0
- package/dist/cjs/utils/jsx-attributes.js +3 -1
- package/dist/esm/cli.js +25 -6
- package/dist/esm/config.js +13 -12
- package/dist/esm/extractor/core/extractor.js +1 -3
- package/dist/esm/extractor/core/translation-manager.js +9 -2
- package/dist/esm/heuristic-config.js +52 -7
- package/dist/esm/index.js +2 -1
- package/dist/esm/init.js +8 -11
- package/dist/esm/instrumenter/core/instrumenter.js +1376 -222
- package/dist/esm/instrumenter/core/key-generator.js +20 -9
- package/dist/esm/instrumenter/core/next-files.js +101 -0
- package/dist/esm/instrumenter/core/string-detector.js +107 -31
- package/dist/esm/instrumenter/core/transformer.js +165 -83
- package/dist/esm/localize/agent-prompt.js +5 -2
- package/dist/esm/localize/detect.js +4 -12
- package/dist/esm/localize/localize.js +27 -5
- package/dist/esm/utils/file-utils.js +49 -2
- package/dist/esm/utils/jsx-attributes.js +3 -1
- package/package.json +1 -1
- package/types/cli.d.ts.map +1 -1
- package/types/config.d.ts.map +1 -1
- package/types/extractor/core/extractor.d.ts.map +1 -1
- package/types/extractor/core/translation-manager.d.ts.map +1 -1
- package/types/heuristic-config.d.ts.map +1 -1
- package/types/index.d.ts +1 -1
- package/types/index.d.ts.map +1 -1
- package/types/init.d.ts.map +1 -1
- package/types/instrumenter/core/instrumenter.d.ts.map +1 -1
- package/types/instrumenter/core/key-generator.d.ts +2 -0
- package/types/instrumenter/core/key-generator.d.ts.map +1 -1
- package/types/instrumenter/core/next-files.d.ts +25 -0
- package/types/instrumenter/core/next-files.d.ts.map +1 -0
- package/types/instrumenter/core/string-detector.d.ts +5 -1
- package/types/instrumenter/core/string-detector.d.ts.map +1 -1
- package/types/instrumenter/core/transformer.d.ts +16 -1
- package/types/instrumenter/core/transformer.d.ts.map +1 -1
- package/types/instrumenter/index.d.ts +1 -1
- package/types/instrumenter/index.d.ts.map +1 -1
- package/types/localize/agent-prompt.d.ts +1 -1
- package/types/localize/agent-prompt.d.ts.map +1 -1
- package/types/localize/detect.d.ts +2 -0
- package/types/localize/detect.d.ts.map +1 -1
- package/types/localize/localize.d.ts.map +1 -1
- package/types/types.d.ts +87 -1
- package/types/types.d.ts.map +1 -1
- package/types/utils/file-utils.d.ts +7 -0
- package/types/utils/file-utils.d.ts.map +1 -1
- package/types/utils/jsx-attributes.d.ts.map +1 -1
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import MagicString from 'magic-string';
|
|
2
2
|
import { generateKeyFromContent } from './key-generator.js';
|
|
3
3
|
|
|
4
|
+
/** The hook a component gets `t` from, and where `useTranslation`/`useT`/`getT` and `Trans` are imported from. */
|
|
5
|
+
function bindingsFor(next) {
|
|
6
|
+
switch (next?.kind) {
|
|
7
|
+
case 'server': return { hook: 'getT', hookModule: next.serverModule, transModule: 'react-i18next/TransWithoutContext', call: args => `await getT(${args})` };
|
|
8
|
+
// its `t` is a prop: no hook; a <Trans> without context works on both sides
|
|
9
|
+
case 'shared':
|
|
10
|
+
case 'unknown': return { hook: 'useT', hookModule: 'next-i18next/client', transModule: 'react-i18next/TransWithoutContext', call: args => `useT(${args})` };
|
|
11
|
+
case 'client': return { hook: 'useT', hookModule: 'next-i18next/client', transModule: 'next-i18next/client', call: args => `useT(${args})` };
|
|
12
|
+
case 'pages': return { hook: 'useTranslation', hookModule: 'next-i18next/pages', transModule: 'next-i18next/pages', call: args => `useTranslation(${args})` };
|
|
13
|
+
default: return { hook: 'useTranslation', hookModule: 'react-i18next', transModule: 'react-i18next', call: args => `useTranslation(${args})` };
|
|
14
|
+
}
|
|
15
|
+
}
|
|
4
16
|
/**
|
|
5
17
|
* Transforms a source file, replacing candidate strings with instrumented code.
|
|
6
18
|
* Also injects useTranslation() hooks into React function components that
|
|
@@ -21,11 +33,18 @@ function transformFile(content, file, candidates, options) {
|
|
|
21
33
|
importAdded: false,
|
|
22
34
|
hookInjected: false
|
|
23
35
|
};
|
|
36
|
+
const bindings = bindingsFor(options.next);
|
|
37
|
+
// A <Trans> in a Server Component has no React context: it takes `t` and `i18n` from getT()
|
|
38
|
+
// (and in a component that Server and Client Components both render, from its props)
|
|
39
|
+
const transProps = ['server', 'shared', 'unknown'].includes(options.next?.kind ?? '') ? ' t={t} i18n={i18n}' : '';
|
|
40
|
+
// <Trans> attributes in the quotes the file's JSX attributes use (`title='…'` or `title="…"`)
|
|
41
|
+
// (a file without quoted attributes: the quotes of its imports)
|
|
42
|
+
const singleQuoted = (single, double) => Math.sign((content.match(single)?.length ?? 0) - (content.match(double)?.length ?? 0));
|
|
43
|
+
const jsxQuote = (singleQuoted(/\s[\w-]+='/g, /\s[\w-]+="/g) || singleQuoted(/\sfrom '/g, /\sfrom "/g)) > 0 ? "'" : '"';
|
|
24
44
|
// Filter high-confidence candidates
|
|
25
45
|
const highConfidenceCandidates = candidates.filter(c => c.confidence >= 0.7);
|
|
26
46
|
// Track which components have transformed candidates
|
|
27
47
|
const transformedComponents = new Set();
|
|
28
|
-
let hasComponentCandidates = false;
|
|
29
48
|
let hasNonComponentCandidates = false;
|
|
30
49
|
let hasTransCandidates = false;
|
|
31
50
|
// ── Language-change site injections ────────────────────────────────────
|
|
@@ -59,7 +78,6 @@ function transformFile(content, file, candidates, options) {
|
|
|
59
78
|
if (site.insideComponent) {
|
|
60
79
|
componentsNeedingI18n.add(site.insideComponent);
|
|
61
80
|
transformedComponents.add(site.insideComponent);
|
|
62
|
-
hasComponentCandidates = true;
|
|
63
81
|
}
|
|
64
82
|
else {
|
|
65
83
|
hasNonComponentCandidates = true;
|
|
@@ -69,6 +87,7 @@ function transformFile(content, file, candidates, options) {
|
|
|
69
87
|
errors.push(`Failed to inject changeLanguage at offset ${site.callStart}: ${err}`);
|
|
70
88
|
}
|
|
71
89
|
}
|
|
90
|
+
const rewrittenHelperCalls = new Map();
|
|
72
91
|
// Apply transformations in reverse order (to maintain correct offsets)
|
|
73
92
|
for (let i = highConfidenceCandidates.length - 1; i >= 0; i--) {
|
|
74
93
|
const candidate = highConfidenceCandidates[i];
|
|
@@ -77,22 +96,27 @@ function transformFile(content, file, candidates, options) {
|
|
|
77
96
|
const useHookStyle = !!candidate.insideComponent;
|
|
78
97
|
const defaultNS = options.config.extract?.defaultNS ?? 'translation';
|
|
79
98
|
const nsForReplacement = (options.namespace && options.namespace !== defaultNS) ? options.namespace : undefined;
|
|
80
|
-
|
|
99
|
+
// <Trans> works in any render code, a helper outside a component too; without React the text stays
|
|
100
|
+
if (candidate.type === 'jsx-mixed' && !options.hasReact)
|
|
101
|
+
continue;
|
|
102
|
+
const replacement = buildReplacement(candidate, key, useHookStyle, nsForReplacement, jsxQuote, transProps);
|
|
81
103
|
if (replacement) {
|
|
82
104
|
s.overwrite(candidate.offset, candidate.endOffset, replacement);
|
|
83
105
|
transformCount++;
|
|
106
|
+
if (candidate.pluralHelper)
|
|
107
|
+
rewrittenHelperCalls.set(candidate.pluralHelper, (rewrittenHelperCalls.get(candidate.pluralHelper) ?? 0) + 1);
|
|
84
108
|
if (candidate.type === 'jsx-mixed') {
|
|
85
109
|
hasTransCandidates = true;
|
|
86
110
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
111
|
+
// jsx-mixed candidates use <Trans>, not t(), so they need neither useTranslation nor i18next (but in a
|
|
112
|
+
// Server Component its `t` and `i18n`)
|
|
113
|
+
if (candidate.type !== 'jsx-mixed' || (transProps && candidate.insideComponent)) {
|
|
114
|
+
if (candidate.insideComponent) {
|
|
90
115
|
transformedComponents.add(candidate.insideComponent);
|
|
91
|
-
hasComponentCandidates = true;
|
|
92
116
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
117
|
+
else {
|
|
118
|
+
hasNonComponentCandidates = true;
|
|
119
|
+
}
|
|
96
120
|
}
|
|
97
121
|
}
|
|
98
122
|
}
|
|
@@ -100,65 +124,86 @@ function transformFile(content, file, candidates, options) {
|
|
|
100
124
|
errors.push(`Failed to transform candidate at offset ${candidate.offset}: ${err}`);
|
|
101
125
|
}
|
|
102
126
|
}
|
|
127
|
+
// A plural helper whose every call became a plural t() is no longer used: its import goes
|
|
128
|
+
for (const helper of options.pluralHelperImports ?? []) {
|
|
129
|
+
const rewritten = rewrittenHelperCalls.get(helper.name) ?? 0;
|
|
130
|
+
if (rewritten > 0 && rewritten === helper.references)
|
|
131
|
+
s.remove(helper.removeStart, helper.removeEnd);
|
|
132
|
+
}
|
|
133
|
+
// A memoized callback that now calls t() must run again when the language changes: `t` joins its dependencies
|
|
134
|
+
for (const hook of options.memoHooks ?? []) {
|
|
135
|
+
const usesT = highConfidenceCandidates.some(c => c.insideComponent && c.type !== 'jsx-mixed' &&
|
|
136
|
+
c.offset >= hook.callbackStart && c.endOffset <= hook.callbackEnd);
|
|
137
|
+
if (usesT && !hook.hasT)
|
|
138
|
+
s.appendLeft(hook.insertAt, hook.hasDeps ? ', t' : 't');
|
|
139
|
+
}
|
|
103
140
|
// Add necessary imports and hooks if any transformations were made
|
|
104
141
|
if (transformCount > 0 || languageChangeCount > 0) {
|
|
105
142
|
const components = options.components || [];
|
|
106
143
|
// Inject useTranslation() hooks into affected React components
|
|
107
144
|
if (options.hasReact && transformedComponents.size > 0) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
145
|
+
const addHookLine = (comp, line) => {
|
|
146
|
+
const indent = comp.expressionBody ? lineIndent(content, comp.bodyStart) + ' ' : detectIndent(content, comp.bodyStart);
|
|
147
|
+
if (comp.expressionBody) {
|
|
148
|
+
// `() => <p>…</p>` becomes `() => { const { t } = useTranslation(); return <p>…</p> }`
|
|
149
|
+
s.prependLeft(comp.bodyStart, `{\n${indent}${line}\n${indent}return `);
|
|
150
|
+
s.appendRight(comp.bodyEnd, `\n${indent.slice(2)}}`);
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
s.appendRight(comp.bodyStart + 1, `\n${indent}${line}`);
|
|
154
|
+
}
|
|
155
|
+
// getT() is awaited: a Server Component becomes async, and `export const metadata = {…}` the function
|
|
156
|
+
// Next.js calls instead, `export async function generateMetadata () { …; return {…} }`
|
|
157
|
+
if (comp.metadataHead) {
|
|
158
|
+
const { start, end, type } = comp.metadataHead;
|
|
159
|
+
// contentOnly: the block that wraps the object starts at `end`, and stays
|
|
160
|
+
s.overwrite(start, end, `async function generateMetadata ()${type ? `: Promise<${type}>` : ''} `, { contentOnly: true });
|
|
161
|
+
}
|
|
162
|
+
else if (options.next?.kind === 'server' && !comp.isAsync && comp.start !== undefined) {
|
|
163
|
+
s.appendLeft(comp.start, 'async ');
|
|
164
|
+
// an async function returns a promise: `(): JSX.Element` becomes `(): Promise<JSX.Element>`
|
|
165
|
+
const type = comp.returnType;
|
|
166
|
+
if (type && !/^Promise\s*</.test(content.slice(type.start, type.end))) {
|
|
167
|
+
s.appendLeft(type.start, 'Promise<');
|
|
168
|
+
s.appendRight(type.end, '>');
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
injections.hookInjected = true;
|
|
172
|
+
};
|
|
173
|
+
// Components in reverse order of bodyStart to avoid offset shifts
|
|
174
|
+
for (const comp of components.filter(c => transformedComponents.has(c.name)).sort((a, b) => b.bodyStart - a.bodyStart)) {
|
|
114
175
|
const defaultNS = options.config.extract?.defaultNS ?? 'translation';
|
|
115
176
|
const nsArg = (options.namespace && options.namespace !== defaultNS) ? `'${options.namespace}'` : '';
|
|
116
|
-
//
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
const
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
if (needsT)
|
|
123
|
-
parts.push('t');
|
|
124
|
-
if (needsI18n)
|
|
125
|
-
parts.push('i18n');
|
|
126
|
-
// Skip if component needs neither t nor i18n
|
|
127
|
-
// (e.g. component only has jsx-mixed / <Trans> candidates)
|
|
128
|
-
if (!needsT && !needsI18n)
|
|
177
|
+
// `t` for its t() calls (and a <Trans> in a Server Component), `i18n` for a language change (and that <Trans>)
|
|
178
|
+
const own = highConfidenceCandidates.filter(c => c.insideComponent === comp.name);
|
|
179
|
+
const needsT = !comp.hasUseTranslation && own.some(c => c.type !== 'jsx-mixed' || transProps);
|
|
180
|
+
const needsI18n = componentsNeedingI18n.has(comp.name) || (!!transProps && !comp.i18nParam && own.some(c => c.type === 'jsx-mixed'));
|
|
181
|
+
const missing = [needsT && 't', needsI18n && !comp.hookPattern?.names.includes('i18n') && 'i18n'].filter(Boolean);
|
|
182
|
+
if (!missing.length)
|
|
129
183
|
continue;
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
// Match `{ t }` or `{ t, ... }` in `const { t } = useTranslation`
|
|
145
|
-
const hookRe = /const\s*\{\s*t\s*\}\s*=\s*useTranslation/;
|
|
146
|
-
const hookMatch = hookRe.exec(bodyText);
|
|
147
|
-
if (hookMatch) {
|
|
148
|
-
const absStart = comp.bodyStart + hookMatch.index;
|
|
149
|
-
const absEnd = absStart + hookMatch[0].length;
|
|
150
|
-
const upgraded = hookMatch[0].replace(/\{\s*t\s*\}/, '{ t, i18n }');
|
|
151
|
-
s.overwrite(absStart, absEnd, upgraded);
|
|
152
|
-
}
|
|
184
|
+
// that call gives `t` only to the code after it: a text before it would read `t` before its declaration
|
|
185
|
+
const before = (offset) => offset < comp.hookPattern.statement;
|
|
186
|
+
const usedBefore = comp.hookPattern && (own.some(c => before(c.offset)) ||
|
|
187
|
+
languageChangeSites.some(site => site.insideComponent === comp.name && before(site.callStart)));
|
|
188
|
+
if (comp.hookPattern && !usedBefore && (comp.hasUseTranslation || !comp.hookPattern.names.includes('t'))) {
|
|
189
|
+
// it calls a translation hook already (`const { i18n } = useT('ns')`): that call gives them, from its
|
|
190
|
+
// namespace (`{ t, i18n }`)
|
|
191
|
+
if (missing.includes('t'))
|
|
192
|
+
s.appendLeft(comp.hookPattern.first, 't, ');
|
|
193
|
+
if (missing.includes('i18n'))
|
|
194
|
+
s.appendRight(comp.hookPattern.last, ', i18n');
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
addHookLine(comp, `const { ${missing.join(', ')} } = ${bindings.call(missing.includes('t') ? nsArg : '')}`);
|
|
153
198
|
}
|
|
154
199
|
}
|
|
155
200
|
}
|
|
156
201
|
// Add import statements
|
|
157
|
-
addImportStatements(s, content,
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
202
|
+
addImportStatements(s, content, [
|
|
203
|
+
// only for a hook injected here: a component with a `t` of its own (a prop) needs none
|
|
204
|
+
...(injections.hookInjected ? [{ name: bindings.hook, module: bindings.hookModule }] : []),
|
|
205
|
+
...(hasTransCandidates && options.hasReact ? [{ name: 'Trans', module: bindings.transModule }] : [])
|
|
206
|
+
], hasNonComponentCandidates || !options.hasReact, options.imports);
|
|
162
207
|
injections.importAdded = true;
|
|
163
208
|
}
|
|
164
209
|
// Warn when i18next.t() is used in React projects (translations may not be loaded yet)
|
|
@@ -190,7 +235,7 @@ function transformFile(content, file, candidates, options) {
|
|
|
190
235
|
* @param useHookStyle - If true, uses t() (from useTranslation hook); otherwise uses i18next.t()
|
|
191
236
|
* @param namespace - Optional namespace (only set when different from defaultNS)
|
|
192
237
|
*/
|
|
193
|
-
function buildReplacement(candidate, key, useHookStyle, namespace) {
|
|
238
|
+
function buildReplacement(candidate, key, useHookStyle, namespace, jsxQuote = '"', transProps = '') {
|
|
194
239
|
const tFunc = useHookStyle ? 't' : 'i18next.t';
|
|
195
240
|
const escapedContent = escapeString(candidate.content);
|
|
196
241
|
// ── Plural form: t('key', { defaultValue_zero: '…', …, count: expr }) ──
|
|
@@ -239,12 +284,10 @@ function buildReplacement(candidate, key, useHookStyle, namespace) {
|
|
|
239
284
|
case 'jsx-text':
|
|
240
285
|
case 'jsx-attribute':
|
|
241
286
|
return `{${tCall}}`;
|
|
242
|
-
case 'jsx-mixed':
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
}
|
|
247
|
-
return candidate.content;
|
|
287
|
+
case 'jsx-mixed': {
|
|
288
|
+
const nsAttr = namespace ? ` ns=${jsxQuote}${namespace}${jsxQuote}` : '';
|
|
289
|
+
return `<Trans i18nKey=${jsxQuote}${key}${jsxQuote}${nsAttr}${transProps}>${candidate.content}</Trans>`;
|
|
290
|
+
}
|
|
248
291
|
case 'template-literal':
|
|
249
292
|
case 'string-literal':
|
|
250
293
|
default:
|
|
@@ -274,6 +317,11 @@ function hasImport(content, moduleName) {
|
|
|
274
317
|
* Detects the indentation level used after an opening brace.
|
|
275
318
|
* Skips blank lines and reads the whitespace of the first line that has actual content.
|
|
276
319
|
*/
|
|
320
|
+
/** The indentation of the line `offset` is on. */
|
|
321
|
+
function lineIndent(content, offset) {
|
|
322
|
+
const lineStart = content.lastIndexOf('\n', offset - 1) + 1;
|
|
323
|
+
return /^[ \t]*/.exec(content.slice(lineStart))[0];
|
|
324
|
+
}
|
|
277
325
|
function detectIndent(content, braceOffset) {
|
|
278
326
|
let searchFrom = braceOffset;
|
|
279
327
|
while (searchFrom < content.length) {
|
|
@@ -296,26 +344,33 @@ function detectIndent(content, braceOffset) {
|
|
|
296
344
|
return ' ';
|
|
297
345
|
}
|
|
298
346
|
/**
|
|
299
|
-
* Adds
|
|
347
|
+
* Adds the import statements the rewrite needs: the named imports `needed` (a hook, `Trans`), each from its module
|
|
348
|
+
* (added to an import of that module the file has), and `i18next` for `i18next.t()`.
|
|
300
349
|
*/
|
|
301
|
-
function addImportStatements(s, content,
|
|
350
|
+
function addImportStatements(s, content, needed, needsI18next, imports) {
|
|
302
351
|
let importStatement = '';
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
if (!
|
|
311
|
-
|
|
352
|
+
const imported = (moduleName) => imports
|
|
353
|
+
? imports.some(i => i.source === moduleName) || new RegExp(`require\\(['"]${moduleName}['"]\\)`).test(content)
|
|
354
|
+
: hasImport(content, moduleName);
|
|
355
|
+
// A name the file imports already, from any module (`useTranslation` re-exported by a shared package)
|
|
356
|
+
const bound = (name) => !!imports?.some(i => i.locals?.includes(name));
|
|
357
|
+
const byModule = new Map();
|
|
358
|
+
for (const { name, module } of needed) {
|
|
359
|
+
if (!bound(name))
|
|
360
|
+
byModule.set(module, [...(byModule.get(module) ?? []), name]);
|
|
361
|
+
}
|
|
362
|
+
for (const [module, names] of byModule) {
|
|
363
|
+
if (!imported(module)) {
|
|
364
|
+
importStatement += `import { ${names.join(', ')} } from '${module}'\n`;
|
|
312
365
|
}
|
|
313
366
|
else {
|
|
314
|
-
//
|
|
315
|
-
|
|
367
|
+
// the module is imported already: augment it with the missing named exports
|
|
368
|
+
const existing = imports?.find(i => i.source === module);
|
|
369
|
+
augmentNamedImport(s, content, module, names, existing?.start ?? 0);
|
|
316
370
|
}
|
|
317
371
|
}
|
|
318
|
-
|
|
372
|
+
// `i18next.t()` needs that name: with the AST, an import of i18next under another name does not count
|
|
373
|
+
if (needsI18next && (imports ? !bound('i18next') : !imported('i18next'))) {
|
|
319
374
|
importStatement += "import i18next from 'i18next'\n";
|
|
320
375
|
}
|
|
321
376
|
if (!importStatement)
|
|
@@ -326,6 +381,25 @@ function addImportStatements(s, content, needs) {
|
|
|
326
381
|
if (content.startsWith('#!')) {
|
|
327
382
|
insertPos = content.indexOf('\n') + 1;
|
|
328
383
|
}
|
|
384
|
+
// and the directives (`'use client'`), which must stay the first statements
|
|
385
|
+
const directives = DIRECTIVES_RE.exec(content.slice(insertPos));
|
|
386
|
+
if (directives) {
|
|
387
|
+
insertPos += directives[0].length;
|
|
388
|
+
if (content[insertPos - 1] !== '\n')
|
|
389
|
+
importStatement = `\n${importStatement}`;
|
|
390
|
+
}
|
|
391
|
+
if (imports) {
|
|
392
|
+
// After the last import declaration's line
|
|
393
|
+
const lastEnd = Math.max(...imports.map(i => i.end), -1);
|
|
394
|
+
if (lastEnd >= 0) {
|
|
395
|
+
const newline = content.indexOf('\n', lastEnd);
|
|
396
|
+
insertPos = newline === -1 ? content.length : newline + 1;
|
|
397
|
+
}
|
|
398
|
+
if (insertPos > 0 && content[insertPos - 1] !== '\n')
|
|
399
|
+
importStatement = `\n${importStatement}`;
|
|
400
|
+
s.appendRight(insertPos, importStatement);
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
329
403
|
// Find the end of the last import statement. Imports may span multiple lines
|
|
330
404
|
// (e.g. `import {\n CCol,\n} from '...'`), so we can't treat each `import`
|
|
331
405
|
// line as a complete statement — we scan to the real end of each declaration.
|
|
@@ -343,6 +417,8 @@ function addImportStatements(s, content, needs) {
|
|
|
343
417
|
importStatement = `\n${importStatement}`;
|
|
344
418
|
s.appendRight(insertPos, importStatement);
|
|
345
419
|
}
|
|
420
|
+
/** The directive prologue: `'use client'`, `'use strict'` and the like, with the comments around them, to the line end. */
|
|
421
|
+
const DIRECTIVES_RE = /^(?:(?:\s|\/\/[^\n]*\n|\/\*[\s\S]*?\*\/)*(['"])use [\w ]+\1;?[^\S\n]*(?:\/\/[^\n]*)?(?:\n|$))+/;
|
|
346
422
|
/**
|
|
347
423
|
* Returns the offset just past the end of the import statement that begins at
|
|
348
424
|
* `start`, handling multi-line imports with `{ ... }` clauses. The statement
|
|
@@ -391,19 +467,25 @@ function findImportStatementEnd(content, start) {
|
|
|
391
467
|
return content.length;
|
|
392
468
|
}
|
|
393
469
|
/**
|
|
394
|
-
* Augments an existing `import { ... } from '
|
|
470
|
+
* Augments an existing `import { ... } from '<module>'` with any missing
|
|
395
471
|
* named exports (e.g. adds `Trans` when only `useTranslation` is imported).
|
|
472
|
+
* A module imported without braces (`import i18n from …`) gets its own import.
|
|
396
473
|
*/
|
|
397
|
-
function
|
|
398
|
-
const
|
|
399
|
-
|
|
474
|
+
function augmentNamedImport(s, content, module, needed, from = 0) {
|
|
475
|
+
const quoted = module.replace(/[.*+?^${}()|[\]\\/]/g, '\\$&');
|
|
476
|
+
const importRegex = new RegExp(`import\\s*\\{([^}]*)\\}\\s*from\\s*['"]${quoted}['"]`, 'g');
|
|
477
|
+
importRegex.lastIndex = from;
|
|
478
|
+
const importMatch = importRegex.exec(content);
|
|
479
|
+
if (!importMatch) {
|
|
480
|
+
s.prependLeft(from, `import { ${needed.join(', ')} } from '${module}'\n`);
|
|
400
481
|
return;
|
|
482
|
+
}
|
|
401
483
|
const existingImports = importMatch[1].split(',').map(x => x.trim()).filter(Boolean);
|
|
402
484
|
const toAdd = needed.filter(n => !existingImports.includes(n));
|
|
403
485
|
if (toAdd.length === 0)
|
|
404
486
|
return;
|
|
405
487
|
const newImports = [...existingImports, ...toAdd].join(', ');
|
|
406
|
-
const newImportStatement = `import { ${newImports} } from '
|
|
488
|
+
const newImportStatement = `import { ${newImports} } from '${module}'`;
|
|
407
489
|
const matchStart = importMatch.index;
|
|
408
490
|
const matchEnd = matchStart + importMatch[0].length;
|
|
409
491
|
s.overwrite(matchStart, matchEnd, newImportStatement);
|
|
@@ -50,8 +50,11 @@ all commands.
|
|
|
50
50
|
for future agent sessions.
|
|
51
51
|
3. Instrument: run \`npx i18next-cli instrument --dry-run\` and review the
|
|
52
52
|
planned changes; then \`npx i18next-cli instrument\` to apply. Inspect the
|
|
53
|
-
git diff carefully
|
|
54
|
-
|
|
53
|
+
git diff carefully and the warnings it prints. In a Next.js app it writes
|
|
54
|
+
next-i18next's calls (await getT() in Server Components, useT() in Client
|
|
55
|
+
Components); texts it left (components that Server and Client Components
|
|
56
|
+
both render, texts outside components) are listed: move them or give the
|
|
57
|
+
component a t prop. If it printed next-i18next setup steps, do them. Commit.
|
|
55
58
|
4. Extract: run \`npx i18next-cli extract\`. Verify the locale JSON files were
|
|
56
59
|
written (check the extract.output path in the config). If the developer
|
|
57
60
|
chose repository files only: translate the extracted keys yourself or
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { access } from 'node:fs/promises';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
|
+
import { readProjectDeps } from '../utils/file-utils.js';
|
|
3
4
|
|
|
4
5
|
async function pathExists(path) {
|
|
5
6
|
try {
|
|
@@ -10,16 +11,6 @@ async function pathExists(path) {
|
|
|
10
11
|
return false;
|
|
11
12
|
}
|
|
12
13
|
}
|
|
13
|
-
async function readPackageDeps() {
|
|
14
|
-
try {
|
|
15
|
-
const content = await readFile(join(process.cwd(), 'package.json'), 'utf-8');
|
|
16
|
-
const packageJson = JSON.parse(content);
|
|
17
|
-
return { ...packageJson.dependencies, ...packageJson.devDependencies };
|
|
18
|
-
}
|
|
19
|
-
catch {
|
|
20
|
-
return {};
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
14
|
/**
|
|
24
15
|
* Detects the project stack relevant to the `localize` orchestrator:
|
|
25
16
|
* frontend framework, i18next presence, an existing i18n init file,
|
|
@@ -32,7 +23,7 @@ async function readPackageDeps() {
|
|
|
32
23
|
* (injected to reuse the instrumenter's implementation)
|
|
33
24
|
*/
|
|
34
25
|
async function detectStack(findInitFile) {
|
|
35
|
-
const deps = await
|
|
26
|
+
const deps = await readProjectDeps();
|
|
36
27
|
const has = (name) => !!deps[name];
|
|
37
28
|
let framework = 'unknown';
|
|
38
29
|
if (has('next'))
|
|
@@ -56,6 +47,7 @@ async function detectStack(findInitFile) {
|
|
|
56
47
|
initFile: await findInitFile(),
|
|
57
48
|
hasAppRouter,
|
|
58
49
|
hasParaglide,
|
|
50
|
+
usesNextI18next: framework === 'next' && (has('next-i18next') || !(has('i18next') || has('react-i18next'))),
|
|
59
51
|
};
|
|
60
52
|
}
|
|
61
53
|
/** File extensions associated with frameworks the instrumenter cannot transform natively. */
|
|
@@ -8,6 +8,7 @@ import { detectConfig } from '../heuristic-config.js';
|
|
|
8
8
|
import { runExtractor } from '../extractor/core/extractor.js';
|
|
9
9
|
import 'node:path';
|
|
10
10
|
import 'jsonc-parser';
|
|
11
|
+
import 'minimatch';
|
|
11
12
|
import 'jiti';
|
|
12
13
|
import '@croct/json5-parser';
|
|
13
14
|
import 'yaml';
|
|
@@ -15,7 +16,7 @@ import 'node:module';
|
|
|
15
16
|
import '@swc/core';
|
|
16
17
|
import { getNestedKeys, getNestedValue } from '../utils/nested-object.js';
|
|
17
18
|
import { runInstrumenter, findExistingI18nInitFile } from '../instrumenter/core/instrumenter.js';
|
|
18
|
-
import '../
|
|
19
|
+
import '../instrumenter/core/string-detector.js';
|
|
19
20
|
import 'magic-string';
|
|
20
21
|
import { maskApiKey, runLocizeSync, LocizeCommandError, runLocizeDownload } from '../locize.js';
|
|
21
22
|
import { openBrowser, promptLocizeCredentials } from '../utils/locize-onboarding.js';
|
|
@@ -133,12 +134,33 @@ function printCompleteness(completeness) {
|
|
|
133
134
|
console.log(styleText(color, ` ${locale}: ${translated}/${total} (${pct}%)`));
|
|
134
135
|
}
|
|
135
136
|
}
|
|
136
|
-
function printEpilogue(config) {
|
|
137
|
+
function printEpilogue(config, nextApp = false) {
|
|
137
138
|
const projectId = config.locize?.projectId || '<your-project-id>';
|
|
138
139
|
console.log(styleText('green', '\n✅ Done. Your app is localized.'));
|
|
139
140
|
console.log(styleText('cyan', '\nYour AI translations come with confidence scores; low-confidence ones are flagged for review in Locize.'));
|
|
140
141
|
console.log('\nOptional — switch to CDN delivery so translation fixes go live without redeploying your app:');
|
|
141
142
|
console.log(styleText('cyan', ' npm install i18next-locize-backend'));
|
|
143
|
+
if (nextApp) {
|
|
144
|
+
// next-i18next takes the backend in its config (and, for the browser, in I18nProvider's `use`: see the docs)
|
|
145
|
+
console.log(styleText('gray', `
|
|
146
|
+
// in your next-i18next config (i18n.config):
|
|
147
|
+
import LocizeBackend from 'i18next-locize-backend'
|
|
148
|
+
|
|
149
|
+
export default defineConfig({
|
|
150
|
+
// ...
|
|
151
|
+
use: [LocizeBackend],
|
|
152
|
+
i18nextOptions: {
|
|
153
|
+
backend: {
|
|
154
|
+
projectId: '${projectId}',
|
|
155
|
+
version: 'latest', // no apiKey in production!
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
})
|
|
159
|
+
`));
|
|
160
|
+
console.log('Docs: https://github.com/i18next/next-i18next#i18next-locize-backend');
|
|
161
|
+
console.log('Your current setup (local translation files) keeps working either way; run `i18next-cli locize-download` in CI to refresh the files.');
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
142
164
|
console.log(styleText('gray', `
|
|
143
165
|
// in your i18n init file:
|
|
144
166
|
import LocizeBackend from 'i18next-locize-backend'
|
|
@@ -263,8 +285,8 @@ async function runLocalize(options = {}, configPath) {
|
|
|
263
285
|
if (!proceed)
|
|
264
286
|
skipInstrument = true;
|
|
265
287
|
}
|
|
266
|
-
if (stack.
|
|
267
|
-
warn(
|
|
288
|
+
if (stack.usesNextI18next) {
|
|
289
|
+
warn('Next.js: instrument writes next-i18next calls, await getT() in Server Components and useT() in Client Components. Review the diff and the texts it lists as left.');
|
|
268
290
|
}
|
|
269
291
|
if (!skipInstrument) {
|
|
270
292
|
const results = await runInstrumenter(config, {
|
|
@@ -465,7 +487,7 @@ async function runLocalize(options = {}, configPath) {
|
|
|
465
487
|
else if (completeness.length > 0) {
|
|
466
488
|
ok('All languages translated and downloaded.');
|
|
467
489
|
}
|
|
468
|
-
printEpilogue(config);
|
|
490
|
+
printEpilogue(config, stack.usesNextI18next);
|
|
469
491
|
}
|
|
470
492
|
|
|
471
493
|
export { runLocalize };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { access, readFile } from 'node:fs/promises';
|
|
2
|
-
import { resolve, normalize, basename, extname } from 'node:path';
|
|
2
|
+
import { resolve, normalize, basename, extname, dirname, relative, sep } from 'node:path';
|
|
3
|
+
import { minimatch } from 'minimatch';
|
|
3
4
|
import { createJiti } from 'jiti';
|
|
4
5
|
import { getTsConfigAliases } from '../config.js';
|
|
5
6
|
import { JsonParser, JsonObjectNode } from '@croct/json5-parser';
|
|
@@ -23,6 +24,52 @@ class ParseTranslationFileError extends Error {
|
|
|
23
24
|
this.name = 'ParseTranslationFileError';
|
|
24
25
|
}
|
|
25
26
|
}
|
|
27
|
+
async function readPackageJson(dir) {
|
|
28
|
+
try {
|
|
29
|
+
return JSON.parse(await readFile(resolve(dir, 'package.json'), 'utf-8'));
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const depsOf = (pkg) => ({ ...pkg?.peerDependencies, ...pkg?.devDependencies, ...pkg?.dependencies });
|
|
36
|
+
/** A workspace root's package globs: npm/yarn `workspaces` (array or `{ packages }`), or `pnpm-workspace.yaml`. */
|
|
37
|
+
async function workspaceGlobs(dir, pkg) {
|
|
38
|
+
const workspaces = pkg?.workspaces;
|
|
39
|
+
if (Array.isArray(workspaces))
|
|
40
|
+
return workspaces;
|
|
41
|
+
if (Array.isArray(workspaces?.packages))
|
|
42
|
+
return workspaces.packages;
|
|
43
|
+
try {
|
|
44
|
+
const packages = yaml.parse(await readFile(resolve(dir, 'pnpm-workspace.yaml'), 'utf-8'))?.packages;
|
|
45
|
+
return Array.isArray(packages) ? packages : [];
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The project's declared packages: `dependencies`, `devDependencies` and `peerDependencies` of the
|
|
53
|
+
* `package.json` in `cwd`, plus, for a package of a workspace (npm/yarn `workspaces` or
|
|
54
|
+
* `pnpm-workspace.yaml`), the ones of the workspace root, where shared packages such as `react` are often
|
|
55
|
+
* declared only once. The nearer package wins; a folder the root's globs do not list gets nothing from it.
|
|
56
|
+
*/
|
|
57
|
+
async function readProjectDeps(cwd = process.cwd()) {
|
|
58
|
+
const own = await readPackageJson(cwd);
|
|
59
|
+
const deps = depsOf(own);
|
|
60
|
+
if (own?.workspaces)
|
|
61
|
+
return deps;
|
|
62
|
+
for (let dir = dirname(resolve(cwd)); dir !== dirname(dir); dir = dirname(dir)) {
|
|
63
|
+
const pkg = await readPackageJson(dir);
|
|
64
|
+
const globs = await workspaceGlobs(dir, pkg);
|
|
65
|
+
if (!globs)
|
|
66
|
+
continue;
|
|
67
|
+
const member = relative(dir, resolve(cwd)).split(sep).join('/');
|
|
68
|
+
const isMember = globs.some(g => !g.startsWith('!') && minimatch(member, g.replace(/^\.\//, '').replace(/\/$/, '')));
|
|
69
|
+
return isMember ? { ...depsOf(pkg), ...deps } : deps;
|
|
70
|
+
}
|
|
71
|
+
return deps;
|
|
72
|
+
}
|
|
26
73
|
/**
|
|
27
74
|
* Resolve an output template (string or function) into an actual path string.
|
|
28
75
|
*
|
|
@@ -226,4 +273,4 @@ function inferFormatFromPath(filePath, defaultFormat = 'json') {
|
|
|
226
273
|
return defaultFormat || 'json';
|
|
227
274
|
}
|
|
228
275
|
|
|
229
|
-
export { ParseTranslationFileError, getNamespaceFromOutputPath, getOutputPath, globToRegex, ignoredNamespaceMatcher, inferFormatFromPath, loadRawJson5Content, loadTranslationFile, serializeTranslationFile };
|
|
276
|
+
export { ParseTranslationFileError, getNamespaceFromOutputPath, getOutputPath, globToRegex, ignoredNamespaceMatcher, inferFormatFromPath, loadRawJson5Content, loadTranslationFile, readProjectDeps, serializeTranslationFile };
|
|
@@ -27,7 +27,9 @@ const translatableAttributes = [
|
|
|
27
27
|
'aria-roledescription', 'aria-valuetext',
|
|
28
28
|
'content', 'description',
|
|
29
29
|
'label', 'placeholder',
|
|
30
|
-
'summary', 'caption', 'title'
|
|
30
|
+
'summary', 'caption', 'title',
|
|
31
|
+
// tooltip libraries (react-tooltip and the like)
|
|
32
|
+
'data-tip', 'data-tooltip', 'data-tooltip-content'
|
|
31
33
|
];
|
|
32
34
|
/**
|
|
33
35
|
* Pre-built Set (lower-cased) for fast membership checks in hot loops.
|
package/package.json
CHANGED
package/types/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAqBnC,QAAA,MAAM,OAAO,SAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAqBnC,QAAA,MAAM,OAAO,SAAgB,CAAA;AAqiB7B,OAAO,EAAE,OAAO,EAAE,CAAA"}
|
package/types/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAc9D;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAE,MAAM,EAAE,oBAAoB,GAAG,oBAAoB,CAEhF;AAgCD;;;;;GAKG;AACH,wBAAsB,UAAU,CAAE,UAAU,CAAC,EAAE,MAAM,EAAE,MAAM,GAAE,MAA4B,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CA+CjI;AAED;;;GAGG;AACH,wBAAsB,YAAY,CAAE,UAAU,CAAC,EAAE,MAAM,EAAE,MAAM,GAAE,MAA4B,GAAG,OAAO,CAAC,oBAAoB,CAAC,CA8B5H;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAc9D;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAE,MAAM,EAAE,oBAAoB,GAAG,oBAAoB,CAEhF;AAgCD;;;;;GAKG;AACH,wBAAsB,UAAU,CAAE,UAAU,CAAC,EAAE,MAAM,EAAE,MAAM,GAAE,MAA4B,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CA+CjI;AAED;;;GAGG;AACH,wBAAsB,YAAY,CAAE,UAAU,CAAC,EAAE,MAAM,EAAE,MAAM,GAAE,MAA4B,GAAG,OAAO,CAAC,oBAAoB,CAAC,CA8B5H;AA0BD;;;GAGG;AACH,wBAAsB,kBAAkB,IAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAyB3E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractor.d.ts","sourceRoot":"","sources":["../../../src/extractor/core/extractor.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAO5G,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAQ/C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,oBAAoB,EAC5B,OAAO,GAAE;IACP,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;CACX,GACL,OAAO,CAAC;IAAE,cAAc,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,iBAAiB,EAAE,CAAA;CAAE,CAAC,CAkFxF;AA4DD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EAAE,EACjB,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,IAAI,CAAC,oBAAoB,EAAE,SAAS,CAAC,EAC7C,MAAM,GAAE,MAA4B,EACpC,UAAU,CAAC,EAAE,MAAM,EAAE,GACpB,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"extractor.d.ts","sourceRoot":"","sources":["../../../src/extractor/core/extractor.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAO5G,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAQ/C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,oBAAoB,EAC5B,OAAO,GAAE;IACP,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;CACX,GACL,OAAO,CAAC;IAAE,cAAc,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,iBAAiB,EAAE,CAAA;CAAE,CAAC,CAkFxF;AA4DD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EAAE,EACjB,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,IAAI,CAAC,oBAAoB,EAAE,SAAS,CAAC,EAC7C,MAAM,GAAE,MAA4B,EACpC,UAAU,CAAC,EAAE,MAAM,EAAE,GACpB,OAAO,CAAC,IAAI,CAAC,CAmKf;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,IAAI,CAAC,oBAAoB,EAAE,SAAS,CAAC,EAC7C,MAAM,GAAE,MAA4B,EACpC,UAAU,CAAC,EAAE,MAAM,EAAE,GACpB,OAAO,CAAC,IAAI,CAAC,CA4Df;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,OAAO,CAAE,MAAM,EAAE,oBAAoB,EAAE,EAAE,uBAA+B,EAAE,GAAE;IAAE,uBAAuB,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAO1K"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translation-manager.d.ts","sourceRoot":"","sources":["../../../src/extractor/core/translation-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"translation-manager.d.ts","sourceRoot":"","sources":["../../../src/extractor/core/translation-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAouC9F;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,EAC/B,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,EACvB,MAAM,EAAE,oBAAoB,EAC5B,EACE,uBAA+B,EAC/B,OAAe,EACf,oBAA4B,EAC5B,MAA4B,EAC5B,YAAiB,EAClB,GAAE;IACD,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,YAAY,EAAE,CAAA;CACzB,GACL,OAAO,CAAC,iBAAiB,EAAE,CAAC,CA2K9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heuristic-config.d.ts","sourceRoot":"","sources":["../src/heuristic-config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"heuristic-config.d.ts","sourceRoot":"","sources":["../src/heuristic-config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAyFtD;;;;;;GAMG;AACH,wBAAsB,YAAY,IAAK,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,GAAG,IAAI,CAAC,CAyDnF"}
|