A Grunt task to run jsxgettext extracting strings and creating POT files.
grunt.initConfig({
jsxgettext: {
test: {
files: [
{
src: ['tests/fixtures/**/*.*js', '!ignored'],
output: 'test.po',
'output-dir': './translations/'
}
],
options: {
keyword: ['gettext']
}
}
}
})
**** generators
Type: 'String' or 'function' Default:
[
{ext: '.ejs': generator: jsxgettext.generateFromEJS},
{ext: '.hbs', generator: jsxgettext.generateFromHandlebars},
{ext: '.jade', generator: jsxgettext.generateFromJade},
{ext: '.swig', generator: jsxgettext.generateFromSwig}
]
Used to add/modify mapping between file extensions and generators (parsers) used by jsxgettext.
This can be one of the following:
{ext: '.html': generator: '.hbs'}
{ext: '.html': generator: 'generateFromSwig'}
{ext: '.html': generator: jsxgettext.generateFromSwig}
This plugin requires Grunt ~0.4.2
npm install grunt-jsxgettext --save-dev
One the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-jsxgettext');