-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathGruntfile.js
117 lines (102 loc) · 3.63 KB
/
Gruntfile.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*
* grunt-gettext
* https://github.com/arendjr/grunt-gettext
*
* Copyright (c) 2013 Arend van Beelen, Speakap BV
* Licensed under the MIT license.
*/
"use strict";
module.exports = function(grunt) {
grunt.initConfig({
jshint: {
all: [
"Gruntfile.js",
"tasks/*.js"
],
options: {
jshintrc: ".jshintrc",
}
},
/**
* Scans source files and extracts translatable messages from them.
*/
xgettext: {
default_options: {
options: {
/**
* The function name that marks translatable messages.
*/
functionName: "tr",
/**
* The .pot file that is generated by this task (the output
* file).
*
* Warning: This file is overwritten every time you run
* this.
*/
potFile: "messages.pot",
/**
* Custom function that will process every extracted message
* before it's included in the PO file. This may come in
* handy, for example, if you want to simplify whitespace.
*/
//processMessage: function(message) { ... }
},
files: {
/**
* Handlebars files to scan for translatable messages.
*
* Assuming the default functionName is used, translatable
* messages look like this:
*
* {{tr "Some translatable message"}}
* {{tr "You have %1 followers" numFollowers}}
*
* In either case, the first string argument is extracted as
* a translatable message.
*/
handlebars: [],
/**
* JavaScript files to scan for translatable texts.
*
* Assuming the default functionName is used, translatable
* messages look like this:
*
* tr("Some translatable messages")
* tr("You have %1 follower", "You have %1 followers")
* .arg(numFollowers)
*
* In both cases, all string arguments inside the tr()
* function call are extracted as translatable messages.
*/
javascript: []
}
}
},
/**
* Converts translated PO files to JSON resources.
*/
po2json: {
default_options: {
options: {
/**
* If set to true, the JSON resource is wrapped in an
* anonymouse Require.js definition.
*/
requireJs: false
},
/**
* PO files to process.
*
* The keys in this object are the paths of the JSON resources
* to produce, the values are the PO files to process.
*/
files: {
}
}
}
});
grunt.loadTasks("tasks");
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.registerTask("default", ["gettext"]);
};