@lingual/i18n-check 0.7.5 → 0.8.1
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/dist/bin/index.js +22 -9
- package/dist/bin/index.test.js +200 -93
- package/dist/errorReporters.d.ts +7 -4
- package/dist/errorReporters.js +48 -4
- package/dist/index.js +24 -2
- package/dist/utils/findInvalidTranslations.d.ts +4 -1
- package/dist/utils/findInvalidTranslations.js +94 -4
- package/dist/utils/findInvalidTranslations.test.js +26 -8
- package/dist/utils/findInvalidi18nTranslations.js +90 -3
- package/dist/utils/findInvalidi18nTranslations.test.js +80 -11
- package/dist/utils/nextIntlSrcParser.d.ts +2 -0
- package/dist/utils/nextIntlSrcParser.js +38 -7
- package/dist/utils/nextIntlSrcParser.test.js +146 -118
- package/package.json +1 -1
package/dist/bin/index.js
CHANGED
|
@@ -23,7 +23,7 @@ commander_1.program
|
|
|
23
23
|
.option("-o, --only <only...>", "define the specific checks you want to run: invalidKeys, missingKeys, unused, undefined. By default the check will validate against missing and invalid keys, i.e. --only invalidKeys,missingKeys")
|
|
24
24
|
.option("-r, --reporter <style>", "define the reporting style: standard or summary")
|
|
25
25
|
.option("-e, --exclude <exclude...>", "define the file(s) and/or folders(s) that should be excluded from the check")
|
|
26
|
-
.option("-u, --unused <
|
|
26
|
+
.option("-u, --unused <paths...>", "define the source path(s) to find all unused and undefined keys")
|
|
27
27
|
.option("--parser-component-functions <components...>", "a list of component names to parse when using the --unused option")
|
|
28
28
|
.parse();
|
|
29
29
|
const getCheckOptions = () => {
|
|
@@ -157,7 +157,11 @@ const main = async () => {
|
|
|
157
157
|
const result = (0, __1.checkTranslations)(srcFiles, targetFiles, options);
|
|
158
158
|
printTranslationResult(result);
|
|
159
159
|
if (unusedSrcPath) {
|
|
160
|
-
const
|
|
160
|
+
const isMultiUnusedFolders = unusedSrcPath.length > 1;
|
|
161
|
+
const pattern = isMultiUnusedFolders
|
|
162
|
+
? `{${unusedSrcPath.join(",").trim()}}/**/*.{ts,tsx}`
|
|
163
|
+
: `${unusedSrcPath.join(",").trim()}/**/*.{ts,tsx}`;
|
|
164
|
+
const filesToParse = (0, glob_1.globSync)(pattern, {
|
|
161
165
|
ignore: ["node_modules/**"],
|
|
162
166
|
});
|
|
163
167
|
const unusedKeys = await (0, __1.checkUnusedKeys)(srcFiles, filesToParse, options, componentFunctions);
|
|
@@ -203,7 +207,7 @@ const printTranslationResult = ({ missingKeys, invalidKeys, }) => {
|
|
|
203
207
|
console.log(chalk_1.default.red((0, errorReporters_1.summaryReporter)(getSummaryRows(invalidKeys))));
|
|
204
208
|
}
|
|
205
209
|
else {
|
|
206
|
-
console.log(chalk_1.default.red((0, errorReporters_1.standardReporter)(getStandardRows(invalidKeys))));
|
|
210
|
+
console.log(chalk_1.default.red((0, errorReporters_1.standardReporter)(getStandardRows(invalidKeys), true)));
|
|
207
211
|
}
|
|
208
212
|
}
|
|
209
213
|
else if (invalidKeys) {
|
|
@@ -242,7 +246,7 @@ const printUndefinedKeysResult = ({ undefinedKeys, }) => {
|
|
|
242
246
|
console.log(chalk_1.default.green("\nNo undefined keys found!"));
|
|
243
247
|
}
|
|
244
248
|
};
|
|
245
|
-
const truncate = (chars) => chars.length > 80 ? `${chars.substring(0,
|
|
249
|
+
const truncate = (chars, len = 80) => chars.length > 80 ? `${chars.substring(0, len)}...` : chars;
|
|
246
250
|
const getSummaryRows = (checkResult) => {
|
|
247
251
|
const formattedRows = [];
|
|
248
252
|
for (const [file, keys] of Object.entries(checkResult)) {
|
|
@@ -256,11 +260,20 @@ const getSummaryRows = (checkResult) => {
|
|
|
256
260
|
const getStandardRows = (checkResult) => {
|
|
257
261
|
const formattedRows = [];
|
|
258
262
|
for (const [file, keys] of Object.entries(checkResult)) {
|
|
259
|
-
for (const
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
263
|
+
for (const entry of keys) {
|
|
264
|
+
if (typeof entry === "object") {
|
|
265
|
+
formattedRows.push({
|
|
266
|
+
file: truncate(file),
|
|
267
|
+
key: truncate(entry.key),
|
|
268
|
+
msg: truncate(entry.msg, 120),
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
formattedRows.push({
|
|
273
|
+
file: truncate(file),
|
|
274
|
+
key: truncate(entry),
|
|
275
|
+
});
|
|
276
|
+
}
|
|
264
277
|
}
|
|
265
278
|
}
|
|
266
279
|
return formattedRows;
|
package/dist/bin/index.test.js
CHANGED
|
@@ -37,11 +37,13 @@ Found missing keys!
|
|
|
37
37
|
└───────────────────────────────────────────────┴───────────────────────┘
|
|
38
38
|
|
|
39
39
|
Found invalid keys!
|
|
40
|
-
|
|
41
|
-
│
|
|
42
|
-
|
|
43
|
-
│ translations/folderExample/de-DE/index.json
|
|
44
|
-
|
|
40
|
+
┌────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
|
41
|
+
│ info │ result │
|
|
42
|
+
├────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
|
|
43
|
+
│ file │ translations/folderExample/de-DE/index.json │
|
|
44
|
+
│ key │ message.select │
|
|
45
|
+
│ msg │ Expected element of type "select" but received "argument", Unexpected date element, Unexpected date element... │
|
|
46
|
+
└────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
|
45
47
|
|
|
46
48
|
`);
|
|
47
49
|
done();
|
|
@@ -62,12 +64,17 @@ Found missing keys!
|
|
|
62
64
|
└──────────────────────────────────────────────────────────┴───────────────────────┘
|
|
63
65
|
|
|
64
66
|
Found invalid keys!
|
|
65
|
-
|
|
66
|
-
│
|
|
67
|
-
|
|
68
|
-
│ translations/multipleFilesFolderExample/de-DE/one.json
|
|
69
|
-
│
|
|
70
|
-
|
|
67
|
+
┌────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
|
68
|
+
│ info │ result │
|
|
69
|
+
├────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
|
|
70
|
+
│ file │ translations/multipleFilesFolderExample/de-DE/one.json │
|
|
71
|
+
│ key │ message.select │
|
|
72
|
+
│ msg │ Expected element of type "select" but received "argument", Unexpected date element, Unexpected date element... │
|
|
73
|
+
├────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
|
|
74
|
+
│ file │ translations/multipleFilesFolderExample/de-DE/three.json │
|
|
75
|
+
│ key │ multipleVariables │
|
|
76
|
+
│ msg │ Expected argument to contain "user" but received "name" │
|
|
77
|
+
└────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
|
71
78
|
|
|
72
79
|
`);
|
|
73
80
|
done();
|
|
@@ -90,14 +97,25 @@ Found missing keys!
|
|
|
90
97
|
└───────────────────────────────────────────────────────────────────────┴───────────────────────┘
|
|
91
98
|
|
|
92
99
|
Found invalid keys!
|
|
93
|
-
|
|
94
|
-
│
|
|
95
|
-
|
|
96
|
-
│ translations/multipleFoldersExample/spaceOne/locales/de-DE/one.json
|
|
97
|
-
│
|
|
98
|
-
│
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
┌────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
|
101
|
+
│ info │ result │
|
|
102
|
+
├────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
|
|
103
|
+
│ file │ translations/multipleFoldersExample/spaceOne/locales/de-DE/one.json │
|
|
104
|
+
│ key │ message.select │
|
|
105
|
+
│ msg │ Expected element of type "select" but received "argument", Unexpected date element, Unexpected date element... │
|
|
106
|
+
├────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
|
|
107
|
+
│ file │ translations/multipleFoldersExample/spaceOne/locales/de-DE/three.json │
|
|
108
|
+
│ key │ multipleVariables │
|
|
109
|
+
│ msg │ Expected argument to contain "user" but received "name" │
|
|
110
|
+
├────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
|
|
111
|
+
│ file │ translations/multipleFoldersExample/spaceTwo/locales/de-DE/one.json │
|
|
112
|
+
│ key │ message.text-format │
|
|
113
|
+
│ msg │ Expected element of type "tag" but received "number", Unexpected tag element │
|
|
114
|
+
├────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
|
|
115
|
+
│ file │ translations/multipleFoldersExample/spaceTwo/locales/de-DE/three.json │
|
|
116
|
+
│ key │ numberFormat │
|
|
117
|
+
│ msg │ Missing element number │
|
|
118
|
+
└────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
|
101
119
|
|
|
102
120
|
`);
|
|
103
121
|
done();
|
|
@@ -120,14 +138,25 @@ Found missing keys!
|
|
|
120
138
|
└───────────────────────────────────────────────────────────────────────┴───────────────────────┘
|
|
121
139
|
|
|
122
140
|
Found invalid keys!
|
|
123
|
-
|
|
124
|
-
│
|
|
125
|
-
|
|
126
|
-
│ translations/multipleFoldersExample/spaceOne/locales/de-DE/one.json
|
|
127
|
-
│
|
|
128
|
-
│
|
|
129
|
-
|
|
130
|
-
|
|
141
|
+
┌────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
|
142
|
+
│ info │ result │
|
|
143
|
+
├────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
|
|
144
|
+
│ file │ translations/multipleFoldersExample/spaceOne/locales/de-DE/one.json │
|
|
145
|
+
│ key │ message.select │
|
|
146
|
+
│ msg │ Expected element of type "select" but received "argument", Unexpected date element, Unexpected date element... │
|
|
147
|
+
├────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
|
|
148
|
+
│ file │ translations/multipleFoldersExample/spaceOne/locales/de-DE/three.json │
|
|
149
|
+
│ key │ multipleVariables │
|
|
150
|
+
│ msg │ Expected argument to contain "user" but received "name" │
|
|
151
|
+
├────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
|
|
152
|
+
│ file │ translations/multipleFoldersExample/spaceTwo/locales/de-DE/one.json │
|
|
153
|
+
│ key │ message.text-format │
|
|
154
|
+
│ msg │ Expected element of type "tag" but received "number", Unexpected tag element │
|
|
155
|
+
├────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
|
|
156
|
+
│ file │ translations/multipleFoldersExample/spaceTwo/locales/de-DE/three.json │
|
|
157
|
+
│ key │ numberFormat │
|
|
158
|
+
│ msg │ Missing element number │
|
|
159
|
+
└────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
|
131
160
|
|
|
132
161
|
`);
|
|
133
162
|
done();
|
|
@@ -154,11 +183,13 @@ Found missing keys!
|
|
|
154
183
|
└───────────────────────────────────────────┴────────────────────────────────┘
|
|
155
184
|
|
|
156
185
|
Found invalid keys!
|
|
157
|
-
|
|
158
|
-
│
|
|
159
|
-
|
|
160
|
-
│ translations/messageExamples/de-de.json │
|
|
161
|
-
|
|
186
|
+
┌────────┬───────────────────────────────────────────┐
|
|
187
|
+
│ info │ result │
|
|
188
|
+
├────────┼───────────────────────────────────────────┤
|
|
189
|
+
│ file │ translations/messageExamples/de-de.json │
|
|
190
|
+
│ key │ multipleVariables │
|
|
191
|
+
│ msg │ Unexpected date element │
|
|
192
|
+
└────────┴───────────────────────────────────────────┘
|
|
162
193
|
|
|
163
194
|
`);
|
|
164
195
|
done();
|
|
@@ -181,12 +212,17 @@ Found missing keys!
|
|
|
181
212
|
└──────────────────────────────────────────────────────────┴────────────────────────────────┘
|
|
182
213
|
|
|
183
214
|
Found invalid keys!
|
|
184
|
-
|
|
185
|
-
│
|
|
186
|
-
|
|
187
|
-
│ translations/multipleFilesFolderExample/de-DE/one.json
|
|
188
|
-
│
|
|
189
|
-
|
|
215
|
+
┌────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
|
216
|
+
│ info │ result │
|
|
217
|
+
├────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
|
|
218
|
+
│ file │ translations/multipleFilesFolderExample/de-DE/one.json │
|
|
219
|
+
│ key │ message.select │
|
|
220
|
+
│ msg │ Expected element of type "select" but received "argument", Unexpected date element, Unexpected date element... │
|
|
221
|
+
├────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
|
|
222
|
+
│ file │ translations/multipleFilesFolderExample/de-DE/three.json │
|
|
223
|
+
│ key │ multipleVariables │
|
|
224
|
+
│ msg │ Expected argument to contain "user" but received "name" │
|
|
225
|
+
└────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
|
190
226
|
|
|
191
227
|
`);
|
|
192
228
|
done();
|
|
@@ -211,11 +247,13 @@ Found missing keys!
|
|
|
211
247
|
└───────────────────────────────────────────┴────────────┘
|
|
212
248
|
|
|
213
249
|
Found invalid keys!
|
|
214
|
-
|
|
215
|
-
│
|
|
216
|
-
|
|
217
|
-
│ translations/messageExamples/de-de.json │
|
|
218
|
-
|
|
250
|
+
┌────────┬───────────────────────────────────────────┐
|
|
251
|
+
│ info │ result │
|
|
252
|
+
├────────┼───────────────────────────────────────────┤
|
|
253
|
+
│ file │ translations/messageExamples/de-de.json │
|
|
254
|
+
│ key │ multipleVariables │
|
|
255
|
+
│ msg │ Unexpected date element │
|
|
256
|
+
└────────┴───────────────────────────────────────────┘
|
|
219
257
|
|
|
220
258
|
`);
|
|
221
259
|
done();
|
|
@@ -240,11 +278,13 @@ Found missing keys!
|
|
|
240
278
|
└───────────────────────────────────────────┴────────────┘
|
|
241
279
|
|
|
242
280
|
Found invalid keys!
|
|
243
|
-
|
|
244
|
-
│
|
|
245
|
-
|
|
246
|
-
│ translations/messageExamples/de-de.json │
|
|
247
|
-
|
|
281
|
+
┌────────┬───────────────────────────────────────────┐
|
|
282
|
+
│ info │ result │
|
|
283
|
+
├────────┼───────────────────────────────────────────┤
|
|
284
|
+
│ file │ translations/messageExamples/de-de.json │
|
|
285
|
+
│ key │ multipleVariables │
|
|
286
|
+
│ msg │ Unexpected date element │
|
|
287
|
+
└────────┴───────────────────────────────────────────┘
|
|
248
288
|
|
|
249
289
|
`);
|
|
250
290
|
done();
|
|
@@ -290,6 +330,37 @@ Found undefined keys!
|
|
|
290
330
|
│ translations/codeExamples/reacti18next/src/App.tsx │ some.key.that.is.not.defined │
|
|
291
331
|
└──────────────────────────────────────────────────────┴────────────────────────────────┘
|
|
292
332
|
|
|
333
|
+
`);
|
|
334
|
+
done();
|
|
335
|
+
});
|
|
336
|
+
});
|
|
337
|
+
it("should find unused and undefined keys for react-i18next applications with multiple source folders", (done) => {
|
|
338
|
+
(0, child_process_1.exec)("node dist/bin/index.js --source en --locales translations/codeExamples/reacti18next/locales -f i18next -u translations/codeExamples/reacti18next/src translations/codeExamples/reacti18next/secondSrcFolder --parser-component-functions WrappedTransComponent", (_error, stdout, _stderr) => {
|
|
339
|
+
const result = stdout.split("Done")[0];
|
|
340
|
+
expect(result).toEqual(`i18n translations checker
|
|
341
|
+
Source: en
|
|
342
|
+
Selected format is: i18next
|
|
343
|
+
|
|
344
|
+
No missing keys found!
|
|
345
|
+
|
|
346
|
+
No invalid translations found!
|
|
347
|
+
|
|
348
|
+
Found unused keys!
|
|
349
|
+
┌──────────────────────────────────────────────────────────────────────┬──────────────────┐
|
|
350
|
+
│ file │ key │
|
|
351
|
+
├──────────────────────────────────────────────────────────────────────┼──────────────────┤
|
|
352
|
+
│ translations/codeExamples/reacti18next/locales/en/translation.json │ format.ebook │
|
|
353
|
+
│ translations/codeExamples/reacti18next/locales/en/translation.json │ nonExistentKey │
|
|
354
|
+
└──────────────────────────────────────────────────────────────────────┴──────────────────┘
|
|
355
|
+
|
|
356
|
+
Found undefined keys!
|
|
357
|
+
┌───────────────────────────────────────────────────────────────────┬───────────────────────────────────┐
|
|
358
|
+
│ file │ key │
|
|
359
|
+
├───────────────────────────────────────────────────────────────────┼───────────────────────────────────┤
|
|
360
|
+
│ translations/codeExamples/reacti18next/src/App.tsx │ some.key.that.is.not.defined │
|
|
361
|
+
│ translations/codeExamples/reacti18next/secondSrcFolder/Main.tsx │ another.key.that.is.not.defined │
|
|
362
|
+
└───────────────────────────────────────────────────────────────────┴───────────────────────────────────┘
|
|
363
|
+
|
|
293
364
|
`);
|
|
294
365
|
done();
|
|
295
366
|
});
|
|
@@ -347,17 +418,17 @@ Found undefined keys!
|
|
|
347
418
|
┌──────────────────────────────────────────────────────────────────┬───────────────────┐
|
|
348
419
|
│ file │ key │
|
|
349
420
|
├──────────────────────────────────────────────────────────────────┼───────────────────┤
|
|
350
|
-
│ translations/codeExamples/next-intl/src/Basic.tsx │ message.select │
|
|
351
|
-
│ translations/codeExamples/next-intl/src/StrictTypesExample.tsx │ unknown.unknown │
|
|
352
421
|
│ translations/codeExamples/next-intl/src/StrictTypesExample.tsx │ About.unknown │
|
|
353
|
-
│ translations/codeExamples/next-intl/src/StrictTypesExample.tsx │ unknown │
|
|
354
|
-
│ translations/codeExamples/next-intl/src/StrictTypesExample.tsx │ Test.title │
|
|
355
|
-
│ translations/codeExamples/next-intl/src/StrictTypesExample.tsx │ title │
|
|
356
|
-
│ translations/codeExamples/next-intl/src/StrictTypesExample.tsx │ unknown.unknown │
|
|
357
422
|
│ translations/codeExamples/next-intl/src/StrictTypesExample.tsx │ About.unknown │
|
|
358
|
-
│ translations/codeExamples/next-intl/src/StrictTypesExample.tsx │
|
|
423
|
+
│ translations/codeExamples/next-intl/src/StrictTypesExample.tsx │ Test.title │
|
|
359
424
|
│ translations/codeExamples/next-intl/src/StrictTypesExample.tsx │ Test.title │
|
|
360
425
|
│ translations/codeExamples/next-intl/src/StrictTypesExample.tsx │ title │
|
|
426
|
+
│ translations/codeExamples/next-intl/src/StrictTypesExample.tsx │ title │
|
|
427
|
+
│ translations/codeExamples/next-intl/src/StrictTypesExample.tsx │ unknown │
|
|
428
|
+
│ translations/codeExamples/next-intl/src/StrictTypesExample.tsx │ unknown │
|
|
429
|
+
│ translations/codeExamples/next-intl/src/StrictTypesExample.tsx │ unknown.unknown │
|
|
430
|
+
│ translations/codeExamples/next-intl/src/StrictTypesExample.tsx │ unknown.unknown │
|
|
431
|
+
│ translations/codeExamples/next-intl/src/Basic.tsx │ message.select │
|
|
361
432
|
└──────────────────────────────────────────────────────────────────┴───────────────────┘
|
|
362
433
|
|
|
363
434
|
`);
|
|
@@ -400,11 +471,13 @@ Found missing keys!
|
|
|
400
471
|
└────────────────────────────────────────────────────┴───────────────────────┘
|
|
401
472
|
|
|
402
473
|
Found invalid keys!
|
|
403
|
-
|
|
404
|
-
│
|
|
405
|
-
|
|
406
|
-
│ translations/yaml/folderExample/de-DE/index.yaml
|
|
407
|
-
|
|
474
|
+
┌────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
|
475
|
+
│ info │ result │
|
|
476
|
+
├────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
|
|
477
|
+
│ file │ translations/yaml/folderExample/de-DE/index.yaml │
|
|
478
|
+
│ key │ message.select │
|
|
479
|
+
│ msg │ Expected element of type "select" but received "argument", Unexpected date element, Unexpected date element... │
|
|
480
|
+
└────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
|
408
481
|
|
|
409
482
|
`);
|
|
410
483
|
done();
|
|
@@ -425,12 +498,17 @@ Found missing keys!
|
|
|
425
498
|
└───────────────────────────────────────────────────────────────┴───────────────────────┘
|
|
426
499
|
|
|
427
500
|
Found invalid keys!
|
|
428
|
-
|
|
429
|
-
│
|
|
430
|
-
|
|
431
|
-
│ translations/yaml/multipleFilesFolderExample/de-DE/one.yaml
|
|
432
|
-
│
|
|
433
|
-
|
|
501
|
+
┌────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
|
502
|
+
│ info │ result │
|
|
503
|
+
├────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
|
|
504
|
+
│ file │ translations/yaml/multipleFilesFolderExample/de-DE/one.yaml │
|
|
505
|
+
│ key │ message.select │
|
|
506
|
+
│ msg │ Expected element of type "select" but received "argument", Unexpected date element, Unexpected date element... │
|
|
507
|
+
├────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
|
|
508
|
+
│ file │ translations/yaml/multipleFilesFolderExample/de-DE/three.yaml │
|
|
509
|
+
│ key │ multipleVariables │
|
|
510
|
+
│ msg │ Expected argument to contain "user" but received "name" │
|
|
511
|
+
└────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
|
434
512
|
|
|
435
513
|
`);
|
|
436
514
|
done();
|
|
@@ -453,14 +531,25 @@ Found missing keys!
|
|
|
453
531
|
└────────────────────────────────────────────────────────────────────────────┴───────────────────────┘
|
|
454
532
|
|
|
455
533
|
Found invalid keys!
|
|
456
|
-
|
|
457
|
-
│
|
|
458
|
-
|
|
459
|
-
│ translations/yaml/multipleFoldersExample/spaceOne/locales/de-DE/one.yaml
|
|
460
|
-
│
|
|
461
|
-
│
|
|
462
|
-
|
|
463
|
-
|
|
534
|
+
┌────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
|
535
|
+
│ info │ result │
|
|
536
|
+
├────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
|
|
537
|
+
│ file │ translations/yaml/multipleFoldersExample/spaceOne/locales/de-DE/one.yaml │
|
|
538
|
+
│ key │ message.select │
|
|
539
|
+
│ msg │ Expected element of type "select" but received "argument", Unexpected date element, Unexpected date element... │
|
|
540
|
+
├────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
|
|
541
|
+
│ file │ translations/yaml/multipleFoldersExample/spaceOne/locales/de-DE/three.yaml │
|
|
542
|
+
│ key │ multipleVariables │
|
|
543
|
+
│ msg │ Expected argument to contain "user" but received "name" │
|
|
544
|
+
├────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
|
|
545
|
+
│ file │ translations/yaml/multipleFoldersExample/spaceTwo/locales/de-DE/one.yaml │
|
|
546
|
+
│ key │ message.text-format │
|
|
547
|
+
│ msg │ Expected element of type "tag" but received "number", Unexpected tag element │
|
|
548
|
+
├────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
|
|
549
|
+
│ file │ translations/yaml/multipleFoldersExample/spaceTwo/locales/de-DE/three.yaml │
|
|
550
|
+
│ key │ numberFormat │
|
|
551
|
+
│ msg │ Missing element number │
|
|
552
|
+
└────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
|
464
553
|
|
|
465
554
|
`);
|
|
466
555
|
done();
|
|
@@ -483,14 +572,25 @@ Found missing keys!
|
|
|
483
572
|
└────────────────────────────────────────────────────────────────────────────┴───────────────────────┘
|
|
484
573
|
|
|
485
574
|
Found invalid keys!
|
|
486
|
-
|
|
487
|
-
│
|
|
488
|
-
|
|
489
|
-
│ translations/yaml/multipleFoldersExample/spaceOne/locales/de-DE/one.yaml
|
|
490
|
-
│
|
|
491
|
-
│
|
|
492
|
-
|
|
493
|
-
|
|
575
|
+
┌────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
|
576
|
+
│ info │ result │
|
|
577
|
+
├────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
|
|
578
|
+
│ file │ translations/yaml/multipleFoldersExample/spaceOne/locales/de-DE/one.yaml │
|
|
579
|
+
│ key │ message.select │
|
|
580
|
+
│ msg │ Expected element of type "select" but received "argument", Unexpected date element, Unexpected date element... │
|
|
581
|
+
├────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
|
|
582
|
+
│ file │ translations/yaml/multipleFoldersExample/spaceOne/locales/de-DE/three.yaml │
|
|
583
|
+
│ key │ multipleVariables │
|
|
584
|
+
│ msg │ Expected argument to contain "user" but received "name" │
|
|
585
|
+
├────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
|
|
586
|
+
│ file │ translations/yaml/multipleFoldersExample/spaceTwo/locales/de-DE/one.yaml │
|
|
587
|
+
│ key │ message.text-format │
|
|
588
|
+
│ msg │ Expected element of type "tag" but received "number", Unexpected tag element │
|
|
589
|
+
├────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
|
|
590
|
+
│ file │ translations/yaml/multipleFoldersExample/spaceTwo/locales/de-DE/three.yaml │
|
|
591
|
+
│ key │ numberFormat │
|
|
592
|
+
│ msg │ Missing element number │
|
|
593
|
+
└────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
|
494
594
|
|
|
495
595
|
`);
|
|
496
596
|
done();
|
|
@@ -517,11 +617,13 @@ Found missing keys!
|
|
|
517
617
|
└────────────────────────────────────────────────┴────────────────────────────────┘
|
|
518
618
|
|
|
519
619
|
Found invalid keys!
|
|
520
|
-
|
|
521
|
-
│
|
|
522
|
-
|
|
523
|
-
│ translations/yaml/messageExamples/de-de.yaml │
|
|
524
|
-
|
|
620
|
+
┌────────┬────────────────────────────────────────────────┐
|
|
621
|
+
│ info │ result │
|
|
622
|
+
├────────┼────────────────────────────────────────────────┤
|
|
623
|
+
│ file │ translations/yaml/messageExamples/de-de.yaml │
|
|
624
|
+
│ key │ multipleVariables │
|
|
625
|
+
│ msg │ Unexpected date element │
|
|
626
|
+
└────────┴────────────────────────────────────────────────┘
|
|
525
627
|
|
|
526
628
|
`);
|
|
527
629
|
done();
|
|
@@ -544,12 +646,17 @@ Found missing keys!
|
|
|
544
646
|
└───────────────────────────────────────────────────────────────┴────────────────────────────────┘
|
|
545
647
|
|
|
546
648
|
Found invalid keys!
|
|
547
|
-
|
|
548
|
-
│
|
|
549
|
-
|
|
550
|
-
│ translations/yaml/multipleFilesFolderExample/de-DE/one.yaml
|
|
551
|
-
│
|
|
552
|
-
|
|
649
|
+
┌────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
|
650
|
+
│ info │ result │
|
|
651
|
+
├────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
|
|
652
|
+
│ file │ translations/yaml/multipleFilesFolderExample/de-DE/one.yaml │
|
|
653
|
+
│ key │ message.select │
|
|
654
|
+
│ msg │ Expected element of type "select" but received "argument", Unexpected date element, Unexpected date element... │
|
|
655
|
+
├────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
|
|
656
|
+
│ file │ translations/yaml/multipleFilesFolderExample/de-DE/three.yaml │
|
|
657
|
+
│ key │ multipleVariables │
|
|
658
|
+
│ msg │ Expected argument to contain "user" but received "name" │
|
|
659
|
+
└────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
|
553
660
|
|
|
554
661
|
`);
|
|
555
662
|
done();
|
package/dist/errorReporters.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
export type StandardReporter = {
|
|
2
|
+
file: string;
|
|
3
|
+
key: string;
|
|
4
|
+
msg?: string;
|
|
5
|
+
};
|
|
1
6
|
export declare const CheckOptions: string[];
|
|
2
7
|
export type Context = (typeof CheckOptions)[number];
|
|
3
8
|
export declare const contextMapping: Record<Context, string>;
|
|
4
|
-
export declare const standardReporter: (result:
|
|
5
|
-
file: string;
|
|
6
|
-
key: string;
|
|
7
|
-
}[]) => string;
|
|
9
|
+
export declare const standardReporter: (result: StandardReporter[], flatten?: boolean) => string;
|
|
8
10
|
export declare const summaryReporter: (result: {
|
|
9
11
|
file: string;
|
|
10
12
|
total: number;
|
|
11
13
|
}[]) => string;
|
|
12
14
|
export declare const createTable: (input: unknown[]) => string;
|
|
15
|
+
export declare const createVerticalTable: (input: unknown[]) => string;
|