Skip to content

Commit

Permalink
Switch to Compiler / Extractor.
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenv committed Feb 25, 2014
1 parent ac03c1e commit 83e8cc8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions tasks/compile.js
@@ -1,13 +1,10 @@
var compile = require('angular-gettext-tools').compile; var Compiler = require('angular-gettext-tools').Compiler;


module.exports = function (grunt) { module.exports = function (grunt) {
grunt.registerMultiTask('nggettext_compile', 'Compile strings from .po files', function () { grunt.registerMultiTask('nggettext_compile', 'Compile strings from .po files', function () {
var options = this.options({ var options = this.options();
format: 'javascript',
module: 'gettext'
});


if (!compile.hasFormat(options.format)) { if (options.format && !Compiler.hasFormat(options.format)) {
throw new Error('There is no "' + options.format + '" output format.'); throw new Error('There is no "' + options.format + '" output format.');
} }


Expand All @@ -16,7 +13,9 @@ module.exports = function (grunt) {
return grunt.file.read(input); return grunt.file.read(input);
}); });


grunt.file.write(file.dest, compile.convertPo(inputs, options)); var compiler = new Compiler(options);

grunt.file.write(file.dest, compiler.convertPo(inputs));
}); });
}); });
}; };
2 changes: 1 addition & 1 deletion tasks/extract.js
@@ -1,4 +1,4 @@
var Extractor = require('angular-gettext-tools').extract; var Extractor = require('angular-gettext-tools').Extractor;


module.exports = function (grunt) { module.exports = function (grunt) {
grunt.registerMultiTask('nggettext_extract', 'Extract strings from views', function () { grunt.registerMultiTask('nggettext_extract', 'Extract strings from views', function () {
Expand Down

0 comments on commit 83e8cc8

Please sign in to comment.