-
Notifications
You must be signed in to change notification settings - Fork 3
/
i18next-scanner.config.js
54 lines (53 loc) · 1.36 KB
/
i18next-scanner.config.js
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
const typescriptTransform = require('i18next-scanner-typescript');
module.exports = {
input: ['src/**/*.{ts,tsx}', '!src/**/*.test.{ts,tsx}'],
output: './src/',
options: {
debug: true,
func: {
list: ['i18next.t', 'i18n.t', 't'],
extensions: ['.js', '.jsx'],
},
trans: {
// don't pass ts or tsx here!
extensions: ['.js', '.jsx'],
component: 'Trans',
i18nKey: 'i18nKey',
},
lngs: ['en'],
ns: ['translation'],
defaultLng: 'en',
defaultNs: 'translation',
defaultValue: function (lng, ns, key) {
if (lng === 'en') {
// Return key as the default value for English language
return key;
}
// Return the string '__NOT_TRANSLATED__' for other languages
return '';
},
sort: true,
resource: {
loadPath: '/localization/locales/{{lng}}/{{ns}}.json',
savePath: 'localization/locales/{{lng}}/{{ns}}.json',
jsonIndent: 2,
lineEnding: '\n',
},
nsSeparator: false, // namespace separator
keySeparator: false, // key separator
interpolation: {
prefix: '{{',
suffix: '}}',
},
metadata: {},
allowDynamicKeys: false,
},
transform: typescriptTransform({
// default value for extensions
extensions: ['.ts', '.tsx'],
// optional ts configuration
tsOptions: {
target: 'es2017',
},
}),
};