-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathi18next-scanner.config.js
More file actions
54 lines (54 loc) · 1.31 KB
/
i18next-scanner.config.js
File metadata and controls
54 lines (54 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// i18next-scanner configuration
module.exports = {
input: [
'src/renderer/src/**/*.{js,jsx,ts,tsx}',
// Use ! to filter out files or directories
'!src/renderer/src/**/*.spec.{js,jsx,ts,tsx}',
'!src/renderer/src/i18n/**',
'!**/node_modules/**',
],
output: './src/renderer/src',
options: {
debug: true,
func: {
list: ['t', 'i18next.t', 'i18n.t'],
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
trans: {
component: 'Trans',
extensions: ['.js', '.jsx', '.ts', '.tsx'],
fallbackKey(ns, value) {
return value;
},
},
lngs: ['en', 'zh'],
ns: ['translation'],
defaultLng: 'en',
defaultNs: 'translation',
defaultValue(lng, ns, key) {
if (lng === 'en') {
// Return key as the default value for English
return key;
}
// Return empty string for other languages
return '';
},
resource: {
loadPath: 'src/renderer/src/locales/{{lng}}/{{ns}}.json',
savePath: 'locales/{{lng}}/{{ns}}.json',
jsonIndent: 2,
lineEnding: '\n',
},
sort: true,
removeUnusedKeys: true,
nsSeparator: ':',
keySeparator: '.',
pluralSeparator: '_',
contextSeparator: '_',
contextDefaultValues: [],
interpolation: {
prefix: '{{',
suffix: '}}',
},
},
};