@lingual/i18n-check 0.8.2 → 0.8.3
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 +10 -18
- package/dist/bin/index.js +58 -57
- package/dist/bin/index.test.js +289 -289
- package/dist/errorReporters.d.ts +1 -1
- package/dist/errorReporters.js +21 -21
- package/dist/errorReporters.test.js +39 -39
- package/dist/index.d.ts +3 -3
- package/dist/index.js +59 -42
- package/dist/utils/findInvalidTranslations.d.ts +2 -2
- package/dist/utils/findInvalidTranslations.js +20 -19
- package/dist/utils/findInvalidTranslations.test.js +30 -30
- package/dist/utils/findInvalidi18nTranslations.d.ts +2 -2
- package/dist/utils/findInvalidi18nTranslations.js +35 -35
- package/dist/utils/findInvalidi18nTranslations.test.js +72 -72
- package/dist/utils/findMissingKeys.d.ts +1 -1
- package/dist/utils/findMissingKeys.js +2 -2
- package/dist/utils/findMissingKeys.test.js +20 -20
- package/dist/utils/flattenTranslations.d.ts +1 -1
- package/dist/utils/flattenTranslations.js +3 -3
- package/dist/utils/flattenTranslations.test.js +13 -13
- package/dist/utils/i18NextParser.d.ts +6 -6
- package/dist/utils/i18NextParser.js +29 -29
- package/dist/utils/i18NextParser.test.js +104 -104
- package/dist/utils/nextIntlSrcParser.js +11 -11
- package/dist/utils/nextIntlSrcParser.test.js +156 -156
- package/package.json +14 -4
package/dist/bin/index.test.js
CHANGED
|
@@ -7,38 +7,38 @@ const child_process_1 = require("child_process");
|
|
|
7
7
|
const errorReporters_1 = require("../errorReporters");
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
function tr(file) {
|
|
10
|
-
return path_1.default.join(
|
|
10
|
+
return path_1.default.join('translations', file);
|
|
11
11
|
}
|
|
12
12
|
function multiFiles(file) {
|
|
13
|
-
return path_1.default.join(
|
|
13
|
+
return path_1.default.join('translations/multipleFilesFolderExample', file);
|
|
14
14
|
}
|
|
15
15
|
function multiFolders(file) {
|
|
16
|
-
return path_1.default.join(
|
|
16
|
+
return path_1.default.join('translations/multipleFoldersExample', file);
|
|
17
17
|
}
|
|
18
18
|
function codeEx(file) {
|
|
19
|
-
return path_1.default.join(
|
|
19
|
+
return path_1.default.join('translations/codeExamples', file);
|
|
20
20
|
}
|
|
21
21
|
function ymlMultiFolders(file) {
|
|
22
|
-
return path_1.default.join(
|
|
22
|
+
return path_1.default.join('translations/yaml/multipleFoldersExample', file);
|
|
23
23
|
}
|
|
24
24
|
function execAsync(cmd) {
|
|
25
25
|
return new Promise((resolve) => {
|
|
26
|
-
(0, child_process_1.exec)(cmd, (error, stdout
|
|
26
|
+
(0, child_process_1.exec)(cmd, (error, stdout) => {
|
|
27
27
|
resolve(stdout);
|
|
28
28
|
});
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
|
-
describe(
|
|
32
|
-
describe(
|
|
33
|
-
it(
|
|
34
|
-
const stdout = await execAsync(
|
|
35
|
-
const result = stdout.split(
|
|
36
|
-
const filePath = tr(
|
|
31
|
+
describe('CLI', () => {
|
|
32
|
+
describe('JSON', () => {
|
|
33
|
+
it('should return the missing keys for single folder translations', async () => {
|
|
34
|
+
const stdout = await execAsync('node dist/bin/index.js -s en-US -l translations/flattenExamples');
|
|
35
|
+
const result = stdout.split('Done')[0];
|
|
36
|
+
const filePath = tr('flattenExamples/de-de.json');
|
|
37
37
|
const table = (0, errorReporters_1.formatTable)([
|
|
38
|
-
[[
|
|
38
|
+
[['file', 'key']],
|
|
39
39
|
[
|
|
40
|
-
[filePath,
|
|
41
|
-
[filePath,
|
|
40
|
+
[filePath, 'other.nested.three'],
|
|
41
|
+
[filePath, 'other.nested.deep.more.final'],
|
|
42
42
|
],
|
|
43
43
|
]);
|
|
44
44
|
expect(result).toEqual(`i18n translations checker
|
|
@@ -51,20 +51,20 @@ No invalid translations found!
|
|
|
51
51
|
|
|
52
52
|
`);
|
|
53
53
|
});
|
|
54
|
-
it(
|
|
55
|
-
const stdout = await execAsync(
|
|
56
|
-
const result = stdout.split(
|
|
54
|
+
it('should return the missing/invalid keys for folder per locale with single file', async () => {
|
|
55
|
+
const stdout = await execAsync('node dist/bin/index.js -l translations/folderExample/ -s en-US');
|
|
56
|
+
const result = stdout.split('Done')[0];
|
|
57
57
|
const missingKeysTable = (0, errorReporters_1.formatTable)([
|
|
58
|
-
[[
|
|
59
|
-
[[tr(
|
|
58
|
+
[['file', 'key']],
|
|
59
|
+
[[tr('folderExample/de-DE/index.json'), 'message.text-format']],
|
|
60
60
|
]);
|
|
61
61
|
const invalidKeysTable = (0, errorReporters_1.formatTable)([
|
|
62
|
-
[[
|
|
62
|
+
[['info', 'result']],
|
|
63
63
|
[
|
|
64
|
-
[
|
|
65
|
-
[
|
|
64
|
+
['file', tr('folderExample/de-DE/index.json')],
|
|
65
|
+
['key', 'message.select'],
|
|
66
66
|
[
|
|
67
|
-
|
|
67
|
+
'msg',
|
|
68
68
|
'Expected element of type "select" but received "argument", Unexpected date element, Unexpected date element...',
|
|
69
69
|
],
|
|
70
70
|
],
|
|
@@ -80,32 +80,32 @@ ${invalidKeysTable}
|
|
|
80
80
|
|
|
81
81
|
`);
|
|
82
82
|
});
|
|
83
|
-
it(
|
|
84
|
-
const stdout = await execAsync(
|
|
83
|
+
it('should return the missing/invalid keys for folder per locale with multiple files', async () => {
|
|
84
|
+
const stdout = await execAsync('node dist/bin/index.js -l translations/multipleFilesFolderExample/ -s en-US');
|
|
85
85
|
const missingKeysTable = (0, errorReporters_1.formatTable)([
|
|
86
|
-
[[
|
|
86
|
+
[['file', 'key']],
|
|
87
87
|
[
|
|
88
|
-
[multiFiles(
|
|
89
|
-
[multiFiles(
|
|
88
|
+
[multiFiles('de-DE/one.json'), 'message.text-format'],
|
|
89
|
+
[multiFiles('de-DE/two.json'), 'test.drive.four'],
|
|
90
90
|
],
|
|
91
91
|
]);
|
|
92
92
|
const invalidKeysTable = (0, errorReporters_1.formatTable)([
|
|
93
|
-
[[
|
|
93
|
+
[['info', 'result']],
|
|
94
94
|
[
|
|
95
|
-
[
|
|
96
|
-
[
|
|
95
|
+
['file', multiFiles('de-DE/one.json')],
|
|
96
|
+
['key', 'message.select'],
|
|
97
97
|
[
|
|
98
|
-
|
|
98
|
+
'msg',
|
|
99
99
|
'Expected element of type "select" but received "argument", Unexpected date element, Unexpected date element...',
|
|
100
100
|
],
|
|
101
101
|
],
|
|
102
102
|
[
|
|
103
|
-
[
|
|
104
|
-
[
|
|
105
|
-
[
|
|
103
|
+
['file', multiFiles('de-DE/three.json')],
|
|
104
|
+
['key', 'multipleVariables'],
|
|
105
|
+
['msg', 'Expected argument to contain "user" but received "name" '],
|
|
106
106
|
],
|
|
107
107
|
]);
|
|
108
|
-
const result = stdout.split(
|
|
108
|
+
const result = stdout.split('Done')[0];
|
|
109
109
|
expect(result).toEqual(`i18n translations checker
|
|
110
110
|
Source: en-US
|
|
111
111
|
|
|
@@ -117,241 +117,241 @@ ${invalidKeysTable}
|
|
|
117
117
|
|
|
118
118
|
`);
|
|
119
119
|
});
|
|
120
|
-
it(
|
|
121
|
-
const stdout = await execAsync(
|
|
122
|
-
const result = stdout.split(
|
|
120
|
+
it('should return the missing/invalid keys for folder containing multiple locale folders', async () => {
|
|
121
|
+
const stdout = await execAsync('node dist/bin/index.js -l translations/multipleFoldersExample -s en-US');
|
|
122
|
+
const result = stdout.split('Done')[0];
|
|
123
123
|
expect(result).toEqual(`i18n translations checker
|
|
124
124
|
Source: en-US
|
|
125
125
|
|
|
126
126
|
Found missing keys!
|
|
127
127
|
${(0, errorReporters_1.formatTable)([
|
|
128
|
-
[[
|
|
128
|
+
[['file', 'key']],
|
|
129
129
|
[
|
|
130
|
-
[multiFolders(
|
|
131
|
-
[multiFolders(
|
|
132
|
-
[multiFolders(
|
|
133
|
-
[multiFolders(
|
|
130
|
+
[multiFolders('spaceOne/locales/de-DE/one.json'), 'message.text-format'],
|
|
131
|
+
[multiFolders('spaceOne/locales/de-DE/two.json'), 'test.drive.four'],
|
|
132
|
+
[multiFolders('spaceTwo/locales/de-DE/one.json'), 'message.plural'],
|
|
133
|
+
[multiFolders('spaceTwo/locales/de-DE/two.json'), 'test.drive.two'],
|
|
134
134
|
],
|
|
135
135
|
])}
|
|
136
136
|
|
|
137
137
|
Found invalid keys!
|
|
138
138
|
${(0, errorReporters_1.formatTable)([
|
|
139
|
-
[[
|
|
139
|
+
[['info', 'result']],
|
|
140
140
|
[
|
|
141
|
-
[
|
|
142
|
-
[
|
|
141
|
+
['file', multiFolders('spaceOne/locales/de-DE/one.json')],
|
|
142
|
+
['key', 'message.select'],
|
|
143
143
|
[
|
|
144
|
-
|
|
144
|
+
'msg',
|
|
145
145
|
'Expected element of type "select" but received "argument", Unexpected date element, Unexpected date element...',
|
|
146
146
|
],
|
|
147
147
|
],
|
|
148
148
|
[
|
|
149
|
-
[
|
|
150
|
-
[
|
|
151
|
-
[
|
|
149
|
+
['file', multiFolders('spaceOne/locales/de-DE/three.json')],
|
|
150
|
+
['key', 'multipleVariables'],
|
|
151
|
+
['msg', 'Expected argument to contain "user" but received "name"'],
|
|
152
152
|
],
|
|
153
153
|
[
|
|
154
|
-
[
|
|
155
|
-
[
|
|
154
|
+
['file', multiFolders('spaceTwo/locales/de-DE/one.json')],
|
|
155
|
+
['key', 'message.text-format'],
|
|
156
156
|
[
|
|
157
|
-
|
|
157
|
+
'msg',
|
|
158
158
|
'Expected element of type "tag" but received "number", Unexpected tag element',
|
|
159
159
|
],
|
|
160
160
|
],
|
|
161
161
|
[
|
|
162
|
-
[
|
|
163
|
-
[
|
|
164
|
-
[
|
|
162
|
+
['file', multiFolders('spaceTwo/locales/de-DE/three.json')],
|
|
163
|
+
['key', 'numberFormat'],
|
|
164
|
+
['msg', 'Missing element number'],
|
|
165
165
|
],
|
|
166
166
|
])}
|
|
167
167
|
|
|
168
168
|
`);
|
|
169
169
|
});
|
|
170
|
-
it(
|
|
171
|
-
const stdout = await execAsync(
|
|
172
|
-
const result = stdout.split(
|
|
170
|
+
it('should return the missing/invalid keys for multiple locale folders', async () => {
|
|
171
|
+
const stdout = await execAsync('node dist/bin/index.js -l translations/multipleFoldersExample/spaceOne translations/multipleFoldersExample/spaceTwo -s en-US');
|
|
172
|
+
const result = stdout.split('Done')[0];
|
|
173
173
|
expect(result).toEqual(`i18n translations checker
|
|
174
174
|
Source: en-US
|
|
175
175
|
|
|
176
176
|
Found missing keys!
|
|
177
177
|
${(0, errorReporters_1.formatTable)([
|
|
178
|
-
[[
|
|
178
|
+
[['file', 'key']],
|
|
179
179
|
[
|
|
180
|
-
[multiFolders(
|
|
181
|
-
[multiFolders(
|
|
182
|
-
[multiFolders(
|
|
183
|
-
[multiFolders(
|
|
180
|
+
[multiFolders('spaceOne/locales/de-DE/one.json'), 'message.text-format'],
|
|
181
|
+
[multiFolders('spaceOne/locales/de-DE/two.json'), 'test.drive.four'],
|
|
182
|
+
[multiFolders('spaceTwo/locales/de-DE/one.json'), 'message.plural'],
|
|
183
|
+
[multiFolders('spaceTwo/locales/de-DE/two.json'), 'test.drive.two'],
|
|
184
184
|
],
|
|
185
185
|
])}
|
|
186
186
|
|
|
187
187
|
Found invalid keys!
|
|
188
188
|
${(0, errorReporters_1.formatTable)([
|
|
189
|
-
[[
|
|
189
|
+
[['info', 'result']],
|
|
190
190
|
[
|
|
191
|
-
[
|
|
192
|
-
[
|
|
191
|
+
['file', multiFolders('spaceOne/locales/de-DE/one.json')],
|
|
192
|
+
['key', 'message.select'],
|
|
193
193
|
[
|
|
194
|
-
|
|
194
|
+
'msg',
|
|
195
195
|
'Expected element of type "select" but received "argument", Unexpected date element, Unexpected date element...',
|
|
196
196
|
],
|
|
197
197
|
],
|
|
198
198
|
[
|
|
199
|
-
[
|
|
200
|
-
[
|
|
201
|
-
[
|
|
199
|
+
['file', multiFolders('spaceOne/locales/de-DE/three.json')],
|
|
200
|
+
['key', 'multipleVariables'],
|
|
201
|
+
['msg', 'Expected argument to contain "user" but received "name"'],
|
|
202
202
|
],
|
|
203
203
|
[
|
|
204
|
-
[
|
|
205
|
-
[
|
|
204
|
+
['file', multiFolders('spaceTwo/locales/de-DE/one.json')],
|
|
205
|
+
['key', 'message.text-format'],
|
|
206
206
|
[
|
|
207
|
-
|
|
207
|
+
'msg',
|
|
208
208
|
'Expected element of type "tag" but received "number", Unexpected tag element',
|
|
209
209
|
],
|
|
210
210
|
],
|
|
211
211
|
[
|
|
212
|
-
[
|
|
213
|
-
[
|
|
214
|
-
[
|
|
212
|
+
['file', multiFolders('spaceTwo/locales/de-DE/three.json')],
|
|
213
|
+
['key', 'numberFormat'],
|
|
214
|
+
['msg', 'Missing element number'],
|
|
215
215
|
],
|
|
216
216
|
])}
|
|
217
217
|
|
|
218
218
|
`);
|
|
219
219
|
});
|
|
220
|
-
it(
|
|
221
|
-
const stdout = await execAsync(
|
|
222
|
-
const result = stdout.split(
|
|
220
|
+
it('should return the missing/invalid keys for all files in the provided locale folders', async () => {
|
|
221
|
+
const stdout = await execAsync('node dist/bin/index.js --source en-US --locales translations/flattenExamples translations/messageExamples');
|
|
222
|
+
const result = stdout.split('Done')[0];
|
|
223
223
|
expect(result).toEqual(`i18n translations checker
|
|
224
224
|
Source: en-US
|
|
225
225
|
|
|
226
226
|
Found missing keys!
|
|
227
227
|
${(0, errorReporters_1.formatTable)([
|
|
228
|
-
[[
|
|
228
|
+
[['file', 'key']],
|
|
229
229
|
[
|
|
230
|
-
[tr(
|
|
231
|
-
[tr(
|
|
232
|
-
[tr(
|
|
233
|
-
[tr(
|
|
234
|
-
[tr(
|
|
235
|
-
[tr(
|
|
236
|
-
[tr(
|
|
237
|
-
[tr(
|
|
230
|
+
[tr('flattenExamples/de-de.json'), 'other.nested.three'],
|
|
231
|
+
[tr('flattenExamples/de-de.json'), 'other.nested.deep.more.final'],
|
|
232
|
+
[tr('messageExamples/de-de.json'), 'richText'],
|
|
233
|
+
[tr('messageExamples/de-de.json'), 'yo'],
|
|
234
|
+
[tr('messageExamples/de-de.json'), 'nesting1'],
|
|
235
|
+
[tr('messageExamples/de-de.json'), 'nesting2'],
|
|
236
|
+
[tr('messageExamples/de-de.json'), 'nesting3'],
|
|
237
|
+
[tr('messageExamples/de-de.json'), 'key1'],
|
|
238
238
|
],
|
|
239
239
|
])}
|
|
240
240
|
|
|
241
241
|
Found invalid keys!
|
|
242
242
|
${(0, errorReporters_1.formatTable)([
|
|
243
|
-
[[
|
|
243
|
+
[['info', 'result']],
|
|
244
244
|
[
|
|
245
|
-
[
|
|
246
|
-
[
|
|
247
|
-
[
|
|
245
|
+
['file', tr('messageExamples/de-de.json')],
|
|
246
|
+
['key', 'multipleVariables'],
|
|
247
|
+
['msg', 'Unexpected date element'],
|
|
248
248
|
],
|
|
249
249
|
])}
|
|
250
250
|
|
|
251
251
|
`);
|
|
252
252
|
});
|
|
253
|
-
it(
|
|
254
|
-
const stdout = await execAsync(
|
|
255
|
-
const result = stdout.split(
|
|
253
|
+
it('should return the missing/invalid keys for all files with source matching folder and source matching file', async () => {
|
|
254
|
+
const stdout = await execAsync('node dist/bin/index.js -l translations/multipleFilesFolderExample translations/flattenExamples -s en-US');
|
|
255
|
+
const result = stdout.split('Done')[0];
|
|
256
256
|
expect(result).toEqual(`i18n translations checker
|
|
257
257
|
Source: en-US
|
|
258
258
|
|
|
259
259
|
Found missing keys!
|
|
260
260
|
${(0, errorReporters_1.formatTable)([
|
|
261
|
-
[[
|
|
261
|
+
[['file', 'key']],
|
|
262
262
|
[
|
|
263
|
-
[tr(
|
|
264
|
-
[tr(
|
|
265
|
-
[multiFiles(
|
|
266
|
-
[multiFiles(
|
|
263
|
+
[tr('flattenExamples/de-de.json'), 'other.nested.three'],
|
|
264
|
+
[tr('flattenExamples/de-de.json'), 'other.nested.deep.more.final'],
|
|
265
|
+
[multiFiles('de-DE/one.json'), 'message.text-format'],
|
|
266
|
+
[multiFiles('de-DE/two.json'), 'test.drive.four'],
|
|
267
267
|
],
|
|
268
268
|
])}
|
|
269
269
|
|
|
270
270
|
Found invalid keys!
|
|
271
271
|
${(0, errorReporters_1.formatTable)([
|
|
272
|
-
[[
|
|
272
|
+
[['info', 'result']],
|
|
273
273
|
[
|
|
274
|
-
[
|
|
275
|
-
[
|
|
274
|
+
['file', multiFiles('de-DE/one.json')],
|
|
275
|
+
['key', 'message.select'],
|
|
276
276
|
[
|
|
277
|
-
|
|
277
|
+
'msg',
|
|
278
278
|
'Expected element of type "select" but received "argument", Unexpected date element, Unexpected date element...',
|
|
279
279
|
],
|
|
280
280
|
],
|
|
281
281
|
[
|
|
282
|
-
[
|
|
283
|
-
[
|
|
284
|
-
[
|
|
282
|
+
['file', multiFiles('de-DE/three.json')],
|
|
283
|
+
['key', 'multipleVariables'],
|
|
284
|
+
['msg', 'Expected argument to contain "user" but received "name"'],
|
|
285
285
|
],
|
|
286
286
|
])}
|
|
287
287
|
|
|
288
288
|
`);
|
|
289
289
|
});
|
|
290
|
-
it(
|
|
291
|
-
const stdout = await execAsync(
|
|
292
|
-
const result = stdout.split(
|
|
290
|
+
it('should ignore the excluded file', async () => {
|
|
291
|
+
const stdout = await execAsync('node dist/bin/index.js --source en-US --locales translations/flattenExamples translations/messageExamples --exclude translations/flattenExamples/de-de.json');
|
|
292
|
+
const result = stdout.split('Done')[0];
|
|
293
293
|
expect(result).toEqual(`i18n translations checker
|
|
294
294
|
Source: en-US
|
|
295
295
|
|
|
296
296
|
Found missing keys!
|
|
297
297
|
${(0, errorReporters_1.formatTable)([
|
|
298
|
-
[[
|
|
298
|
+
[['file', 'key']],
|
|
299
299
|
[
|
|
300
|
-
[tr(
|
|
301
|
-
[tr(
|
|
302
|
-
[tr(
|
|
303
|
-
[tr(
|
|
304
|
-
[tr(
|
|
305
|
-
[tr(
|
|
300
|
+
[tr('messageExamples/de-de.json'), 'richText'],
|
|
301
|
+
[tr('messageExamples/de-de.json'), 'yo'],
|
|
302
|
+
[tr('messageExamples/de-de.json'), 'nesting1'],
|
|
303
|
+
[tr('messageExamples/de-de.json'), 'nesting2'],
|
|
304
|
+
[tr('messageExamples/de-de.json'), 'nesting3'],
|
|
305
|
+
[tr('messageExamples/de-de.json'), 'key1'],
|
|
306
306
|
],
|
|
307
307
|
])}
|
|
308
308
|
|
|
309
309
|
Found invalid keys!
|
|
310
310
|
${(0, errorReporters_1.formatTable)([
|
|
311
|
-
[[
|
|
311
|
+
[['info', 'result']],
|
|
312
312
|
[
|
|
313
|
-
[
|
|
314
|
-
[
|
|
315
|
-
[
|
|
313
|
+
['file', tr('messageExamples/de-de.json')],
|
|
314
|
+
['key', 'multipleVariables'],
|
|
315
|
+
['msg', 'Unexpected date element'],
|
|
316
316
|
],
|
|
317
317
|
])}
|
|
318
318
|
|
|
319
319
|
`);
|
|
320
320
|
});
|
|
321
|
-
it(
|
|
322
|
-
const stdout = await execAsync(
|
|
323
|
-
const result = stdout.split(
|
|
321
|
+
it('should ignore the excluded folder', async () => {
|
|
322
|
+
const stdout = await execAsync('node dist/bin/index.js --source en-US --locales translations/flattenExamples translations/messageExamples --exclude translations/flattenExamples/*');
|
|
323
|
+
const result = stdout.split('Done')[0];
|
|
324
324
|
expect(result).toEqual(`i18n translations checker
|
|
325
325
|
Source: en-US
|
|
326
326
|
|
|
327
327
|
Found missing keys!
|
|
328
328
|
${(0, errorReporters_1.formatTable)([
|
|
329
|
-
[[
|
|
329
|
+
[['file', 'key']],
|
|
330
330
|
[
|
|
331
|
-
[tr(
|
|
332
|
-
[tr(
|
|
333
|
-
[tr(
|
|
334
|
-
[tr(
|
|
335
|
-
[tr(
|
|
336
|
-
[tr(
|
|
331
|
+
[tr('messageExamples/de-de.json'), 'richText'],
|
|
332
|
+
[tr('messageExamples/de-de.json'), 'yo'],
|
|
333
|
+
[tr('messageExamples/de-de.json'), 'nesting1'],
|
|
334
|
+
[tr('messageExamples/de-de.json'), 'nesting2'],
|
|
335
|
+
[tr('messageExamples/de-de.json'), 'nesting3'],
|
|
336
|
+
[tr('messageExamples/de-de.json'), 'key1'],
|
|
337
337
|
],
|
|
338
338
|
])}
|
|
339
339
|
|
|
340
340
|
Found invalid keys!
|
|
341
341
|
${(0, errorReporters_1.formatTable)([
|
|
342
|
-
[[
|
|
342
|
+
[['info', 'result']],
|
|
343
343
|
[
|
|
344
|
-
[
|
|
345
|
-
[
|
|
346
|
-
[
|
|
344
|
+
['file', tr('messageExamples/de-de.json')],
|
|
345
|
+
['key', 'multipleVariables'],
|
|
346
|
+
['msg', 'Unexpected date element'],
|
|
347
347
|
],
|
|
348
348
|
])}
|
|
349
349
|
|
|
350
350
|
`);
|
|
351
351
|
});
|
|
352
|
-
it(
|
|
353
|
-
const stdout = await execAsync(
|
|
354
|
-
const result = stdout.split(
|
|
352
|
+
it('should ignore the excluded multiple files', async () => {
|
|
353
|
+
const stdout = await execAsync('node dist/bin/index.js --source en-US --locales translations/flattenExamples translations/messageExamples --exclude translations/flattenExamples/de-de.json translations/messageExamples/de-de.json');
|
|
354
|
+
const result = stdout.split('Done')[0];
|
|
355
355
|
expect(result).toEqual(`i18n translations checker
|
|
356
356
|
Source: en-US
|
|
357
357
|
|
|
@@ -361,9 +361,9 @@ No invalid translations found!
|
|
|
361
361
|
|
|
362
362
|
`);
|
|
363
363
|
});
|
|
364
|
-
it(
|
|
365
|
-
const stdout = await execAsync(
|
|
366
|
-
const result = stdout.split(
|
|
364
|
+
it('should find unused and undefined keys for react-i18next applications', async () => {
|
|
365
|
+
const stdout = await execAsync('node dist/bin/index.js --source en --locales translations/codeExamples/reacti18next/locales -f i18next -u translations/codeExamples/reacti18next/src --parser-component-functions WrappedTransComponent');
|
|
366
|
+
const result = stdout.split('Done')[0];
|
|
367
367
|
expect(result).toEqual(`i18n translations checker
|
|
368
368
|
Source: en
|
|
369
369
|
Selected format is: i18next
|
|
@@ -374,24 +374,24 @@ No invalid translations found!
|
|
|
374
374
|
|
|
375
375
|
Found unused keys!
|
|
376
376
|
${(0, errorReporters_1.formatTable)([
|
|
377
|
-
[[
|
|
377
|
+
[['file', 'key']],
|
|
378
378
|
[
|
|
379
|
-
[codeEx(
|
|
380
|
-
[codeEx(
|
|
379
|
+
[codeEx('reacti18next/locales/en/translation.json'), 'format.ebook'],
|
|
380
|
+
[codeEx('reacti18next/locales/en/translation.json'), 'nonExistentKey'],
|
|
381
381
|
],
|
|
382
382
|
])}
|
|
383
383
|
|
|
384
384
|
Found undefined keys!
|
|
385
385
|
${(0, errorReporters_1.formatTable)([
|
|
386
|
-
[[
|
|
387
|
-
[[codeEx(
|
|
386
|
+
[['file', 'key']],
|
|
387
|
+
[[codeEx('reacti18next/src/App.tsx'), 'some.key.that.is.not.defined']],
|
|
388
388
|
])}
|
|
389
389
|
|
|
390
390
|
`);
|
|
391
391
|
});
|
|
392
|
-
it(
|
|
393
|
-
const stdout = await execAsync(
|
|
394
|
-
const result = stdout.split(
|
|
392
|
+
it('should find unused and undefined keys for react-i18next applications with multiple source folders', async () => {
|
|
393
|
+
const stdout = await execAsync('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');
|
|
394
|
+
const result = stdout.split('Done')[0];
|
|
395
395
|
expect(result).toEqual(`i18n translations checker
|
|
396
396
|
Source: en
|
|
397
397
|
Selected format is: i18next
|
|
@@ -402,30 +402,30 @@ No invalid translations found!
|
|
|
402
402
|
|
|
403
403
|
Found unused keys!
|
|
404
404
|
${(0, errorReporters_1.formatTable)([
|
|
405
|
-
[[
|
|
405
|
+
[['file', 'key']],
|
|
406
406
|
[
|
|
407
|
-
[codeEx(
|
|
408
|
-
[codeEx(
|
|
407
|
+
[codeEx('reacti18next/locales/en/translation.json'), 'format.ebook'],
|
|
408
|
+
[codeEx('reacti18next/locales/en/translation.json'), 'nonExistentKey'],
|
|
409
409
|
],
|
|
410
410
|
])}
|
|
411
411
|
|
|
412
412
|
Found undefined keys!
|
|
413
413
|
${(0, errorReporters_1.formatTable)([
|
|
414
|
-
[[
|
|
414
|
+
[['file', 'key']],
|
|
415
415
|
[
|
|
416
|
-
[codeEx(
|
|
416
|
+
[codeEx('reacti18next/src/App.tsx'), 'some.key.that.is.not.defined'],
|
|
417
417
|
[
|
|
418
|
-
codeEx(
|
|
419
|
-
|
|
418
|
+
codeEx('reacti18next/secondSrcFolder/Main.tsx'),
|
|
419
|
+
'another.key.that.is.not.defined',
|
|
420
420
|
],
|
|
421
421
|
],
|
|
422
422
|
])}
|
|
423
423
|
|
|
424
424
|
`);
|
|
425
425
|
});
|
|
426
|
-
it(
|
|
427
|
-
const stdout = await execAsync(
|
|
428
|
-
const result = stdout.split(
|
|
426
|
+
it('should find unused and undefined keys for react-intl applications', async () => {
|
|
427
|
+
const stdout = await execAsync('node dist/bin/index.js --source en-US --locales translations/codeExamples/react-intl/locales -f react-intl -u translations/codeExamples/react-intl/src');
|
|
428
|
+
const result = stdout.split('Done')[0];
|
|
429
429
|
expect(result).toEqual(`i18n translations checker
|
|
430
430
|
Source: en-US
|
|
431
431
|
Selected format is: react-intl
|
|
@@ -436,24 +436,24 @@ No invalid translations found!
|
|
|
436
436
|
|
|
437
437
|
Found unused keys!
|
|
438
438
|
${(0, errorReporters_1.formatTable)([
|
|
439
|
-
[[
|
|
439
|
+
[['file', 'key']],
|
|
440
440
|
[
|
|
441
|
-
[codeEx(
|
|
442
|
-
[codeEx(
|
|
441
|
+
[codeEx('react-intl/locales/en-US/one.json'), 'message.number-format'],
|
|
442
|
+
[codeEx('react-intl/locales/en-US/three.json'), 'multipleVariables'],
|
|
443
443
|
],
|
|
444
444
|
])}
|
|
445
445
|
|
|
446
446
|
Found undefined keys!
|
|
447
447
|
${(0, errorReporters_1.formatTable)([
|
|
448
|
-
[[
|
|
449
|
-
[[codeEx(
|
|
448
|
+
[['file', 'key']],
|
|
449
|
+
[[codeEx('react-intl/src/App.tsx'), 'some.key.that.is.not.defined']],
|
|
450
450
|
])}
|
|
451
451
|
|
|
452
452
|
`);
|
|
453
453
|
});
|
|
454
|
-
it(
|
|
455
|
-
const stdout = await execAsync(
|
|
456
|
-
const result = stdout.split(
|
|
454
|
+
it('should find unused and undefined keys for next-intl applications', async () => {
|
|
455
|
+
const stdout = await execAsync('node dist/bin/index.js --source en --locales translations/codeExamples/next-intl/locales/ -f next-intl -u translations/codeExamples/next-intl/src');
|
|
456
|
+
const result = stdout.split('Done')[0];
|
|
457
457
|
expect(result).toEqual(`i18n translations checker
|
|
458
458
|
Source: en
|
|
459
459
|
Selected format is: next-intl
|
|
@@ -464,47 +464,47 @@ No invalid translations found!
|
|
|
464
464
|
|
|
465
465
|
Found unused keys!
|
|
466
466
|
${(0, errorReporters_1.formatTable)([
|
|
467
|
-
[[
|
|
467
|
+
[['file', 'key']],
|
|
468
468
|
[
|
|
469
|
-
[codeEx(
|
|
470
|
-
[codeEx(
|
|
469
|
+
[codeEx('next-intl/locales/en/translation.json'), 'message.plural'],
|
|
470
|
+
[codeEx('next-intl/locales/en/translation.json'), 'notUsedKey'],
|
|
471
471
|
],
|
|
472
472
|
])}
|
|
473
473
|
|
|
474
474
|
Found undefined keys!
|
|
475
475
|
${(0, errorReporters_1.formatTable)([
|
|
476
|
-
[[
|
|
476
|
+
[['file', 'key']],
|
|
477
477
|
[
|
|
478
|
-
[codeEx(
|
|
479
|
-
[codeEx(
|
|
480
|
-
[codeEx(
|
|
481
|
-
[codeEx(
|
|
482
|
-
[codeEx(
|
|
483
|
-
[codeEx(
|
|
484
|
-
[codeEx(
|
|
485
|
-
[codeEx(
|
|
486
|
-
[codeEx(
|
|
487
|
-
[codeEx(
|
|
488
|
-
[codeEx(
|
|
478
|
+
[codeEx('next-intl/src/StrictTypesExample.tsx'), 'About.unknown'],
|
|
479
|
+
[codeEx('next-intl/src/StrictTypesExample.tsx'), 'About.unknown'],
|
|
480
|
+
[codeEx('next-intl/src/StrictTypesExample.tsx'), 'Test.title'],
|
|
481
|
+
[codeEx('next-intl/src/StrictTypesExample.tsx'), 'Test.title'],
|
|
482
|
+
[codeEx('next-intl/src/StrictTypesExample.tsx'), 'title'],
|
|
483
|
+
[codeEx('next-intl/src/StrictTypesExample.tsx'), 'title'],
|
|
484
|
+
[codeEx('next-intl/src/StrictTypesExample.tsx'), 'unknown'],
|
|
485
|
+
[codeEx('next-intl/src/StrictTypesExample.tsx'), 'unknown'],
|
|
486
|
+
[codeEx('next-intl/src/StrictTypesExample.tsx'), 'unknown.unknown'],
|
|
487
|
+
[codeEx('next-intl/src/StrictTypesExample.tsx'), 'unknown.unknown'],
|
|
488
|
+
[codeEx('next-intl/src/Basic.tsx'), 'message.select'],
|
|
489
489
|
],
|
|
490
490
|
])}
|
|
491
491
|
|
|
492
492
|
`);
|
|
493
493
|
});
|
|
494
494
|
});
|
|
495
|
-
describe(
|
|
496
|
-
it(
|
|
497
|
-
const stdout = await execAsync(
|
|
498
|
-
const result = stdout.split(
|
|
495
|
+
describe('YAML', () => {
|
|
496
|
+
it('should return the missing keys for single folder translations', async () => {
|
|
497
|
+
const stdout = await execAsync('node dist/bin/index.js -s en-US -l translations/yaml/flattenExamples');
|
|
498
|
+
const result = stdout.split('Done')[0];
|
|
499
499
|
expect(result).toEqual(`i18n translations checker
|
|
500
500
|
Source: en-US
|
|
501
501
|
|
|
502
502
|
Found missing keys!
|
|
503
503
|
${(0, errorReporters_1.formatTable)([
|
|
504
|
-
[[
|
|
504
|
+
[['file', 'key']],
|
|
505
505
|
[
|
|
506
|
-
[tr(
|
|
507
|
-
[tr(
|
|
506
|
+
[tr('yaml/flattenExamples/de-de.yaml'), 'other.nested.three'],
|
|
507
|
+
[tr('yaml/flattenExamples/de-de.yaml'), 'other.nested.deep.more.final'],
|
|
508
508
|
],
|
|
509
509
|
])}
|
|
510
510
|
|
|
@@ -512,26 +512,26 @@ No invalid translations found!
|
|
|
512
512
|
|
|
513
513
|
`);
|
|
514
514
|
});
|
|
515
|
-
it(
|
|
516
|
-
const stdout = await execAsync(
|
|
517
|
-
const result = stdout.split(
|
|
515
|
+
it('should return the missing/invalid keys for folder per locale with single file', async () => {
|
|
516
|
+
const stdout = await execAsync('node dist/bin/index.js -l translations/yaml/folderExample/ -s en-US');
|
|
517
|
+
const result = stdout.split('Done')[0];
|
|
518
518
|
expect(result).toEqual(`i18n translations checker
|
|
519
519
|
Source: en-US
|
|
520
520
|
|
|
521
521
|
Found missing keys!
|
|
522
522
|
${(0, errorReporters_1.formatTable)([
|
|
523
|
-
[[
|
|
524
|
-
[[tr(
|
|
523
|
+
[['file', 'key']],
|
|
524
|
+
[[tr('yaml/folderExample/de-DE/index.yaml'), 'message.text-format']],
|
|
525
525
|
])}
|
|
526
526
|
|
|
527
527
|
Found invalid keys!
|
|
528
528
|
${(0, errorReporters_1.formatTable)([
|
|
529
|
-
[[
|
|
529
|
+
[['info', 'result']],
|
|
530
530
|
[
|
|
531
|
-
[
|
|
532
|
-
[
|
|
531
|
+
['file', tr('yaml/folderExample/de-DE/index.yaml')],
|
|
532
|
+
['key', 'message.select'],
|
|
533
533
|
[
|
|
534
|
-
|
|
534
|
+
'msg',
|
|
535
535
|
'Expected element of type "select" but received "argument", Unexpected date element, Unexpected date element...',
|
|
536
536
|
],
|
|
537
537
|
],
|
|
@@ -539,212 +539,212 @@ ${(0, errorReporters_1.formatTable)([
|
|
|
539
539
|
|
|
540
540
|
`);
|
|
541
541
|
});
|
|
542
|
-
it(
|
|
543
|
-
const stdout = await execAsync(
|
|
544
|
-
const result = stdout.split(
|
|
542
|
+
it('should return the missing/invalid keys for folder per locale with multiple files', async () => {
|
|
543
|
+
const stdout = await execAsync('node dist/bin/index.js -l translations/yaml/multipleFilesFolderExample/ -s en-US');
|
|
544
|
+
const result = stdout.split('Done')[0];
|
|
545
545
|
expect(result).toEqual(`i18n translations checker
|
|
546
546
|
Source: en-US
|
|
547
547
|
|
|
548
548
|
Found missing keys!
|
|
549
549
|
${(0, errorReporters_1.formatTable)([
|
|
550
|
-
[[
|
|
550
|
+
[['file', 'key']],
|
|
551
551
|
[
|
|
552
552
|
[
|
|
553
|
-
tr(
|
|
554
|
-
|
|
553
|
+
tr('yaml/multipleFilesFolderExample/de-DE/one.yaml'),
|
|
554
|
+
'message.text-format',
|
|
555
555
|
],
|
|
556
|
-
[tr(
|
|
556
|
+
[tr('yaml/multipleFilesFolderExample/de-DE/two.yaml'), 'test.drive.four'],
|
|
557
557
|
],
|
|
558
558
|
])}
|
|
559
559
|
|
|
560
560
|
Found invalid keys!
|
|
561
561
|
${(0, errorReporters_1.formatTable)([
|
|
562
|
-
[[
|
|
562
|
+
[['info', 'result']],
|
|
563
563
|
[
|
|
564
|
-
[
|
|
565
|
-
[
|
|
564
|
+
['file', tr('yaml/multipleFilesFolderExample/de-DE/one.yaml')],
|
|
565
|
+
['key', 'message.select'],
|
|
566
566
|
[
|
|
567
|
-
|
|
567
|
+
'msg',
|
|
568
568
|
'Expected element of type "select" but received "argument", Unexpected date element, Unexpected date element...',
|
|
569
569
|
],
|
|
570
570
|
],
|
|
571
571
|
[
|
|
572
|
-
[
|
|
573
|
-
[
|
|
574
|
-
[
|
|
572
|
+
['file', tr('yaml/multipleFilesFolderExample/de-DE/three.yaml')],
|
|
573
|
+
['key', 'multipleVariables'],
|
|
574
|
+
['msg', 'Expected argument to contain "user" but received "name"'],
|
|
575
575
|
],
|
|
576
576
|
])}
|
|
577
577
|
|
|
578
578
|
`);
|
|
579
579
|
});
|
|
580
|
-
it(
|
|
581
|
-
const stdout = await execAsync(
|
|
582
|
-
const result = stdout.split(
|
|
580
|
+
it('should return the missing/invalid keys for folder containing multiple locale folders', async () => {
|
|
581
|
+
const stdout = await execAsync('node dist/bin/index.js -l translations/yaml/multipleFoldersExample -s en-US');
|
|
582
|
+
const result = stdout.split('Done')[0];
|
|
583
583
|
expect(result).toEqual(`i18n translations checker
|
|
584
584
|
Source: en-US
|
|
585
585
|
|
|
586
586
|
Found missing keys!
|
|
587
587
|
${(0, errorReporters_1.formatTable)([
|
|
588
|
-
[[
|
|
588
|
+
[['file', 'key']],
|
|
589
589
|
[
|
|
590
|
-
[ymlMultiFolders(
|
|
591
|
-
[ymlMultiFolders(
|
|
592
|
-
[ymlMultiFolders(
|
|
593
|
-
[ymlMultiFolders(
|
|
590
|
+
[ymlMultiFolders('spaceOne/locales/de-DE/one.yaml'), 'message.text-format'],
|
|
591
|
+
[ymlMultiFolders('spaceOne/locales/de-DE/two.yaml'), 'test.drive.four'],
|
|
592
|
+
[ymlMultiFolders('spaceTwo/locales/de-DE/one.yaml'), 'message.plural'],
|
|
593
|
+
[ymlMultiFolders('spaceTwo/locales/de-DE/two.yaml'), 'test.drive.two'],
|
|
594
594
|
],
|
|
595
595
|
])}
|
|
596
596
|
|
|
597
597
|
Found invalid keys!
|
|
598
598
|
${(0, errorReporters_1.formatTable)([
|
|
599
|
-
[[
|
|
599
|
+
[['info', 'result']],
|
|
600
600
|
[
|
|
601
|
-
[
|
|
602
|
-
[
|
|
601
|
+
['file', ymlMultiFolders('spaceOne/locales/de-DE/one.yaml')],
|
|
602
|
+
['key', 'message.select'],
|
|
603
603
|
[
|
|
604
|
-
|
|
604
|
+
'msg',
|
|
605
605
|
'Expected element of type "select" but received "argument", Unexpected date element, Unexpected date element...',
|
|
606
606
|
],
|
|
607
607
|
],
|
|
608
608
|
[
|
|
609
|
-
[
|
|
610
|
-
[
|
|
611
|
-
[
|
|
609
|
+
['file', ymlMultiFolders('spaceOne/locales/de-DE/three.yaml')],
|
|
610
|
+
['key', 'multipleVariables'],
|
|
611
|
+
['msg', 'Expected argument to contain "user" but received "name"'],
|
|
612
612
|
],
|
|
613
613
|
[
|
|
614
|
-
[
|
|
615
|
-
[
|
|
614
|
+
['file', ymlMultiFolders('spaceTwo/locales/de-DE/one.yaml')],
|
|
615
|
+
['key', 'message.text-format'],
|
|
616
616
|
[
|
|
617
|
-
|
|
617
|
+
'msg',
|
|
618
618
|
'Expected element of type "tag" but received "number", Unexpected tag element',
|
|
619
619
|
],
|
|
620
620
|
],
|
|
621
621
|
[
|
|
622
|
-
[
|
|
623
|
-
[
|
|
624
|
-
[
|
|
622
|
+
['file', ymlMultiFolders('spaceTwo/locales/de-DE/three.yaml')],
|
|
623
|
+
['key', 'numberFormat'],
|
|
624
|
+
['msg', 'Missing element number'],
|
|
625
625
|
],
|
|
626
626
|
])}
|
|
627
627
|
|
|
628
628
|
`);
|
|
629
629
|
});
|
|
630
|
-
it(
|
|
631
|
-
const stdout = await execAsync(
|
|
632
|
-
const result = stdout.split(
|
|
630
|
+
it('should return the missing/invalid keys for multiple locale folders', async () => {
|
|
631
|
+
const stdout = await execAsync('node dist/bin/index.js -l translations/yaml/multipleFoldersExample/spaceOne translations/yaml/multipleFoldersExample/spaceTwo -s en-US');
|
|
632
|
+
const result = stdout.split('Done')[0];
|
|
633
633
|
expect(result).toEqual(`i18n translations checker
|
|
634
634
|
Source: en-US
|
|
635
635
|
|
|
636
636
|
Found missing keys!
|
|
637
637
|
${(0, errorReporters_1.formatTable)([
|
|
638
|
-
[[
|
|
638
|
+
[['file', 'key']],
|
|
639
639
|
[
|
|
640
|
-
[ymlMultiFolders(
|
|
641
|
-
[ymlMultiFolders(
|
|
642
|
-
[ymlMultiFolders(
|
|
643
|
-
[ymlMultiFolders(
|
|
640
|
+
[ymlMultiFolders('spaceOne/locales/de-DE/one.yaml'), 'message.text-format'],
|
|
641
|
+
[ymlMultiFolders('spaceOne/locales/de-DE/two.yaml'), 'test.drive.four'],
|
|
642
|
+
[ymlMultiFolders('spaceTwo/locales/de-DE/one.yaml'), 'message.plural'],
|
|
643
|
+
[ymlMultiFolders('spaceTwo/locales/de-DE/two.yaml'), 'test.drive.two'],
|
|
644
644
|
],
|
|
645
645
|
])}
|
|
646
646
|
|
|
647
647
|
Found invalid keys!
|
|
648
648
|
${(0, errorReporters_1.formatTable)([
|
|
649
|
-
[[
|
|
649
|
+
[['info', 'result']],
|
|
650
650
|
[
|
|
651
|
-
[
|
|
652
|
-
[
|
|
651
|
+
['file', ymlMultiFolders('spaceOne/locales/de-DE/one.yaml')],
|
|
652
|
+
['key', 'message.select'],
|
|
653
653
|
[
|
|
654
|
-
|
|
654
|
+
'msg',
|
|
655
655
|
'Expected element of type "select" but received "argument", Unexpected date element, Unexpected date element...',
|
|
656
656
|
],
|
|
657
657
|
],
|
|
658
658
|
[
|
|
659
|
-
[
|
|
660
|
-
[
|
|
661
|
-
[
|
|
659
|
+
['file', ymlMultiFolders('spaceOne/locales/de-DE/three.yaml')],
|
|
660
|
+
['key', 'multipleVariables'],
|
|
661
|
+
['msg', 'Expected argument to contain "user" but received "name"'],
|
|
662
662
|
],
|
|
663
663
|
[
|
|
664
|
-
[
|
|
665
|
-
[
|
|
664
|
+
['file', ymlMultiFolders('spaceTwo/locales/de-DE/one.yaml')],
|
|
665
|
+
['key', 'message.text-format'],
|
|
666
666
|
[
|
|
667
|
-
|
|
667
|
+
'msg',
|
|
668
668
|
'Expected element of type "tag" but received "number", Unexpected tag element',
|
|
669
669
|
],
|
|
670
670
|
],
|
|
671
671
|
[
|
|
672
|
-
[
|
|
673
|
-
[
|
|
674
|
-
[
|
|
672
|
+
['file', ymlMultiFolders('spaceTwo/locales/de-DE/three.yaml')],
|
|
673
|
+
['key', 'numberFormat'],
|
|
674
|
+
['msg', 'Missing element number'],
|
|
675
675
|
],
|
|
676
676
|
])}
|
|
677
677
|
|
|
678
678
|
`);
|
|
679
679
|
});
|
|
680
|
-
it(
|
|
681
|
-
const stdout = await execAsync(
|
|
682
|
-
const result = stdout.split(
|
|
680
|
+
it('should return the missing/invalid keys for all files in the provided locale folders', async () => {
|
|
681
|
+
const stdout = await execAsync('node dist/bin/index.js --source en-US --locales translations/yaml/flattenExamples translations/yaml/messageExamples');
|
|
682
|
+
const result = stdout.split('Done')[0];
|
|
683
683
|
expect(result).toEqual(`i18n translations checker
|
|
684
684
|
Source: en-US
|
|
685
685
|
|
|
686
686
|
Found missing keys!
|
|
687
687
|
${(0, errorReporters_1.formatTable)([
|
|
688
|
-
[[
|
|
688
|
+
[['file', 'key']],
|
|
689
689
|
[
|
|
690
|
-
[tr(
|
|
691
|
-
[tr(
|
|
692
|
-
[tr(
|
|
693
|
-
[tr(
|
|
694
|
-
[tr(
|
|
695
|
-
[tr(
|
|
696
|
-
[tr(
|
|
697
|
-
[tr(
|
|
690
|
+
[tr('yaml/flattenExamples/de-de.yaml'), 'other.nested.three'],
|
|
691
|
+
[tr('yaml/flattenExamples/de-de.yaml'), 'other.nested.deep.more.final'],
|
|
692
|
+
[tr('yaml/messageExamples/de-de.yaml'), 'richText'],
|
|
693
|
+
[tr('yaml/messageExamples/de-de.yaml'), 'yo'],
|
|
694
|
+
[tr('yaml/messageExamples/de-de.yaml'), 'nesting1'],
|
|
695
|
+
[tr('yaml/messageExamples/de-de.yaml'), 'nesting2'],
|
|
696
|
+
[tr('yaml/messageExamples/de-de.yaml'), 'nesting3'],
|
|
697
|
+
[tr('yaml/messageExamples/de-de.yaml'), 'key1'],
|
|
698
698
|
],
|
|
699
699
|
])}
|
|
700
700
|
|
|
701
701
|
Found invalid keys!
|
|
702
702
|
${(0, errorReporters_1.formatTable)([
|
|
703
|
-
[[
|
|
703
|
+
[['info', 'result']],
|
|
704
704
|
[
|
|
705
|
-
[
|
|
706
|
-
[
|
|
707
|
-
[
|
|
705
|
+
['file', tr('yaml/messageExamples/de-de.yaml')],
|
|
706
|
+
['key', 'multipleVariables'],
|
|
707
|
+
['msg', 'Unexpected date element'],
|
|
708
708
|
],
|
|
709
709
|
])}
|
|
710
710
|
|
|
711
711
|
`);
|
|
712
712
|
});
|
|
713
|
-
it(
|
|
714
|
-
const stdout = await execAsync(
|
|
715
|
-
const result = stdout.split(
|
|
713
|
+
it('should return the missing/invalid keys for all files with source matching folder and source matching file', async () => {
|
|
714
|
+
const stdout = await execAsync('node dist/bin/index.js -l translations/yaml/multipleFilesFolderExample translations/yaml/flattenExamples -s en-US');
|
|
715
|
+
const result = stdout.split('Done')[0];
|
|
716
716
|
expect(result).toEqual(`i18n translations checker
|
|
717
717
|
Source: en-US
|
|
718
718
|
|
|
719
719
|
Found missing keys!
|
|
720
720
|
${(0, errorReporters_1.formatTable)([
|
|
721
|
-
[[
|
|
721
|
+
[['file', 'key']],
|
|
722
722
|
[
|
|
723
|
-
[tr(
|
|
724
|
-
[tr(
|
|
723
|
+
[tr('yaml/flattenExamples/de-de.yaml'), 'other.nested.three'],
|
|
724
|
+
[tr('yaml/flattenExamples/de-de.yaml'), 'other.nested.deep.more.final'],
|
|
725
725
|
[
|
|
726
|
-
tr(
|
|
727
|
-
|
|
726
|
+
tr('yaml/multipleFilesFolderExample/de-DE/one.yaml'),
|
|
727
|
+
'message.text-format',
|
|
728
728
|
],
|
|
729
|
-
[tr(
|
|
729
|
+
[tr('yaml/multipleFilesFolderExample/de-DE/two.yaml'), 'test.drive.four'],
|
|
730
730
|
],
|
|
731
731
|
])}
|
|
732
732
|
|
|
733
733
|
Found invalid keys!
|
|
734
734
|
${(0, errorReporters_1.formatTable)([
|
|
735
|
-
[[
|
|
735
|
+
[['info', 'result']],
|
|
736
736
|
[
|
|
737
|
-
[
|
|
738
|
-
[
|
|
737
|
+
['file', tr('yaml/multipleFilesFolderExample/de-DE/one.yaml')],
|
|
738
|
+
['key', 'message.select'],
|
|
739
739
|
[
|
|
740
|
-
|
|
740
|
+
'msg',
|
|
741
741
|
'Expected element of type "select" but received "argument", Unexpected date element, Unexpected date element...',
|
|
742
742
|
],
|
|
743
743
|
],
|
|
744
744
|
[
|
|
745
|
-
[
|
|
746
|
-
[
|
|
747
|
-
[
|
|
745
|
+
['file', tr('yaml/multipleFilesFolderExample/de-DE/three.yaml')],
|
|
746
|
+
['key', 'multipleVariables'],
|
|
747
|
+
['msg', 'Expected argument to contain "user" but received "name"'],
|
|
748
748
|
],
|
|
749
749
|
])}
|
|
750
750
|
|