-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGruntfile.js
More file actions
46 lines (43 loc) · 1.02 KB
/
Gruntfile.js
File metadata and controls
46 lines (43 loc) · 1.02 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
/*
* Created: Fri Apr 24 2020
* Author: Apple
*/
module.exports = function(grunt) {
grunt.initConfig({
i18next: {
dev: {
src: ['src/**/*.{jsx,js}'],
dest: 'src',
options: {
lngs: ['en', 'zh'],
removeUnusedKeys: false,
sort: false,
keySeparator: false,
nsSeparator: false,
interpolation: {
prefix: '{{',
suffix: '}}',
},
resource: {
loadPath: 'src/locales/{{lng}}/{{ns}}.json',
savePath: 'locales/{{lng}}/{{ns}}.json',
},
func: {
list: ['t'],
extensions: ['.js', '.jsx'],
},
defaultValue: (lng, ns, key) => {
if (lng === 'zh') {
return ''
}
return key
},
},
},
},
})
// Load the plugin that provides the "i18next" task.
grunt.loadNpmTasks('i18next-scanner')
// Default task(s).
grunt.registerTask('default', ['i18next'])
}